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

COMMON-19

COMMON-19

Error message

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

What it means

Thrown by MySqlTypeConverter.reconvert() when a SeaTunnel data type cannot be mapped back to a MySQL column type for sink writes or table creation. The switch maps most types (TIMESTAMP variants, TIME with scale, etc.); the default branch covers unsupported SeaTunnel SqlTypes. It fails during sink schema preparation.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/mysql/MySqlTypeConverter.java:570

                    if (timestampTzScale > MAX_TIMESTAMP_SCALE) {
                        timestampTzScale = MAX_TIMESTAMP_SCALE;
                        log.warn(
                                "The timestamp_tz column {} type timestamp({}) is out of range, "
                                        + "which exceeds the maximum scale of {}, "
                                        + "it will be converted to timestamp({})",
                                column.getName(),
                                column.getScale(),
                                MAX_TIMESTAMP_SCALE,
                                timestampTzScale);
                    }
                    builder.columnType(String.format("%s(%s)", MYSQL_TIMESTAMP, timestampTzScale));
                    builder.scale(timestampTzScale);
                } else {
                    builder.columnType(MYSQL_TIMESTAMP);
                }
                break;
            default:
                throw CommonError.convertToConnectorTypeError(
                        DatabaseIdentifier.MYSQL,
                        column.getDataType().getSqlType().name(),
                        column.getName());
        }

        return builder.build();
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check '<dataType>' in the message to identify the SeaTunnel type MySQL sink can't handle.
  2. Pre-create the MySQL table and disable auto-create so unsupported types never reach reconvert for DDL.
  3. Insert a cast Transform to convert unsupported columns (e.g. array -> JSON string) before the sink.
  4. Upgrade SeaTunnel for broader MySQL type support (e.g. vector types).
  5. Add a default-branch mapping case in MySqlTypeConverter.reconvert() if a sensible MySQL equivalent exists.

Example fix

// before
VECTOR column -> MySQL sink auto-create: error
// after
transform: Sql { sql = "SELECT id, json_query(vec) AS vec FROM source" }
Defensive patterns

Strategy: validation

Validate before calling

// Validate sink schema types against MySQL reconvert before writing
for (Column col : sinkSchema.getColumns()) {
    try { new MySqlTypeConverter().reconvert(col); }
    catch (SeaTunnelRuntimeException e) {
        throw new IllegalStateException("MySQL sink cannot map column " + col.getName() + " of " + col.getDataType());
    }
}

Type guard

boolean isMySqlSinkColumnValid(Column col) {
    try { new MySqlTypeConverter().reconvert(col); return true; }
    catch (SeaTunnelRuntimeException e) { return false; }
}

Try / catch

try {
    converter.reconvert(column);
} catch (SeaTunnelRuntimeException e) {
    if (e.getMessage().contains("unsupported convert SeaTunnel data type")) {
        throw new IllegalArgumentException("Column " + column.getName() + " type " + column.getDataType() + " needs a Transform cast before MySQL sink");
    }
    throw e;
}

Prevention

When it happens

Trigger: reconvert(Column) on MySqlTypeConverter where column.getDataType().getSqlType() falls to the default branch at MySqlTypeConverter.java:570 — e.g. VECTOR/MAP/ARRAY types on connector versions lacking vector support, or types not handled by this MySQL dialect version. Called from type-conversion paths and converter unit tests.

Common situations: Auto-creating a MySQL sink table from a source with complex/nested types; forwarding SeaTunnel VECTOR columns to a MySQL version/sink config without vector support; schema mismatch between source dialects (e.g. Oracle source -> MySQL sink with unhandled types).

Related errors


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