apache/seatunnel · error · UnsupportedOperationException

Can't create JdbcDialect without compatible mode for Dsql

Error message

Can't create JdbcDialect without compatible mode for Dsql

What it means

DsqlDialectFactory.create() unconditionally throws UnsupportedOperationException because the Dsql dialect cannot be instantiated without a compatible mode. Callers must use the two-argument create(compatibleMode, fieldIde) overload instead.

Solutions

  1. Configure a compatible mode so the factory's create(compatibleMode, fieldIde) path is used.
  2. If you do not need Dsql, use a standard PostgreSQL JDBC URL so the regular Postgres dialect factory is selected.
  3. Update connector/plugin code to never call the no-arg create() for Dsql URLs.

Example fix

// before
JdbcDialect dialect = factory.create();
// after
JdbcDialect dialect = factory.create(compatibleMode, fieldIde);
Defensive patterns

Strategy: type-guard

Validate before calling

if (factory instanceof DsqlDialectFactory && compatibleMode == null) { throw new IllegalStateException("Dsql requires compatible_mode"); }

Type guard

JdbcDialect safeCreate(JdbcDialectFactory f, String mode, String fieldIde) { return f instanceof DsqlDialectFactory ? f.create(mode, fieldIde) : f.create(); }

Try / catch

try { dialect = factory.create(); } catch (UnsupportedOperationException e) { dialect = factory.create(compatibleMode, fieldIde); }

Prevention

When it happens

Trigger: Code path resolves a JdbcDialectFactory by URL (jdbc:postgresql:... containing a Dsql marker) and invokes the no-arg create() factory method.

Common situations: Misconfigured pipeline that selects the Dsql dialect but does not propagate a compatible mode; older plugin code or config that omits the compatible_mode setting for Dsql URLs.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/dsql/DsqlDialectFactory.java:47

@AutoService(JdbcDialectFactory.class)
public class DsqlDialectFactory implements JdbcDialectFactory {

    private static final Pattern DSQL_PATTERN = Pattern.compile(".*dsql\\.[a-z0-9-]+\\.on\\.aws.*");

    @Override
    public String dialectFactoryName() {
        return DatabaseIdentifier.DSQL;
    }

    @Override
    public boolean acceptsURL(String url) {
        return url.startsWith("jdbc:postgresql:") && containsDsql(url);
    }

    @Override
    public JdbcDialect create() {
        throw new UnsupportedOperationException(
                "Can't create JdbcDialect without compatible mode for Dsql");
    }

    @Override
    public JdbcDialect create(@Nonnull String compatibleMode, String fieldIde) {

        return new DsqlDialect(fieldIde);
    }

    private boolean containsDsql(String url) {
        return DSQL_PATTERN.matcher(url).matches();
    }
}

View on GitHub (pinned to cf67b549a7)