{"record":{"id":"3e285a8916d1f89c","repo":"apache/seatunnel","slug":"commonerrorcodedeprecated-unsupported-data-type-3e285a","errorCode":"CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE","errorMessage":"Unsupported data type: {timestampFieldType}","messagePattern":"Unsupported data type: (.+?)","errorType":"error_code","errorClass":"IotdbConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/serialize/DefaultSeaTunnelRowSerializer.java","lineNumber":96,"sourceCode":"        return row -> {\n            Object timestamp = row.getField(timestampFieldIndex);\n            if (timestamp == null) {\n                return System.currentTimeMillis();\n            }\n            SeaTunnelDataType<?> timestampFieldType =\n                    seaTunnelRowType.getFieldType(timestampFieldIndex);\n            switch (timestampFieldType.getSqlType()) {\n                case STRING:\n                    return Long.parseLong((String) timestamp);\n                case TIMESTAMP:\n                    return ((LocalDateTime) timestamp)\n                            .atZone(ZoneOffset.UTC)\n                            .toInstant()\n                            .toEpochMilli();\n                case BIGINT:\n                    return (Long) timestamp;\n                default:\n                    throw new IotdbConnectorException(\n                            CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,\n                            \"Unsupported data type: \" + timestampFieldType);\n            }\n        };\n    }\n\n    private Function<SeaTunnelRow, String> createDeviceExtractor(\n            SeaTunnelRowType seaTunnelRowType, String deviceKey, String storageGroup) {\n        int deviceIndex = seaTunnelRowType.indexOf(deviceKey);\n        return seaTunnelRow -> {\n            String device = seaTunnelRow.getField(deviceIndex).toString();\n            if (Strings.isNullOrEmpty(storageGroup)) {\n                return device;\n            }\n            if (storageGroup.endsWith(\".\") || device.startsWith(\".\")) {\n                return storageGroup + device;\n            }\n            return storageGroup + \".\" + device;","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/serialize/DefaultSeaTunnelRowSerializer.java#L78-L114","documentation":"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.","triggerScenarios":"Calling createTimestampExtractor() with timestampFieldType not TIMESTAMP and not BIGINT — e.g. writing rows whose declared time column is STRING, DATE, or INT.","commonSituations":"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.","solutions":["Declare the sink's timestamp column as TIMESTAMP or BIGINT","Insert a transform (e.g. FieldMapper/SQL cast) to convert the string date to TIMESTAMP before the IoTDB sink","Verify the upstream schema column order/types match what the sink expects"],"exampleFix":"// before\nrowType field 0: (\"time\", StringType) // \"2024-01-01 00:00:00\"\n// after\nrowType field 0: (\"time\", LocalTimeType.LOCAL_DATE_TIME_TYPE) // or cast upstream to TIMESTAMP","handlingStrategy":"validation","validationCode":"// before creating the sink, check the time column type\nSqlType t = rowType.getFieldType(0).getSqlType();\nif (t != SqlType.TIMESTAMP && t != SqlType.BIGINT) {\n    throw new IllegalArgumentException(\"IoTDB sink time column must be TIMESTAMP or BIGINT, got \" + t);\n}","typeGuard":"boolean sinkTimeColumnOk(SeaTunnelRowType rowType) {\n    SqlType s = rowType.getFieldType(0).getSqlType();\n    return s == SqlType.TIMESTAMP || s == SqlType.BIGINT;\n}","tryCatchPattern":"try {\n    serializer.write(row);\n} catch (IotdbConnectorException e) {\n    if (e.getCode() == CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE) {\n        // add an upstream cast to TIMESTAMP before the IoTDB sink\n    } else { throw e; }\n}","preventionTips":["Cast string/epoch columns to TIMESTAMP via a transform before the IoTDB sink","Keep the sink schema's first field as the timestamp with type TIMESTAMP or BIGINT"],"tags":["iotdb","timestamp","serialization"],"backgroundTag":"type-mismatch","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"}