apache/seatunnel · error · ClickhouseConnectorException
array inject error, unsupported data type: " + type
Error message
array inject error, unsupported data type: " + type
What it means
ArrayInjectFunction.injectFields() maps a SeaTunnel array element type to a SQL type for createArrayOf; any element type outside its known switch cases (Int, BigInt/Long, Float, Double, String, Decimal, Date/Timestamp, Bool) hits the default branch and throws UNSUPPORTED_DATA_TYPE. The ClickHouse sink cannot serialize that array element type into a prepared statement.
Source
Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/inject/ArrayInjectFunction.java:81
case "Int64":
case "UInt64":
sqlType = "BIGINT";
elements = Arrays.copyOf(elements, elements.length, Long[].class);
break;
case "Float32":
sqlType = "REAL";
elements = Arrays.copyOf(elements, elements.length, Float[].class);
break;
case "Float64":
sqlType = "DOUBLE";
elements = Arrays.copyOf(elements, elements.length, Double[].class);
break;
case "Bool":
sqlType = "BOOLEAN";
elements = Arrays.copyOf(elements, elements.length, Boolean[].class);
break;
default:
throw new ClickhouseConnectorException(
CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
"array inject error, unsupported data type: " + type);
}
statement.setArray(index, statement.getConnection().createArrayOf(sqlType, elements));
}
@Override
public boolean isCurrentFieldType(String fieldType) {
if (PATTERN.matcher(fieldType).matches()) {
this.fieldType = fieldType;
return true;
}
return false;
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Cast/flatten the unsupported array column to a supported element type upstream (e.g. via a Transform) before the ClickHouse sink
- Check which element type hits the default branch from the log/config and confirm it is genuinely unsupported
- If the type is a newly added SeaTunnel type, upgrade SeaTunnel or file/patch a case for it in ArrayInjectFunction
- As a workaround, serialize the array to a string column and parse in ClickHouse
Example fix
// before (in ArrayInjectFunction.java)
default:
throw new ClickhouseConnectorException(
CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
"array inject error, unsupported data type: " + type);
// after: add a case for the missing type
case "TinyInt":
sqlType = "INT8";
elements = Arrays.copyOf(elements, elements.length, Byte[].class);
break; Defensive patterns
Strategy: validation
Validate before calling
// validate array element types against supported set before sinking
java.util.Set<String> supported = java.util.Set.of(
"Int", "BigInt", "Float", "Double", "String", "Decimal", "Date", "Timestamp", "Bool", "BooleanType");
catalogTable.getTableSchema().getColumns().stream()
.filter(c -> c.getDataType() instanceof ArrayType)
.forEach(c -> {
String inner = ((ArrayType) c.getDataType()).getElementType().toString();
if (!supported.contains(inner)) {
throw new IllegalArgumentException("Unsupported array element type for ClickHouse sink: " + inner);
}
}); Type guard
boolean isArrayTypeSupported(SeaTunnelDataType<?> t) {
return t instanceof ArrayType && java.util.Set.of("Int","BigInt","Float","Double","String","Decimal","Date","Timestamp","Bool")
.contains(((ArrayType) t).getElementType().toString());
} Try / catch
try {
sinkWriter.write(row);
} catch (ClickhouseConnectorException e) {
if (String.valueOf(e.getMessage()).startsWith("array inject error, unsupported data type")) {
throw new IllegalArgumentException("Cast the array column to a supported element type upstream", e);
}
throw e;
} Prevention
- Inspect source schemas for Array columns and their inner types before using the ClickHouse sink
- Add a Transform to cast/flatten unsupported array types
- After SeaTunnel upgrades, diff new BasicType values against ArrayInjectFunction's switch cases
- Avoid nested arrays and byte arrays in ClickHouse sink schemas
When it happens
Trigger: A source/table schema contains an Array column whose inner type is not one of the supported primitives (e.g. Array of bytes, nested arrays, or a newly added SeaTunnel type not yet mapped in the switch).
Common situations: Reading from a source with Array<Int8>/byte arrays, Array<Array<...>> nested arrays, or upgrading SeaTunnel where a new BasicType was introduced but the ClickHouse ArrayInjectFunction lacks a case for it.
Related errors
- Unsupported type in LocalTimeArrayType: ${eleSqlType}
- UNSUPPORTED_DATA_TYPE
- COMMON_ERROR_CODE-17
- UNSUPPORTED_DATA_TYPE
- Unsupported type: ${sqlType}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/2dd0b236a780bf03.
Report an issue: GitHub.