apache/seatunnel · error · IotdbConnectorException

UNSUPPORTED_DATA_TYPE

UNSUPPORTED_DATA_TYPE

Error message

Unsupported data type: 

What it means

RelationalSeaTunnelRowSerializer.createTimestampExtractor() (used for IoTDB relational/table-mode writes) extracts the record timestamp as epoch millis and supports only TIMESTAMP (LocalDateTime) and BIGINT (Long) field types. Any other type for the configured timestamp field reaches the default branch and throws IotdbConnectorException with CommonErrorCode.UNSUPPORTED_DATA_TYPE. The relational serializer cannot convert other types to epoch millis.

Source

Thrown at seatunnel-connectors-v2/connector-iotdb-v2/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdbv2/serialize/relational/RelationalSeaTunnelRowSerializer.java:108

        return row -> {
            Object timestamp = row.getField(timestampFieldIndex);
            if (timestamp == null) {
                return System.currentTimeMillis();
            }
            SeaTunnelDataType<?> timestampFieldType =
                    seaTunnelRowType.getFieldType(timestampFieldIndex);
            switch (timestampFieldType.getSqlType()) {
                case STRING:
                    return Long.parseLong((String) timestamp);
                case TIMESTAMP:
                    return ((LocalDateTime) timestamp)
                            .atZone(ZoneOffset.UTC)
                            .toInstant()
                            .toEpochMilli();
                case BIGINT:
                    return (Long) timestamp;
                default:
                    throw new IotdbConnectorException(
                            CommonErrorCode.UNSUPPORTED_DATA_TYPE,
                            "Unsupported data type: " + timestampFieldType);
            }
        };
    }

    private Function<SeaTunnelRow, List<String>> createTagAttributeExtractor(
            SeaTunnelRowType seaTunnelRowType, List<String> keys) {
        List<Integer> indices = new ArrayList<>();
        for (String key : keys) {
            indices.add(seaTunnelRowType.indexOf(key));
        }
        return seaTunnelRow -> {
            List<String> res = new ArrayList<>();
            for (int index : indices) {
                res.add(seaTunnelRow.getField(index).toString());
            }
            return res;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Declare the timestamp field as TIMESTAMP (LocalDateTime) or BIGINT (epoch millis) in the sink schema/options
  2. Pre-convert STRING/DATE/INT timestamps with a Transform (CAST/parse) before the IoTDB sink
  3. Verify the timestamp_field/timestamp_data_type options match the upstream schema exactly
  4. Upgrade the connector in case newer versions accept more timestamp input types

Example fix

// before
timestamp_field = "event_time"  // upstream STRING 'yyyy-MM-dd HH:mm:ss'
// after: parse in a Transform, then
timestamp_field = "event_time"  // declared as TIMESTAMP (LocalDateTime)
Defensive patterns

Strategy: validation

Validate before calling

SqlType s = timestampFieldType.getSqlType();
if (s != SqlType.TIMESTAMP && s != SqlType.BIGINT) {
    throw new IllegalArgumentException(
        "Relational IoTDB timestamp field must be TIMESTAMP or BIGINT, got: " + s);
}

Type guard

boolean validRelationalTimestamp(SeaTunnelFieldType t) {
    return t.getSqlType() == SqlType.TIMESTAMP || t.getSqlType() == SqlType.BIGINT;
}

Try / catch

try {
    serializer = new RelationalSeaTunnelRowSerializer(...);
} catch (IotdbConnectorException e) {
    if (e.getSeaTunnelErrorCode() == CommonErrorCode.UNSUPPORTED_DATA_TYPE) {
        // fix timestamp field type to TIMESTAMP or BIGINT
    }
    throw e;
}

Prevention

When it happens

Trigger: Writing to IoTDB in relational mode when the timestamp field's SeaTunnel type is neither TIMESTAMP nor BIGINT — e.g. STRING, INT, DATE. Thrown when the timestamp extractor lambda is created inside RelationalSeaTunnelRowSerializer (sink serialization setup).

Common situations: Configuring the timestamp field as a formatted STRING like '2024-01-01 00:00:00' instead of TIMESTAMP/BIGINT; source emits DATE or INT epoch seconds that the connector does not coerce; mismatch between source output schema and sink's timestamp_data_type option.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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