{"record":{"id":"c08ccb33d175ba38","repo":"apache/seatunnel","slug":"unsupported-data-type-c08ccb","errorCode":"UNSUPPORTED_DATA_TYPE","errorMessage":"SeaTunnel format not support this data type \" + fieldType.getSqlType()","messagePattern":"SeaTunnel format not support this data type \" \\+ fieldType\\.getSqlType\\(\\)","errorType":"error_code","errorClass":"FileConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/util/XmlWriter.java","lineNumber":128,"sourceCode":"                return fieldValue.toString();\n            case NULL:\n                return \"\";\n            case ROW:\n                Object[] fields = ((SeaTunnelRow) fieldValue).getFields();\n                String[] strings = new String[fields.length];\n                for (int i = 0; i < fields.length; i++) {\n                    strings[i] =\n                            convertToXmlString(\n                                    fields[i], ((SeaTunnelRowType) fieldType).getFieldType(i));\n                }\n                return String.join(fieldDelimiter, strings);\n            case MAP:\n            case ARRAY:\n                return JsonUtils.toJsonString(fieldValue);\n            case BYTES:\n                return new String((byte[]) fieldValue, StandardCharsets.UTF_8);\n            default:\n                throw new FileConnectorException(\n                        CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,\n                        \"SeaTunnel format not support this data type \" + fieldType.getSqlType());\n        }\n    }\n\n    public void flushAndCloseXmlWriter(OutputStream output) throws IOException {\n        XMLWriter xmlWriter = new XMLWriter(output, format);\n        xmlWriter.write(document);\n        xmlWriter.close();\n    }\n\n    private void setXmlOutputFormat() {\n        this.format = OutputFormat.createPrettyPrint();\n        this.format.setNewlines(true);\n        this.format.setNewLineAfterDeclaration(true);\n        this.format.setSuppressDeclaration(false);\n        this.format.setExpandEmptyElements(false);\n        this.format.setIndent(\"\\t\");","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/util/XmlWriter.java#L110-L146","documentation":"XmlWriter.convertToXmlString maps each SeaTunnel field's SqlType to an XML-serializable string; supported types fall through to a default branch that throws FileConnectorException with UNSUPPORTED_DATA_TYPE: 'SeaTunnel format not support this data type <SqlType>'. Types not explicitly handled (certain complex/nested or exotic types beyond MAP/ARRAY/bytes handling) cannot be rendered into XML text.","triggerScenarios":"Writing a row to an XML file sink whose schema includes a SeaTunnel type not covered by convertToXmlString's switch (e.g. ROW/nested struct or other unsupported SqlTypes).","commonSituations":"Sinks downstream of nested transforms producing ROW columns; users adding new SeaTunnel types upstream without checking XML writer support; JSON-flavored nested data routed to XML output.","solutions":["Flatten or remove unsupported nested fields before the sink (e.g. JSON transform to stringify, or select only scalar columns).","Switch file_format_type to json/parquet, which support nested types.","Serialize the complex field to a string yourself in a transform so it arrives as a supported scalar type."],"exampleFix":"// before\nTransform {\n  SQL { source_table_name = \"t\" query = \"SELECT nested_col FROM t\" }\n}\n// after\nTransform {\n  SQL { source_table_name = \"t\" query = \"SELECT CAST(nested_col AS STRING) AS nested_col FROM t\" }\n}","handlingStrategy":"type-guard","validationCode":"// check schema before selecting xml output\nfor (SeaTunnelDataType<?> t : rowType.getFieldTypes()) {\n  if (t.getSqlType() == SqlType.ROW || t.getSqlType() == SqlType.STRUCT) {\n    throw new IllegalArgumentException(\"xml sink does not support nested type \" + t);\n  }\n}","typeGuard":"boolean isXmlSupported(SeaTunnelDataType<?> t) {\n  switch (t.getSqlType()) {\n    case STRING: case INT: case BIGINT: case DOUBLE: case BOOLEAN:\n    case DATE: case TIMESTAMP: case DECIMAL: case MAP: case ARRAY: case BYTES:\n      return true;\n    default:\n      return false;\n  }\n}","tryCatchPattern":"try {\n  xmlWriter.writeData(row);\n} catch (FileConnectorException e) {\n  if (e.getCode() == CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE) {\n    // flatten/stringify the offending column and rewrite\n  }\n  throw e;\n}","preventionTips":["Prefer json/parquet when schemas contain nested ROW types.","Flatten nested structs in transforms before XML sinks.","Keep an allowlist of supported SqlTypes per file format in your config validation."],"tags":["xml","unsupported-data-type","serialization"],"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"}