apache/seatunnel · warning

Source table field count ({}) doesn't match row field count

Error message

Source table field count ({}) doesn't match row field count ({}), using default column names

What it means

In DatabendSinkWriter.inferRowTypeFromRow(), the writer infers column names from the CatalogTable's row type when their field count matches the row's field count. When counts differ, it logs this warning and falls back to generic names column_1..column_N. The write proceeds, but data may land in wrong/unexpected columns since names are synthetic.

Source

Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/sink/DatabendSinkWriter.java:626

        } else if (typeName.contains("BOOLEAN")) {
            return BasicType.BOOLEAN_TYPE;
        } else {
            return BasicType.STRING_TYPE;
        }
    }

    private SeaTunnelRowType inferRowTypeFromRow(SeaTunnelRow row) {
        Object[] fields = row.getFields();
        String[] fieldNames = new String[fields.length];
        SeaTunnelDataType<?>[] fieldTypes = new SeaTunnelDataType<?>[fields.length];

        // use the column names from the catalog table if available
        if (catalogTable != null && catalogTable.getSeaTunnelRowType() != null) {
            String[] sourceFieldNames = catalogTable.getSeaTunnelRowType().getFieldNames();
            if (sourceFieldNames.length == fields.length) {
                fieldNames = sourceFieldNames;
            } else {
                log.warn(
                        "Source table field count ({}) doesn't match row field count ({}), using default column names",
                        sourceFieldNames.length,
                        fields.length);
                for (int i = 0; i < fields.length; i++) {
                    fieldNames[i] = "column_" + (i + 1);
                }
            }
        } else {
            // if catalog table is not available, throw an exception
            log.warn("No source table schema available, can't get column names");
            throw new DatabendConnectorException(
                    DatabendConnectorErrorCode.SCHEMA_NOT_FOUND,
                    "Source table schema is empty or null, cannot infer row type");
        }

        for (int i = 0; i < fields.length; i++) {
            Object field = fields[i];

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Align the pipeline schema: ensure the transform output arity matches the catalog table schema or update the sink's configured columns
  2. Restart the job after source DDL changes so a fresh CatalogTable is captured
  3. Enable schema evolution / schema-change support so the writer rebuilds the row type
  4. Explicitly define the sink's target column list so inference isn't needed

Example fix

// before
log.warn("Source table field count ({}) doesn't match row field count ({}), using default column names", sourceFieldNames.length, fields.length);
// after
log.error("Source table field count ({}) doesn't match row field count ({}); fix upstream transform schema", sourceFieldNames.length, fields.length);
throw new DatabendConnectorException(DatabendConnectorErrorCode.SCHEMA_NOT_FOUND, "Row field count mismatch");
Defensive patterns

Strategy: validation

Validate before calling

// check pipeline arity vs source schema before submitting
if (catalogTable.getSeaTunnelRowType().getFieldNames().length != expectedRowFields.length) {
    throw new IllegalStateException("Row arity mismatch with source table schema");
}

Type guard

boolean arityMatches(CatalogTable ct, SeaTunnelRow row) {
    return ct != null && ct.getSeaTunnelRowType() != null
        && ct.getSeaTunnelRowType().getFieldNames().length == row.getFields().length;
}

Try / catch

// not applicable: warning only; writer falls back to column_N names

Prevention

When it happens

Trigger: The row produced upstream has a different number of fields than the catalog source table's schema (e.g. transform added/dropped columns, CDC rows include extra op/metadata fields, or schema evolution changed the table).

Common situations: Adding a transform that changes arity without updating sink schema; DDL change on the source adding a column while the job runs with the old catalog schema; CDC rows carrying extra internal fields.

Related errors


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