{"record":{"id":"d4f625d57b121b5b","repo":"apache/seatunnel","slug":"unsupported-data-type-d4f625","errorCode":"UNSUPPORTED_DATA_TYPE","errorMessage":"SeaTunnel avro format is not supported for this data type [${sqlType}]","messagePattern":"SeaTunnel avro format is not supported for this data type \\[(.+?)\\]","errorType":"error_code","errorClass":"SeaTunnelAvroFormatException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-avro/src/main/java/org/apache/seatunnel/format/avro/AvroToRowConverter.java","lineNumber":142,"sourceCode":"                for (Object o : map.entrySet()) {\n                    res.put(\n                            convertField(mapType.getKeyType(), ((Map.Entry) o).getKey()),\n                            convertField(mapType.getValueType(), ((Map.Entry) o).getValue()));\n                }\n                return res;\n            case ARRAY:\n                SeaTunnelDataType<?> basicType = ((ArrayType<?, ?>) dataType).getElementType();\n                List<Object> list = (List<Object>) val;\n                return convertArray(list, basicType);\n            case ROW:\n                SeaTunnelRowType subRow = (SeaTunnelRowType) dataType;\n                return converter((GenericRecord) val, subRow);\n            default:\n                String errorMsg =\n                        String.format(\n                                \"SeaTunnel avro format is not supported for this data type [%s]\",\n                                dataType.getSqlType());\n                throw new SeaTunnelAvroFormatException(\n                        AvroFormatErrorCode.UNSUPPORTED_DATA_TYPE, errorMsg);\n        }\n    }\n\n    protected Object convertArray(List<Object> val, SeaTunnelDataType<?> dataType) {\n        if (val == null) {\n            return null;\n        }\n        int length = val.size();\n        Object instance = Array.newInstance(dataType.getTypeClass(), length);\n        for (int i = 0; i < val.size(); i++) {\n            Array.set(instance, i, convertField(dataType, val.get(i)));\n        }\n        return instance;\n    }\n}\n","sourceCodeStart":124,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-avro/src/main/java/org/apache/seatunnel/format/avro/AvroToRowConverter.java#L124-L159","documentation":"SeaTunnelAvroFormatException with code UNSUPPORTED_DATA_TYPE thrown by AvroToRowConverter.convertField when it encounters a SeaTunnel SQL type it cannot map from Avro to a Row field. The switch over dataType falls into the default branch for types the avro format does not handle (e.g. MAP, some TIME/ARRAY variants depending on version).","triggerScenarios":"Deserializing an Avro GenericRecord into a SeaTunnelRow whose SeaTunnelRowType contains a data type not implemented in convertField's switch — reading back data written with a richer schema than the converter supports.","commonSituations":"Using Avro format with tables containing MAP or complex types not supported by the converter; schema drift after adding new columns of unsupported types; version mismatch between writer and reader SeaTunnel versions.","solutions":["Check which SqlType hit the default branch (in the error message) and avoid that type in the row type for Avro format","Convert unsupported fields to STRING before Avro serialization","Upgrade to a SeaTunnel version with broader Avro type coverage","Extend convertField to handle the type if you control the code"],"exampleFix":"// before\nSeaTunnelRowType rowType = new SeaTunnelRowType(new String[]{\"m\"}, new SeaTunnelDataType<?>[]{new MapType<>(STRING_TYPE, INT_TYPE)});\n// after\nSeaTunnelRowType rowType = new SeaTunnelRowType(new String[]{\"m\"}, new SeaTunnelDataType<?>[]{STRING_TYPE}); // serialize map as JSON string","handlingStrategy":"validation","validationCode":"import static org.apache.seatunnel.api.table.type.BasicType.*;\n// check row types are Avro-decodable before use\nfor (SeaTunnelDataType<?> t : rowType.getFieldTypes()) {\n    if (!(t == STRING_TYPE || t == INT_TYPE || t == LONG_TYPE || /* supported set */ ...))\n        throw new IllegalArgumentException(\"Avro format unsupported type: \" + t.getSqlType());\n}","typeGuard":null,"tryCatchPattern":"try {\n    row = avroToRowConverter.converter(record, rowType);\n} catch (SeaTunnelAvroFormatException e) {\n    if (e.getFormatErrorCode() == AvroFormatErrorCode.UNSUPPORTED_DATA_TYPE) {\n        LOG.error(\"Unsupported sqlType reading Avro: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Restrict Avro-format tables to primitive supported types","Convert MAP/complex columns to JSON STRING before the format layer","Verify type coverage for your SeaTunnel version before choosing avro format"],"tags":["java","avro","unsupported-type","deserialization"],"backgroundTag":"unsupported-dtype","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}