apache/seatunnel · error · UnsupportedOperationException

Unsupported operation

Error message

Unsupported operation

What it means

ClickhouseTypeConverter.convert is the forward conversion from a ClickHouse type definition to a SeaTunnel Column. For this converter only the reverse direction (reconvert) is implemented; calling convert throws UnsupportedOperationException('Unsupported operation'). It indicates the converter is only usable in the reverse (Column -> ClickHouse type) direction.

Source

Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/catalog/ClickhouseTypeConverter.java:50

import com.google.auto.service.AutoService;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@AutoService(TypeConverter.class)
public class ClickhouseTypeConverter
        implements BasicTypeConverter<BasicTypeDefine<ClickhouseType>> {
    public static final ClickhouseTypeConverter INSTANCE = new ClickhouseTypeConverter();
    public static final Integer MAX_DATETIME_SCALE = 9;
    public static final String IDENTIFIER = "Clickhouse";

    @Override
    public String identifier() {
        return IDENTIFIER;
    }

    @Override
    public Column convert(BasicTypeDefine<ClickhouseType> typeDefine) {
        throw new UnsupportedOperationException("Unsupported operation");
    }

    @Override
    public BasicTypeDefine<ClickhouseType> reconvert(Column column) {
        BasicTypeDefine.BasicTypeDefineBuilder builder =
                BasicTypeDefine.builder()
                        .name(column.getName())
                        .nullable(column.isNullable())
                        .comment(column.getComment())
                        .defaultValue(column.getDefaultValue());

        switch (column.getDataType().getSqlType()) {
            case BOOLEAN:
                builder.columnType(ClickhouseType.BOOLEAN);
                builder.dataType(ClickhouseType.BOOLEAN);
                break;
            case TINYINT:
                builder.columnType(ClickhouseType.TINYINT);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Do not use ClickhouseTypeConverter to convert ClickHouse types to SeaTunnel Columns; use reconvert(Column) for the supported direction.
  2. If you need ClickHouse -> SeaTunnel type mapping, use the ClickhouseTypeMapper / catalog schema conversion path instead of this converter.
  3. Implement convert() in the connector if bidirectional conversion is required for your use case.
  4. Guard calls by checking whether conversion direction is supported before invoking.

Example fix

// before
Column column = ClickhouseTypeConverter.INSTANCE.convert(typeDefine); // throws
// after
BasicTypeDefine<ClickhouseType> chType = ClickhouseTypeConverter.INSTANCE.reconvert(column); // supported direction
Defensive patterns

Strategy: type-guard

Type guard

boolean supportsForwardConversion(TypeConverter<?, ?> c) { return !(c instanceof ClickhouseTypeConverter); }

Try / catch

try { column = converter.convert(typeDefine); } catch (UnsupportedOperationException e) { throw new IllegalStateException("Forward conversion not supported by " + converter.identifier() + "; use reconvert()", e); }

Prevention

When it happens

Trigger: Any call to ClickhouseTypeConverter.INSTANCE.convert(BasicTypeDefine<ClickhouseType>) — e.g. code treating this converter as a bidirectional converter and trying to map an existing ClickHouse schema into SeaTunnel columns.

Common situations: Generic converter framework code that always calls convert(); developers expecting schema-migration read support from ClickHouse types; test code exercising both directions of the converter.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/44fb7de213fbea4b. Report an issue: GitHub.