apache/seatunnel · error · FileConnectorException

UNSUPPORTED_DATA_TYPE

UNSUPPORTED_DATA_TYPE

Error message

SeaTunnel format not support this data type " + fieldType.getSqlType()

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/util/XmlWriter.java:128

                return fieldValue.toString();
            case NULL:
                return "";
            case ROW:
                Object[] fields = ((SeaTunnelRow) fieldValue).getFields();
                String[] strings = new String[fields.length];
                for (int i = 0; i < fields.length; i++) {
                    strings[i] =
                            convertToXmlString(
                                    fields[i], ((SeaTunnelRowType) fieldType).getFieldType(i));
                }
                return String.join(fieldDelimiter, strings);
            case MAP:
            case ARRAY:
                return JsonUtils.toJsonString(fieldValue);
            case BYTES:
                return new String((byte[]) fieldValue, StandardCharsets.UTF_8);
            default:
                throw new FileConnectorException(
                        CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
                        "SeaTunnel format not support this data type " + fieldType.getSqlType());
        }
    }

    public void flushAndCloseXmlWriter(OutputStream output) throws IOException {
        XMLWriter xmlWriter = new XMLWriter(output, format);
        xmlWriter.write(document);
        xmlWriter.close();
    }

    private void setXmlOutputFormat() {
        this.format = OutputFormat.createPrettyPrint();
        this.format.setNewlines(true);
        this.format.setNewLineAfterDeclaration(true);
        this.format.setSuppressDeclaration(false);
        this.format.setExpandEmptyElements(false);
        this.format.setIndent("\t");

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Flatten or remove unsupported nested fields before the sink (e.g. JSON transform to stringify, or select only scalar columns).
  2. Switch file_format_type to json/parquet, which support nested types.
  3. Serialize the complex field to a string yourself in a transform so it arrives as a supported scalar type.

Example fix

// before
Transform {
  SQL { source_table_name = "t" query = "SELECT nested_col FROM t" }
}
// after
Transform {
  SQL { source_table_name = "t" query = "SELECT CAST(nested_col AS STRING) AS nested_col FROM t" }
}
Defensive patterns

Strategy: type-guard

Validate before calling

// check schema before selecting xml output
for (SeaTunnelDataType<?> t : rowType.getFieldTypes()) {
  if (t.getSqlType() == SqlType.ROW || t.getSqlType() == SqlType.STRUCT) {
    throw new IllegalArgumentException("xml sink does not support nested type " + t);
  }
}

Type guard

boolean isXmlSupported(SeaTunnelDataType<?> t) {
  switch (t.getSqlType()) {
    case STRING: case INT: case BIGINT: case DOUBLE: case BOOLEAN:
    case DATE: case TIMESTAMP: case DECIMAL: case MAP: case ARRAY: case BYTES:
      return true;
    default:
      return false;
  }
}

Try / catch

try {
  xmlWriter.writeData(row);
} catch (FileConnectorException e) {
  if (e.getCode() == CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE) {
    // flatten/stringify the offending column and rewrite
  }
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/c08ccb33d175ba38. Report an issue: GitHub.