apache/seatunnel · warning · UnsupportedOperationException
%s does not support replacing comments
Error message
%s does not support replacing comments
What it means
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).
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Column.java:239
/** Returns a copy of the column with a replaced {@link SeaTunnelDataType}. */
public abstract Column copy(SeaTunnelDataType<?> newType);
/** Returns a copy of the column. */
public abstract Column copy();
/** Returns a copy of the column with a replaced name. */
public abstract Column rename(String newColumnName);
/** Returns a copy of the column with a replaced sourceType. */
public abstract Column reSourceType(String sourceType);
/**
* Returns a copy of the column with a replaced comment.
*
* <p>Subclasses should override this method when they support comment mutation.
*/
public Column copyWithComment(String comment) {
throw new UnsupportedOperationException(
String.format("%s does not support replacing comments", getClass().getName()));
}
}
View on GitHub (pinned to cf67b549a7)
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
Example fix
// before
Column c2 = column.copyWithComment("new comment"); // throws for MetadataColumn
// after
if (column instanceof PhysicalColumn) {
Column c2 = column.copyWithComment("new comment");
} else {
Column c2 = MetadataColumn.of(column.getName(), column.getDataType(), ..., "new comment");
} Defensive patterns
Strategy: type-guard
Type guard
boolean supportsComment = column instanceof PhysicalColumn;
Try / catch
try { c2 = column.copyWithComment(c); } catch (UnsupportedOperationException e) { /* rebuild column manually */ } Prevention
- Check column subclass before comment mutation
- Override copyWithComment in custom columns
- Use builders to construct new columns with comments
When it happens
Trigger: 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.
Common situations: Schema-sync or catalog-sync tools propagating comment changes to all column types; custom Column implementations that never overrode copyWithComment.
Related errors
- Operator %s requires an expectValue, but expectValue is null
- Not implemented
- Operator %s requires a compareOption (cross-field comparison
- Schema config can not be empty
- Schema config need option [schema], please correct your conf
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e67c5c8a649ae824.
Report an issue: GitHub.