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

Thrown by KingbaseTypeConverter.convert() when a KingbaseES (人大金仓) column type cannot be mapped to a SeaTunnel data type. The switch handles common types (BIT handled explicitly with byte-length math); anything reaching the default branch has no mapping. This is a schema-conversion failure raised before data reading begins.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/kingbase/KingbaseTypeConverter.java:212

                    break;
                case KB_BLOB:
                    builder.dataType(PrimitiveByteArrayType.INSTANCE);
                    builder.columnLength((long) (1024 * 1024 * 1024));
                    break;
                case KB_CLOB:
                    builder.dataType(BasicType.STRING_TYPE);
                    builder.columnLength(typeDefine.getLength());
                    builder.columnLength((long) (1024 * 1024 * 1024));
                    break;
                case KB_BIT:
                    builder.dataType(PrimitiveByteArrayType.INSTANCE);
                    // BIT(M) -> BYTE(M/8)
                    long byteLength = typeDefine.getLength() / 8;
                    byteLength += typeDefine.getLength() % 8 > 0 ? 1 : 0;
                    builder.columnLength(byteLength);
                    break;
                default:
                    throw CommonError.convertToSeaTunnelTypeError(
                            DatabaseIdentifier.KINGBASE,
                            typeDefine.getDataType(),
                            typeDefine.getName());
            }
            return builder.build();
        }
    }

    @Override
    public BasicTypeDefine reconvert(Column column) {
        try {
            return super.reconvert(column);
        } catch (SeaTunnelRuntimeException e) {
            throw CommonError.convertToConnectorTypeError(
                    DatabaseIdentifier.KINGBASE,
                    column.getDataType().getSqlType().name(),
                    column.getName());
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the '<dataType>' in the message to identify the unsupported Kingbase column type.
  2. Exclude or cast the column: SELECT supported columns explicitly, or CAST the column to TEXT/NUMERIC in a custom query.
  3. Avoid relying on auto schema parse; define the SeaTunnel schema explicitly if the connector option allows (schema config).
  4. Add a case for the type in KingbaseTypeConverter.convert() and submit upstream if the type should be supported.

Example fix

// before
SELECT * FROM orders;
// after
SELECT id, amount::numeric AS amount FROM orders;
Defensive patterns

Strategy: validation

Validate before calling

// Verify Kingbase columns are convertible before running
for (BasicTypeDefine c : tableSchema.getColumns()) {
    try { new KingbaseTypeConverter().convert(c); }
    catch (SeaTunnelRuntimeException e) {
        throw new IllegalStateException("Unsupported Kingbase type: " + c.getDataType() + " on column " + c.getName());
    }
}

Type guard

boolean isKingbaseTypeSupported(BasicTypeDefine td) {
    try { new KingbaseTypeConverter().convert(td); return true; }
    catch (SeaTunnelRuntimeException e) { return false; }
}

Try / catch

try {
    converter.convert(typeDefine);
} catch (SeaTunnelRuntimeException e) {
    if (e.getMessage().contains("unsupported convert type")) {
        LOG.error("Kingbase column {} type {} unsupported; exclude or cast it", typeDefine.getName(), typeDefine.getDataType());
    }
    throw e;
}

Prevention

When it happens

Trigger: convert(BasicTypeDefine) on KingbaseTypeConverter encountering a Kingbase type outside the supported set at KingbaseTypeConverter.java:212 — e.g. proprietary Kingbase types, user-defined domains, money, custom extensions inherited from Kingbase's PostgreSQL-plus extensions.

Common situations: Auto schema discovery (catalog table-path parse) on a Kingbase database with vendor-specific column types; tables created with Kingbase-specific extensions; BIT(M) variants beyond handled cases.

Related errors


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