apache/seatunnel · error · ParserException

Unsupported SQL syntax: %s

Error message

Unsupported SQL syntax: %s

What it means

During SqlConfigBuilder.of(List<String>) each statement must be a CreateTable or Insert; anything else (top-level SELECT, ALTER, DROP, SET, etc.) throws ParserException 'Unsupported SQL syntax'. The seatunnel SQL config dialect only supports CREATE TABLE ... WITH (...) and INSERT INTO ... SELECT.

Source

Thrown at seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java:134

                    if (createTable.getTableOptionsStrings() == null) {
                        continue;
                    }
                    parseCreateTableSql(createTable, sqlTables, seaTunnelConfig);
                    it.remove();
                }
            }

            AtomicInteger tempTableIndex = new AtomicInteger(1);
            for (String sql : sqlList) {
                Statement statement = CCJSqlParserUtil.parse(sql);
                if (statement instanceof CreateTable) {
                    CreateTable createTable = (CreateTable) statement;
                    TransformConfig transformConfig = parseCreateAsSql(createTable, sqlTables);
                    seaTunnelConfig.getTransformConfigs().add(transformConfig);
                } else if (statement instanceof Insert) {
                    parseInsertSql((Insert) statement, sqlTables, seaTunnelConfig, tempTableIndex);
                } else {
                    throw new ParserException(
                            String.format("Unsupported SQL syntax: %s", statement));
                }
            }

            // filter out the sink config without 'plugin_input' option
            seaTunnelConfig.setSinkConfigs(
                    seaTunnelConfig.getSinkConfigs().stream()
                            .filter(
                                    sinkConfig -> {
                                        boolean containSourceTable = false;
                                        for (Option option : sinkConfig.getOptions()) {
                                            if (option.getKey().equals(OPTION_PLUGIN_INPUT_KEY)) {
                                                containSourceTable = true;
                                                break;
                                            }
                                        }
                                        return containSourceTable;
                                    })

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Remove or comment out all non-CREATE-TABLE/non-INSERT statements from the config file.
  2. Replace unsupported constructs (views, CTEs) with explicit CREATE TABLE + INSERT INTO ... SELECT.
  3. Check the offending statement printed in the message and rewrite it in the supported dialect.
  4. Configure job-level options via the env block instead of SET-style variables.

Example fix

// before
SET exec.parallelism = 4;
CREATE TABLE s WITH ('connector'='fake', 'type'='sink') (id INT);
// after
CREATE TABLE s WITH ('connector'='fake', 'type'='sink') (id INT);
-- parallelism goes in the env block, not SQL statements
Defensive patterns

Strategy: validation

Validate before calling

for (String stmt : statements) {
    String kw = stmt.trim().split("\\s+")[0].toUpperCase();
    if (!List.of("CREATE", "INSERT").contains(kw)) throw new IllegalArgumentException("Unsupported: " + kw);
}

Try / catch

try { Config c = SqlConfigBuilder.of(path); } catch (ParserException e) { /* message names the offending statement */ }

Prevention

When it happens

Trigger: Including statements in the job .sql file that are neither CREATE TABLE nor INSERT, e.g. a bare SELECT, CREATE VIEW, DROP TABLE, or SET clause.

Common situations: Copy-pasting standard SQL scripts containing DDL like DROP/ALTER, prepending SET statements as one would in a SQL client, or using SQL features (CTEs, views) not supported by the dialect.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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