apache/seatunnel · warning

Failed to alter table add column, SQL:

Error message

Failed to alter table add column, SQL:

What it means

This is a WARN log emitted by Doris's SchemaChangeManager when an ALTER TABLE ... ADD COLUMN DDL statement fails to execute against the Doris FE HTTP/RPC endpoint. The execute() call returns false (non-success response), and the failure is only logged, not thrown, so the schema change is silently skipped. It indicates the target Doris table schema and the incoming schema-change event are out of sync.

Source

Thrown at seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/schema/SchemaChangeManager.java:249

            sqlBuilder
                    .append(" DEFAULT ")
                    .append(quoteDefaultValue(event.getColumn().getDefaultValue()));
        }
        if (event.getColumn().getComment() != null) {
            sqlBuilder
                    .append(" ")
                    .append("COMMENT ")
                    .append("'")
                    .append(event.getColumn().getComment())
                    .append("'");
        }
        if (event.getAfterColumn() != null) {
            sqlBuilder.append(" ").append("AFTER ").append(quoteIdentifier(event.getAfterColumn()));
        }

        String addColumnSQL = sqlBuilder.toString();
        if (!execute(addColumnSQL, tablePath.getDatabaseName())) {
            log.warn("Failed to alter table add column, SQL:" + addColumnSQL);
        }
    }

    /**
     * Support Default Value
     *
     * @param column
     * @return
     */
    // todo support more type
    private boolean isSupportDefaultValue(Column column) {
        switch (column.getDataType().getSqlType()) {
            case STRING:
            case BIGINT:
            case INT:
            case TIMESTAMP:
                return true;
            default:

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the SQL in the log and run it manually against Doris via MySQL client / FE UI to see the real error message
  2. Check the column does not already exist in the Doris table (duplicates cause DDL rejection)
  3. Verify Doris FE is reachable and credentials in DorisSinkConfig are correct
  4. Check Doris supports the source column type; adjust type mapping
  5. Enable better logging / monitor the HTTP response in execute() to get the actual status code

Example fix

// before
if (!execute(addColumnSQL, tablePath.getDatabaseName())) {
    log.warn("Failed to alter table add column, SQL:" + addColumnSQL);
}
// after
if (!execute(addColumnSQL, tablePath.getDatabaseName())) {
    throw new IOException("Failed to alter table add column, SQL:" + addColumnSQL);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = schemaChangeManager.columnExists(addColumnEvent);
if (exists) { return; }

Try / catch

if (!schemaChangeManager.execute(addColumnSQL, dbName)) {
    throw new IOException("Doris rejected DDL: " + addColumnSQL);
}

Prevention

When it happens

Trigger: applySchemaChange processes an AddColumnEvent and builds ADD COLUMN SQL (possibly with AFTER clause); execute(ddl, database) returns false — e.g. Doris rejects the DDL (column already exists, invalid type, table in restoring state, FE unreachable, auth failure).

Common situations: CDC pipelines (MySQL -> Doris) where the column was already added manually on Doris; unsupported column types mapped from source; Doris FE returning HTTP error or non-success code; double-quoted identifiers/charset issues; concurrent schema changes conflicting.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


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