{"record":{"id":"60bcd2924a0b0f11","repo":"apache/seatunnel","slug":"failed-to-alter-table-change-column-sql","errorCode":null,"errorMessage":"Failed to alter table change column, SQL:","messagePattern":"Failed to alter table change 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":179,"sourceCode":"                        .append(\" \")\n                        .append(quoteIdentifier(event.getOldColumn()))\n                        .append(\" \")\n                        .append(quoteIdentifier(event.getColumn().getName()));\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 changeColumnSQL = sqlBuilder.toString();\n        if (!execute(changeColumnSQL, tablePath.getDatabaseName())) {\n            log.warn(\"Failed to alter table change column, SQL:\" + changeColumnSQL);\n        }\n    }\n\n    public void applySchemaChange(TablePath tablePath, AlterTableModifyColumnEvent event)\n            throws IOException {\n        BasicTypeDefine typeDefine = DorisTypeConverterV2.INSTANCE.reconvert(event.getColumn());\n        StringBuilder sqlBuilder =\n                new StringBuilder()\n                        .append(\"ALTER TABLE\")\n                        .append(\" \")\n                        .append(tablePath.getFullName())\n                        .append(\" \")\n                        .append(\"MODIFY COLUMN\")\n                        .append(\" \")\n                        .append(quoteIdentifier(event.getColumn().getName()))\n                        .append(\" \")\n                        .append(typeDefine.getColumnType());\n        if (event.getColumn().getComment() != null) {","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/schema/SchemaChangeManager.java#L161-L197","documentation":"This WARN is logged when the ALTER TABLE ... CHANGE COLUMN (rename/redefine column) SQL generated for a Doris table fails to execute — SchemaChangeManager.execute() returned false. The event is silently swallowed at WARN level, so the SeaTunnel job keeps running but the Doris table schema no longer matches the upstream source, which typically surfaces later as write errors (unknown column).","triggerScenarios":"execute(changeColumnSQL, database) returns false — the DDL was rejected by Doris FE: invalid target type per DorisTypeConverterV2.reconvert, type change not supported by Doris (e.g. shrinking a type), the old column doesn't exist, AFTER column doesn't exist, connection/HTTP failure to the FE, or insufficient user privileges on the database.","commonSituations":"Upstream changed a column type in a way Doris cannot convert (varchar->int, unsupported type mapping); Doris user lacks ALTER privilege; FE is unreachable or returns a non-success HTTP code; concurrent schema operations make the DDL conflict (table under another alter/schema change job); light_schema_change settings interplay.","solutions":["Inspect the full SQL in the log message and run it manually against Doris to see the real FE error (the WARN itself omits the root cause).","Check Doris FE logs (fe.log / fe.audit.log) for the rejected ALTER and its reason (type not supported, conflict, privilege).","Verify the sink user has ALTER privileges on the database: GRANT ALTER ON db.* TO user.","Apply the column change manually (ALTER TABLE ... CHANGE COLUMN ...) to align Doris with the source, then restart the pipeline from the latest checkpoint.","If the type conversion is unsupported, adjust the upstream type or pin the Doris column type so DorisTypeConverterV2 produces a valid mapping."],"exampleFix":"// before: failure swallowed, root cause hidden\nString changeColumnSQL = sqlBuilder.toString();\nif (!execute(changeColumnSQL, tablePath.getDatabaseName())) {\n    log.warn(\"Failed to alter table change column, SQL:\" + changeColumnSQL);\n}\n// after: surface the root cause and fail fast\nif (!execute(changeColumnSQL, tablePath.getDatabaseName())) {\n    throw new IOException(\"Failed to alter table change column, SQL: \" + changeColumnSQL);\n}","handlingStrategy":"try-catch","validationCode":"// Before enabling schema evolution, verify privileges and FE reachability\nSHOW GRANTS FOR 'seatunnel_user';  -- must include ALTER_PRIV on the target db\n-- and test the FE HTTP endpoint used by execute():\ncurl http://<fe-host>:<http-port>/api/bootstrap","typeGuard":null,"tryCatchPattern":"// Fail fast on failed DDL instead of silently diverging schemas\ntry {\n    schemaManager.applySchemaChange(tablePath, changeColumnEvent);\n} catch (Exception e) {\n    LOG.error(\"Doris schema change failed for table \" + tablePath + \", SQL: \" + changeColumnSQL, e);\n    throw e; // let the pipeline restart/retry from checkpoint\n}","preventionTips":["Run the generated ALTER ... CHANGE COLUMN SQL manually on Doris to catch unsupported type conversions before production.","Check fe.log for the real rejection reason whenever this WARN appears.","Grant ALTER privilege to the sink user.","Avoid concurrent schema-change jobs on the same Doris table.","Keep Doris and connector versions aligned so DorisTypeConverterV2 mappings are supported."],"tags":["doris","ddl","schema-change","swallowed-exception"],"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"}