{"record":{"id":"3137e748300e5071","repo":"apache/seatunnel","slug":"failed-to-alter-table-modify-column-sql","errorCode":null,"errorMessage":"Failed to alter table modify column, SQL:","messagePattern":"Failed to alter table modify 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":211,"sourceCode":"                        .append(\" \")\n                        .append(quoteIdentifier(event.getColumn().getName()))\n                        .append(\" \")\n                        .append(typeDefine.getColumnType());\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 modifyColumnSQL = sqlBuilder.toString();\n        if (!execute(modifyColumnSQL, tablePath.getDatabaseName())) {\n            log.warn(\"Failed to alter table modify column, SQL:\" + modifyColumnSQL);\n        }\n    }\n\n    public void applySchemaChange(TablePath tablePath, AlterTableAddColumnEvent 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(\"ADD COLUMN\")\n                        .append(\" \")\n                        .append(quoteIdentifier(event.getColumn().getName()))\n                        .append(\" \")\n                        .append(typeDefine.getColumnType());\n        if (event.getColumn().getDefaultValue() != null","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/schema/SchemaChangeManager.java#L193-L229","documentation":"This WARN is logged when the ALTER TABLE ... MODIFY COLUMN SQL (changing a column's type/comment/position) fails to execute against Doris — execute() returned false. Like the CHANGE COLUMN case, the failure is only warned: the pipeline continues, but the Doris schema diverges from the source, usually causing subsequent data writes to fail or be silently coerced.","triggerScenarios":"execute(modifyColumnSQL, database) returns false when applySchemaChange processes an AlterTableModifyColumnEvent — Doris rejects the DDL due to an unsupported target type from DorisTypeConverterV2.reconvert, incompatible type narrowing, nonexistent column, FE connectivity issues, or missing ALTER privilege.","commonSituations":"Upstream widened/changed a column type that Doris's converter maps to something Doris rejects in this context; user lacks ALTER rights; FE HTTP endpoint down or returning error; another schema-change job is running on the table so the new ALTER conflicts; Doris version doesn't support the requested type modification.","solutions":["Copy the SQL printed after 'Failed to alter table modify column, SQL:' and execute it manually on Doris to reveal the actual FE error.","Check Doris FE logs for the DDL failure reason (type conflict, ongoing schema change, privilege).","Grant ALTER privilege to the sink user and retry the pipeline.","Align the table manually with ALTER TABLE ... MODIFY COLUMN ..., then restart from the latest checkpoint.","If Doris cannot support the source type change, adjust the upstream schema or fix the column type mapping (DorisTypeConverterV2) and rebuild."],"exampleFix":"// before: failure only warned, pipeline continues with stale schema\nString modifyColumnSQL = sqlBuilder.toString();\nif (!execute(modifyColumnSQL, tablePath.getDatabaseName())) {\n    log.warn(\"Failed to alter table modify column, SQL:\" + modifyColumnSQL);\n}\n// after: propagate the failure so the job retries/alerts\nif (!execute(modifyColumnSQL, tablePath.getDatabaseName())) {\n    throw new IOException(\"Failed to alter table modify column, SQL: \" + modifyColumnSQL);\n}","handlingStrategy":"try-catch","validationCode":"// Validate target type compatibility before the event is applied\nDESC db.tbl;  -- check current type; confirm Doris supports the new type\nSHOW GRANTS FOR 'seatunnel_user';  -- require ALTER_PRIV\ncurl http://<fe-host>:<http-port>/api/bootstrap  -- FE reachable","typeGuard":null,"tryCatchPattern":"try {\n    schemaManager.applySchemaChange(tablePath, modifyColumnEvent);\n} catch (Exception e) {\n    LOG.error(\"Doris MODIFY COLUMN failed for \" + tablePath + \", SQL: \" + modifyColumnSQL, e);\n    throw e;\n}","preventionTips":["Manually execute the logged ALTER ... MODIFY COLUMN SQL to surface the underlying FE error.","Avoid narrowing type changes upstream that Doris cannot MODIFY (e.g. int -> tinyint).","Ensure ALTER privileges for the sink account.","Do not run multiple schema-change operations on the same table simultaneously (Doris rejects conflicting schema changes).","Pin test coverage for DorisTypeConverterV2 mappings used by your source types."],"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"}