{"record":{"id":"e67c5c8a649ae824","repo":"apache/seatunnel","slug":"s-does-not-support-replacing-comments","errorCode":null,"errorMessage":"%s does not support replacing comments","messagePattern":"(.+?) does not support replacing comments","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Column.java","lineNumber":239,"sourceCode":"    /** Returns a copy of the column with a replaced {@link SeaTunnelDataType}. */\n    public abstract Column copy(SeaTunnelDataType<?> newType);\n\n    /** Returns a copy of the column. */\n    public abstract Column copy();\n\n    /** Returns a copy of the column with a replaced name. */\n    public abstract Column rename(String newColumnName);\n\n    /** Returns a copy of the column with a replaced sourceType. */\n    public abstract Column reSourceType(String sourceType);\n\n    /**\n     * Returns a copy of the column with a replaced comment.\n     *\n     * <p>Subclasses should override this method when they support comment mutation.\n     */\n    public Column copyWithComment(String comment) {\n        throw new UnsupportedOperationException(\n                String.format(\"%s does not support replacing comments\", getClass().getName()));\n    }\n}\n","sourceCodeStart":221,"sourceCodeEnd":243,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Column.java#L221-L243","documentation":"Column.copyWithComment is an optional capability: the base Column implementation throws UnsupportedOperationException, and subclasses that do not support comment mutation rely on this default. Callers must only invoke it on column types that override it (e.g. PhysicalColumn).","triggerScenarios":"Calling copyWithComment on a Column subclass that does not override it (e.g. MetadataColumn or other non-mutating column types), typically during schema evolution/table sync that rewrites comments.","commonSituations":"Schema-sync or catalog-sync tools propagating comment changes to all column types; custom Column implementations that never overrode copyWithComment.","solutions":["Only call copyWithComment after checking the column type supports it, or reconstruct the column manually","Override copyWithComment in the custom Column subclass","Use the column's specific builder/of(...) to produce a new instance with the new comment"],"exampleFix":"// before\nColumn c2 = column.copyWithComment(\"new comment\"); // throws for MetadataColumn\n// after\nif (column instanceof PhysicalColumn) {\n    Column c2 = column.copyWithComment(\"new comment\");\n} else {\n    Column c2 = MetadataColumn.of(column.getName(), column.getDataType(), ..., \"new comment\");\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"boolean supportsComment = column instanceof PhysicalColumn;","tryCatchPattern":"try { c2 = column.copyWithComment(c); } catch (UnsupportedOperationException e) { /* rebuild column manually */ }","preventionTips":["Check column subclass before comment mutation","Override copyWithComment in custom columns","Use builders to construct new columns with comments"],"tags":["column","schema","unsupported"],"backgroundTag":"method-not-implemented","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}