apache/seatunnel · error · IllegalArgumentException

seaTunnelDataType cannot be null

Error message

seaTunnelDataType cannot be null

What it means

ArrowToSeatunnelRowReader.convertArrowData requires a non-null SeaTunnelDataType to decide which converter branch to use for an Arrow FieldVector; a null type throws IllegalArgumentException. It means the schema/type resolution produced a null entry for a column before value conversion.

Source

Thrown at seatunnel-connectors-v2/connector-common/src/main/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/reader/ArrowToSeatunnelRowReader.java:237

                } else if (fieldValue instanceof String) {
                    return LocalDateTime.parse((String) fieldValue, DATETIME_FORMATTER);
                } else if (fieldValue instanceof Text) {
                    return LocalDateTime.parse(((Text) fieldValue).toString(), DATETIME_FORMATTER);
                } else {
                    return fieldValue;
                }
            default:
                return fieldValue;
        }
    }

    private Object convertArrowData(
            int rowIndex,
            Types.MinorType minorType,
            FieldVector fieldVector,
            SeaTunnelDataType<?> seaTunnelDataType) {
        if (seaTunnelDataType == null) {
            throw new IllegalArgumentException("seaTunnelDataType cannot be null");
        }

        for (Converter converter : converters) {
            if (converter.support(minorType)) {
                SqlType sqlType = seaTunnelDataType.getSqlType();
                switch (sqlType) {
                    case MAP:
                        return convertMap(
                                rowIndex, converter, fieldVector, (MapType) seaTunnelDataType);
                    case ARRAY:
                        return convertArray(
                                rowIndex, converter, fieldVector, (ArrayType) seaTunnelDataType);
                    case ROW:
                        return convertRow(
                                rowIndex,
                                converter,
                                fieldVector,
                                (SeaTunnelRowType) seaTunnelDataType);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify every column name in the configured SeaTunnelRowType matches the source schema exactly (same order, spelling, case) so its type array is fully populated.
  2. Null-check the constructed SeaTunnelRowType before creating the reader; fail fast with a clear message instead of a null field type.
  3. Regenerate the schema from the actual table (schema inference) rather than hand-writing it if columns changed.
  4. If constructing programmatically, assert types.length == fieldNames.length and no null elements.

Example fix

// before
SeaTunnelRowType t = new SeaTunnelRowType(names, types); // types contains null
// after
Objects.requireNonNull(t.getFieldType("user_id"), "missing type for column user_id");
SeaTunnelRowType t = buildTypeFromSchema(tableSchema);
Defensive patterns

Strategy: validation

Validate before calling

// validate the row type before constructing the reader
for (int i = 0; i < rowType.getTotalFields(); i++) {
    Objects.requireNonNull(rowType.getFieldType(i),
        "null type for field " + rowType.getFieldName(i));
}

Type guard

boolean rowTypeComplete(SeaTunnelRowType t) {
    return t != null && t.getFieldNames().length == t.getFieldTypes().length
        && Arrays.stream(t.getFieldTypes()).allMatch(Objects::nonNull);
}

Try / catch

try {
    Object v = convertArrowData(rowIndex, minorType, fieldVector, dataType);
} catch (IllegalArgumentException e) {
    LOG.error("type resolution failed for column {}", fieldVector.getName());
    throw new SchemaMismatchException(fieldVector.getName(), e);
}

Prevention

When it happens

Trigger: Calling convertArrowData (via fieldValue) with seaTunnelDataType == null — usually because the SeaTunnelRowType's field type lookup returned null: a column name mismatch between Arrow schema and the configured SeaTunnel schema, or an incompletely built row type.

Common situations: Configured schema columns don't match the Arrow/ClickHouse result columns (typo, case mismatch, column removed upstream); programmatically constructed SeaTunnelRowType with a null in the types array; connector version where schema inference skipped a type.

Related errors


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