{"record":{"id":"51d74882a9098799","repo":"apache/flink","slug":"unsupported-type-s-for-field-s","errorCode":null,"errorMessage":"Unsupported type '%s' for field '%s'.","messagePattern":"Unsupported type '(.+?)' for field '(.+?)'\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvRowSchemaConverter.java","lineNumber":229,"sourceCode":"     */\n    private static CsvSchema.ColumnType convertType(String fieldName, LogicalType type) {\n        if (STRING_TYPE_ROOTS.contains(type.getTypeRoot())) {\n            return CsvSchema.ColumnType.STRING;\n        } else if (NUMBER_TYPE_ROOTS.contains(type.getTypeRoot())) {\n            return CsvSchema.ColumnType.NUMBER;\n        } else if (BOOLEAN_TYPE_ROOTS.contains(type.getTypeRoot())) {\n            return CsvSchema.ColumnType.BOOLEAN;\n        } else if (type.getTypeRoot() == LogicalTypeRoot.ARRAY) {\n            validateNestedField(fieldName, ((ArrayType) type).getElementType());\n            return CsvSchema.ColumnType.ARRAY;\n        } else if (type.getTypeRoot() == LogicalTypeRoot.ROW) {\n            RowType rowType = (RowType) type;\n            for (LogicalType fieldType : rowType.getChildren()) {\n                validateNestedField(fieldName, fieldType);\n            }\n            return CsvSchema.ColumnType.ARRAY;\n        } else {\n            throw new IllegalArgumentException(\n                    \"Unsupported type '\"\n                            + type.asSummaryString()\n                            + \"' for field '\"\n                            + fieldName\n                            + \"'.\");\n        }\n    }\n\n    private static void validateNestedField(String fieldName, TypeInformation<?> info) {\n        if (!NUMBER_TYPES.contains(info)\n                && !STRING_TYPES.contains(info)\n                && !BOOLEAN_TYPES.contains(info)) {\n            throw new IllegalArgumentException(\n                    \"Only simple types are supported in the second level nesting of fields '\"\n                            + fieldName\n                            + \"' but was: \"\n                            + info);\n        }","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvRowSchemaConverter.java#L211-L247","documentation":"Thrown by CsvRowSchemaConverter.convertType(fieldName, LogicalType) when a field's LogicalType root is not among CSV-supported roots (numbers, strings, booleans, ARRAY of simple types, ROW of simple types, BYTES-as-string). MAP, MULTISET, RAW, and other complex roots fall to the default branch and abort schema construction with IllegalArgumentException.","triggerScenarios":"A table DDL with a column of type MAP<..,..>, MULTISET<..>, or an obscure type whose root is not covered; ARRAY<ROW<...>> (nested complex inside array) also reaches here indirectly via nested validation.","commonSituations":"Designing a CSV sink/source table by copying a JSON-format table that legitimately has MAP columns; SQL functions producing RAW-typed columns piped into CSV.","solutions":["Remove or transform the MAP/MULTISET/RAW column: cast to STRING, or explode/flatten it into scalar columns.","Use 'json' or 'avro' format if the payload genuinely needs maps and multisets.","For ARRAY columns, ensure element types are simple (number/string/boolean) — no arrays of rows."],"exampleFix":"-- before\nCREATE TABLE t (id INT, attrs MAP<STRING,INT>) WITH ('format'='csv', ...);\n\n-- after\nCREATE TABLE t (id INT, attrs STRING) WITH ('format'='csv', ...);","handlingStrategy":"type-guard","validationCode":"// Mirror of the converter's accepted roots:\nstatic final Set<LogicalTypeRoot> OK = Set.of(/* numbers */ INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL,\n    /* strings */ CHAR, VARCHAR, /* bool */ BOOLEAN, /* binary */ BINARY, VARBINARY,\n    /* temporal */ DATE, TIME_WITHOUT_TIME_ZONE, TIMESTAMP_WITHOUT_TIME_ZONE,\n    TIMESTAMP_WITH_LOCAL_TIME_ZONE, ARRAY, ROW);\nboolean csvRepresentable(LogicalType t) {\n    return OK.contains(t.getTypeRoot());\n}","typeGuard":"static boolean isCsvSupportedType(LogicalType t) {\n    switch (t.getTypeRoot()) {\n        case MAP: case MULTISET: case RAW: return false;\n        default: return true;\n    }\n}","tryCatchPattern":null,"preventionTips":["Lint table DDLs for MAP/MULTISET/RAW when format='csv'","Cast or stringify complex columns upstream"],"tags":["csv","schema","logical-type","unsupported-type"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}