{"record":{"id":"d4c96c8ae66fe49b","repo":"apache/seatunnel","slug":"failed-to-alter-table-add-column-sql","errorCode":null,"errorMessage":"Failed to alter table add column, SQL:","messagePattern":"Failed to alter table add column, SQL:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/schema/SchemaChangeManager.java","lineNumber":249,"sourceCode":"            sqlBuilder\n                    .append(\" DEFAULT \")\n                    .append(quoteDefaultValue(event.getColumn().getDefaultValue()));\n        }\n        if (event.getColumn().getComment() != null) {\n            sqlBuilder\n                    .append(\" \")\n                    .append(\"COMMENT \")\n                    .append(\"'\")\n                    .append(event.getColumn().getComment())\n                    .append(\"'\");\n        }\n        if (event.getAfterColumn() != null) {\n            sqlBuilder.append(\" \").append(\"AFTER \").append(quoteIdentifier(event.getAfterColumn()));\n        }\n\n        String addColumnSQL = sqlBuilder.toString();\n        if (!execute(addColumnSQL, tablePath.getDatabaseName())) {\n            log.warn(\"Failed to alter table add column, SQL:\" + addColumnSQL);\n        }\n    }\n\n    /**\n     * Support Default Value\n     *\n     * @param column\n     * @return\n     */\n    // todo support more type\n    private boolean isSupportDefaultValue(Column column) {\n        switch (column.getDataType().getSqlType()) {\n            case STRING:\n            case BIGINT:\n            case INT:\n            case TIMESTAMP:\n                return true;\n            default:","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/schema/SchemaChangeManager.java#L231-L267","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the SQL in the log and run it manually against Doris via MySQL client / FE UI to see the real error message","Check the column does not already exist in the Doris table (duplicates cause DDL rejection)","Verify Doris FE is reachable and credentials in DorisSinkConfig are correct","Check Doris supports the source column type; adjust type mapping","Enable better logging / monitor the HTTP response in execute() to get the actual status code"],"exampleFix":"// before\nif (!execute(addColumnSQL, tablePath.getDatabaseName())) {\n    log.warn(\"Failed to alter table add column, SQL:\" + addColumnSQL);\n}\n// after\nif (!execute(addColumnSQL, tablePath.getDatabaseName())) {\n    throw new IOException(\"Failed to alter table add column, SQL:\" + addColumnSQL);\n}","handlingStrategy":"validation","validationCode":"boolean exists = schemaChangeManager.columnExists(addColumnEvent);\nif (exists) { return; }","typeGuard":null,"tryCatchPattern":"if (!schemaChangeManager.execute(addColumnSQL, dbName)) {\n    throw new IOException(\"Doris rejected DDL: \" + addColumnSQL);\n}","preventionTips":["Run the generated DDL manually first to see real errors","Keep source and Doris schemas in sync","Map types to Doris-supported types before writing"],"tags":["doris","ddl","schema-change","sql","jdbc"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}