apache/flink · error · UnsupportedOperationException

Not support to parse type: %s

Error message

Not support to parse type: %s

What it means

Thrown by RowDataToJsonConverters.createConverter when it encounters a logical type with no JSON serialization case, notably RAW and any type not in the switch. The JSON serialization format simply has no representation for these types, so converter construction fails. This happens at schema setup time, before any record is serialized.

Source

Thrown at flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/RowDataToJsonConverters.java:158

            case ARRAY:
                return createArrayConverter((ArrayType) type);
            case MAP:
                MapType mapType = (MapType) type;
                return createMapConverter(
                        mapType.asSummaryString(), mapType.getKeyType(), mapType.getValueType());
            case MULTISET:
                MultisetType multisetType = (MultisetType) type;
                return createMapConverter(
                        multisetType.asSummaryString(),
                        multisetType.getElementType(),
                        new IntType());
            case ROW:
                return createRowConverter((RowType) type);
            case VARIANT:
                return this::convertVariant;
            case RAW:
            default:
                throw new UnsupportedOperationException("Not support to parse type: " + type);
        }
    }

    private RowDataToJsonConverter createDecimalConverter() {
        return (mapper, reuse, value) -> {
            BigDecimal bd = ((DecimalData) value).toBigDecimal();
            return mapper.getNodeFactory()
                    .numberNode(
                            mapper.isEnabled(WRITE_BIGDECIMAL_AS_PLAIN)
                                    ? bd
                                    : bd.stripTrailingZeros());
        };
    }

    private JsonNode convertVariant(ObjectMapper mapper, JsonNode reuse, Object value) {
        try {
            return mapper.readTree(((Variant) value).toJson());
        } catch (IOException e) {

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Remove the RAW column from the sink schema or project it away before the JSON sink
  2. Convert the RAW value to a JSON-compatible representation (STRING via toString or a proper serializer) in a UDF/map before writing
  3. Replace RAW with a concrete supported type (STRING, BYTES) in the intermediate schema

Example fix

// before
CREATE TABLE out (payload RAW<...>, ...) WITH ('connector'='kafka', 'format'='json');

// after
CREATE TABLE out (payload STRING, ...) WITH ('connector'='kafka', 'format'='json');
-- and serialize the object to a string upstream
Defensive patterns

Strategy: type-guard

Validate before calling

Set<LogicalTypeRoot> unsupported = EnumSet.of(LogicalTypeRoot.RAW);
for (LogicalType t : rowType.getChildren()) {
    if (unsupported.contains(t.getTypeRoot())) throw new IllegalArgumentException("JSON sink cannot write " + t);
}

Type guard

static boolean jsonSerializable(LogicalType t) {
    return t.getTypeRoot() != LogicalTypeRoot.RAW;
}

Prevention

When it happens

Trigger: Using format 'json' (or a connector writing JSON such as Kafka sink) with a column of type RAW, or an unrecognized/custom LogicalType. Throws when JsonRowDataSerializationSchema builds its converters, i.e. at operator open/job startup.

Common situations: Carrying RAW-typed internal objects (e.g. custom classes) through a pipeline that ends in a JSON sink; internal/advanced types leaking into a sink schema; third-party type-system extensions without a JSON mapping.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/e66376c0c00d7de7. Report an issue: GitHub.