apache/seatunnel · error · SeaTunnelRuntimeException

COMMON-19

COMMON-19

Error message

'${identifier}' unsupported convert SeaTunnel data type '${dataType}' of '${field}' to connector data type.

What it means

SqlServerTypeConverter.reconvert() maps a SeaTunnel column type back to a SQL Server column type when writing. SeaTunnel SqlTypes with no case in the switch (e.g. MAP, ARRAY, other unmapped types) hit default and throw CommonError.convertToConnectorTypeError. The sink cannot map that field to a SQL Server column type.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerTypeConverter.java:508

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

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Flatten/cast complex fields to scalars (STRING/NVARCHAR) with a transform before the sink.
  2. Pre-create the SQL Server table with a compatible schema instead of auto-creation.
  3. Remove the unsupported column from the sink schema.
  4. Add a reconvert case for the SqlType if extending the connector.

Example fix

// before: MAP col sent to SQL Server sink
// after: serialize to string in transform
query = "SELECT id, attrs_string FROM (SELECT id, CAST(attrs AS STRING) AS attrs_string FROM src)"
Defensive patterns

Strategy: validation

Validate before calling

// Reject complex types before SQL Server sink
for (Column c : catalogTable.getTableSchema().getColumns()) {
    SqlType st = c.getDataType().getSqlType();
    if (st == SqlType.MAP || st == SqlType.ARRAY || st == SqlType.ROW) {
        throw new IllegalStateException("Column " + c.getName()
            + " (" + st + ") must be cast to a scalar before SQL Server sink");
    }
}

Try / catch

try {
    sinkWriter.write(records);
} catch (SeaTunnelRuntimeException e) {
    if (e.getMessage().contains("unsupported convert SeaTunnel data type")) {
        // insert a transform serializing the offending column to STRING, rerun
    } else { throw e; }
}

Prevention

When it happens

Trigger: Writing a SeaTunnel schema with an unmapped SqlType (nested/complex types) to SQL Server, especially with auto table creation (schema_save-mode create) enabled.

Common situations: Sources producing nested data (JSON-ish MAP/ARRAY columns) piped into SQL Server sink; upstream schema change introduces a type the SQL Server mapping lacks.

Related errors


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