apache/seatunnel · error · IotdbConnectorException

CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE

CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE

Error message

Unsupported data type: {timestampFieldType}

What it means

DefaultSeaTunnelRowSerializer.createTimestampExtractor() builds a lambda that extracts epoch-millis from a SeaTunnelRow's timestamp column, supporting only SqlType TIMESTAMP and BIGINT. Any other declared type throws UNSUPPORTED_DATA_TYPE. This is the sink-side mirror of the source-side timestamp rule.

Source

Thrown at seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/serialize/DefaultSeaTunnelRowSerializer.java:96

        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(
                            CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
                            "Unsupported data type: " + timestampFieldType);
            }
        };
    }

    private Function<SeaTunnelRow, String> createDeviceExtractor(
            SeaTunnelRowType seaTunnelRowType, String deviceKey, String storageGroup) {
        int deviceIndex = seaTunnelRowType.indexOf(deviceKey);
        return seaTunnelRow -> {
            String device = seaTunnelRow.getField(deviceIndex).toString();
            if (Strings.isNullOrEmpty(storageGroup)) {
                return device;
            }
            if (storageGroup.endsWith(".") || device.startsWith(".")) {
                return storageGroup + device;
            }
            return storageGroup + "." + device;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Declare the sink's timestamp column as TIMESTAMP or BIGINT
  2. Insert a transform (e.g. FieldMapper/SQL cast) to convert the string date to TIMESTAMP before the IoTDB sink
  3. Verify the upstream schema column order/types match what the sink expects

Example fix

// before
rowType field 0: ("time", StringType) // "2024-01-01 00:00:00"
// after
rowType field 0: ("time", LocalTimeType.LOCAL_DATE_TIME_TYPE) // or cast upstream to TIMESTAMP
Defensive patterns

Strategy: validation

Validate before calling

// before creating the sink, check the time column type
SqlType t = rowType.getFieldType(0).getSqlType();
if (t != SqlType.TIMESTAMP && t != SqlType.BIGINT) {
    throw new IllegalArgumentException("IoTDB sink time column must be TIMESTAMP or BIGINT, got " + t);
}

Type guard

boolean sinkTimeColumnOk(SeaTunnelRowType rowType) {
    SqlType s = rowType.getFieldType(0).getSqlType();
    return s == SqlType.TIMESTAMP || s == SqlType.BIGINT;
}

Try / catch

try {
    serializer.write(row);
} catch (IotdbConnectorException e) {
    if (e.getCode() == CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE) {
        // add an upstream cast to TIMESTAMP before the IoTDB sink
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling createTimestampExtractor() with timestampFieldType not TIMESTAMP and not BIGINT — e.g. writing rows whose declared time column is STRING, DATE, or INT.

Common situations: Upstream source emits the time as a string and the user forgot to cast it; schema evolution changed the time column type; copying a sink config from a table whose time column was BIGINT into one with STRING.

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/3e285a8916d1f89c. Report an issue: GitHub.