apache/seatunnel · error · KuduConnectorException
DATA_TYPE_CAST_FIELD
DATA_TYPE_CAST_FIELD
Error message
Value type does not match column type for column
What it means
KuduRowSerializer catches a ClassCastException thrown while converting a SeaTunnelRow field value to the type required by the Kudu column, and rethrows it as a KuduConnectorException with code DATA_TYPE_CAST_FIELD. It means the SeaTunnel row field's runtime Java type does not correspond to the declared column SQL type (e.g. a String value in an INT column). The exception names the offending SQL type and column so the mismatch can be located quickly.
Source
Thrown at seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/serialize/KuduRowSerializer.java:113
break;
case TIMESTAMP:
Object fieldValue = element.getField(columnIndex);
if (fieldValue == null) {
row.addObject(seaTunnelRowType.getFieldName(columnIndex), null);
} else {
LocalDateTime localDateTime = (LocalDateTime) fieldValue;
row.addObject(
seaTunnelRowType.getFieldName(columnIndex),
java.sql.Timestamp.valueOf(localDateTime));
}
break;
default:
throw new KuduConnectorException(
CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
"Unsupported column type: " + type.getSqlType());
}
} catch (ClassCastException e) {
throw new KuduConnectorException(
KuduConnectorErrorCode.DATA_TYPE_CAST_FIELD,
"Value type does not match column type "
+ type.getSqlType()
+ " for column "
+ seaTunnelRowType.getFieldName(columnIndex));
}
}
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Check the SeaTunnelRowType schema matches the actual runtime types of the values in the row; fix the upstream source/transform to emit correct types
- Add a transform (e.g. FieldMapper/CDC type conversion) to cast fields to the expected type before the Kudu sink
- Verify field order in your source matches the Kudu table column order or use explicit column mapping
- Log the row and rowType at DEBUG to identify which field value has the wrong class
Example fix
// before: value emitted as String "123" for INT column
row = new SeaTunnelRow(new Object[]{"123"});
// after: convert to Integer in transform or source
row = new SeaTunnelRow(new Object[]{Integer.parseInt("123")}); Defensive patterns
Strategy: validation
Validate before calling
for (int i = 0; i < rowType.getTotalFields(); i++) {
Object v = row.getField(i);
if (v != null && !expectedJavaClass(rowType.getFieldType(i)).isInstance(v)) {
throw new IllegalStateException("Field " + rowType.getFieldName(i) + " has wrong type: " + v.getClass());
}
} Type guard
boolean matches(SeaTunnelRowType t, int i, Object v) {
return v == null || expectedJavaClass(t.getFieldType(i)).isInstance(v);
} Try / catch
try {
serializer.serializeRow(row);
} catch (KuduConnectorException e) {
if (KuduConnectorErrorCode.DATA_TYPE_CAST_FIELD.equals(e.getErrorCode())) {
// fix upstream typing or coerce field, then retry
} else throw e;
} Prevention
- Declare SeaTunnelRowType field types identical to the Kudu table schema
- Insert explicit cast/mapping transforms between source and Kudu sink
- Test with a sample row before full pipeline runs
- Watch for sources that read all fields as strings (CSV/JSON)
When it happens
Trigger: serializeRow writes a SeaTunnelRow whose field at columnIndex cannot be cast to the Java class expected by the Kudu column type declared in the SeaTunnelRowType; e.g. the upstream transform produced a String where Kudu expects an Integer, or vice versa.
Common situations: Upstream source or transform emits different types than declared in the catalog schema; users map Kudu INT columns to string data; field ordering mismatch causes values to land in the wrong column type after schema changes; CSV/JSON sources reading all fields as strings feed directly into Kudu sink.
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
- Unsupported type: ${clazz}
- Value is not a supported long
- Unsupported type:
- COMMON-02
- Unsupported convert %s to Map, typeDefine: %s
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/38db76a3c4cfd3ef.
Report an issue: GitHub.