apache/seatunnel · error · org.apache.seatunnel.common.exception.SeaTunnelRuntimeException
COMMON-16
COMMON-16
Error message
'<connector>' <type> unsupported convert type '<dataType>' of '<field>' to SeaTunnel data type.
What it means
HiveTypeConvertor.covertHiveTypeToSeaTunnelType maps Hive column types to SeaTunnel types. Hive CHAR (e.g. char(n)) has no supported SeaTunnel mapping here and is rejected with COMMON-16 convertToSeaTunnelTypeError naming the connector, type, and field. Note varchar maps to STRING but char intentionally throws.
Source
Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveTypeConvertor.java:39
import org.apache.seatunnel.api.table.type.BasicType;
import org.apache.seatunnel.api.table.type.DecimalType;
import org.apache.seatunnel.api.table.type.PrimitiveByteArrayType;
import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
import org.apache.seatunnel.common.constants.PluginType;
import org.apache.seatunnel.common.exception.CommonError;
import org.apache.seatunnel.common.utils.JsonUtils;
import org.apache.seatunnel.connectors.seatunnel.hive.config.HiveConstants;
import java.util.LinkedHashMap;
public class HiveTypeConvertor {
public static SeaTunnelDataType<?> covertHiveTypeToSeaTunnelType(String name, String hiveType) {
if (hiveType.contains("varchar")) {
return BasicType.STRING_TYPE;
}
if (hiveType.contains("char")) {
throw CommonError.convertToSeaTunnelTypeError(
HiveConstants.CONNECTOR_NAME, PluginType.SOURCE, hiveType, name);
}
if (hiveType.contains("binary")) {
return PrimitiveByteArrayType.INSTANCE;
}
if (hiveType.contains("struct")) {
LinkedHashMap<String, Object> fields = new LinkedHashMap<>();
int start = hiveType.indexOf("<");
int end = hiveType.lastIndexOf(">");
String[] columns = hiveType.substring(start + 1, end).split(",");
for (String column : columns) {
String[] splits = column.split(":");
fields.put(
splits[0], covertHiveTypeToSeaTunnelType(splits[0], splits[1]).toString());
}
return SeaTunnelDataTypeConvertorUtil.deserializeSeaTunnelDataType(
name, JsonUtils.toJsonString(fields));
}View on GitHub (pinned to cf67b549a7)
Solutions
- Alter the Hive table column from char(n) to string (or varchar) and re-sync metadata
- Change the SeaTunnel table schema/config so the field is read as string via a supported type
- Cast the char column in the Hive view/query feeding SeaTunnel
- Upgrade SeaTunnel to a version that maps char types if available
Example fix
// before CREATE TABLE t (c CHAR(10)); // after ALTER TABLE t CHANGE COLUMN c c STRING;
Defensive patterns
Strategy: validation
Validate before calling
// Check Hive schema for CHAR columns before running the job SHOW CREATE TABLE my_table; -- reject any column of type CHAR(n)
Type guard
boolean hasCharColumn(java.util.List<String> hiveTypes) {
return hiveTypes.stream().anyMatch(t -> t.trim().toLowerCase().startsWith("char("));
} Prevention
- Avoid CHAR(n) in Hive DDL; prefer STRING or VARCHAR
- Pre-scan table DDL with SHOW CREATE TABLE / DESCRIBE before ingestion
- Use views casting char columns to string when schema changes are not possible
- Check partition schemas too, not only the table's
When it happens
Trigger: Reading a Hive table whose schema contains a column of Hive type char(n) (or any type string containing 'char') during source split/schema conversion.
Common situations: Hive tables created with CHAR columns (common in legacy warehouses); partitions or tables where DDL uses char instead of string/varchar.
Related errors
- ROW type requires non-empty field names and types with equal
- TABLE_SCHEMA_GET_FAILED
- ROW type requires non-empty field names and types
- ARRAY type requires element type
- MAP type requires key and value types
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/4523c214d4d19370.
Report an issue: GitHub.