apache/seatunnel · error · org.apache.seatunnel.common.exception.SeaTunnelRuntimeException

COMMON-17

COMMON-17

Error message

'<identifier>' unsupported convert type '<dataType>' of '<field>' to SeaTunnel data type.

What it means

This error is thrown by HiveTypeMapper.mapping() when converting a Hive column type to a SeaTunnel data type during source schema resolution. Complex Hive types — INTERVAL, MAP, STRUCT, UNIONTYPE — are explicitly not supported yet, together with any unrecognized type, and all fall to the default branch which throws CommonError.convertToSeaTunnelTypeError with the HIVE identifier, the Hive column type string, and the JDBC column name.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/hive/HiveTypeMapper.java:113

            case HIVE_TIMESTAMP:
                return LocalTimeType.LOCAL_DATE_TIME_TYPE;
            case HIVE_DATE:
                return LocalTimeType.LOCAL_DATE_TYPE;
            case HIVE_STRING:
            case HIVE_VARCHAR:
            case HIVE_CHAR:
                return BasicType.STRING_TYPE;
            case HIVE_BOOLEAN:
                return BasicType.BOOLEAN_TYPE;
            case HIVE_BINARY:
            case HIVE_ARRAY:
            case HIVE_INTERVAL:
            case HIVE_MAP:
            case HIVE_STRUCT:
            case HIVE_UNIONTYPE:
            default:
                final String jdbcColumnName = metadata.getColumnName(colIndex);
                throw CommonError.convertToSeaTunnelTypeError(
                        DatabaseIdentifier.HIVE, columnType, jdbcColumnName);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Select only scalar columns, or flatten/explode complex ones in the source query (e.g. SELECT m['key'] AS m_key, s.field1 FROM ...).
  2. Serialize complex columns to strings in the query (e.g. CAST(struct_or_map AS STRING)) and parse downstream with a SeaTunnel transform if needed.
  3. Use a Hive-native source (Hive connector) instead of the generic JDBC path if one supports complex types, or process the table via a format that handles nested data.
  4. Upgrade SeaTunnel to check whether newer HiveTypeMapper versions added support for the type.
  5. Contribute a mapping in HiveTypeMapper.mapping() if the type can be represented in SeaTunnel types.

Example fix

// before: Hive table has MAP/STRUCT columns -> error
source {
  Jdbc {
    url = "jdbc:hive2://host:10000/db"
    query = "SELECT * FROM db.table"
  }
}
// after: flatten/serialize complex columns
source {
  Jdbc {
    url = "jdbc:hive2://host:10000/db"
    query = "SELECT id, CAST(nested_map AS STRING) AS nested_map, s.name AS s_name FROM db.table"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

-- Pre-flight: reject Hive tables containing complex columns before configuring the JDBC source
SELECT column_name, data_type FROM information_schema.columns
WHERE table_name = 'my_table'
  AND LOWER(data_type) IN ('map','struct','array','uniontype','interval');
-- Any row returned means the sync will fail with COMMON-17; flatten or cast first.

Type guard

// Java: guard Hive column type strings before schema conversion
static boolean isSupportedHiveType(String hiveType) {
    String t = hiveType == null ? "" : hiveType.toLowerCase();
    return !t.startsWith("map") && !t.startsWith("struct")
        && !t.startsWith("array") && !t.startsWith("uniontype") && !t.startsWith("interval");
}

Try / catch

try {
    CatalogTable ct = source.getCatalogTable();
} catch (SeaTunnelRuntimeException e) {
    if (e.getMessage().contains("COMMON-17") && e.getMessage().contains("Hive")) {
        throw new IllegalArgumentException(
            "Hive MAP/STRUCT/ARRAY/UNIONTYPE/INTERVAL columns are unsupported; flatten or CAST AS STRING in the query", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Reading a Hive table via the JDBC source where the schema contains MAP, STRUCT, ARRAY, UNIONTYPE, or INTERVAL columns (or any type the mapper fails to recognize). Triggered during catalog/schema resolution before rows are read.

Common situations: Syncing Hive tables that use native complex columns (common in data-lake schemas storing nested JSON as STRUCT/MAP). Also appears when a partition or view exposes a computed column of an unsupported type, or when a newer Hive type is read by an older connector dialect.

Related errors


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