apache/seatunnel · error · IllegalArgumentException

Only SELECT statements with WHERE clause are supported. The

Error message

Only SELECT statements with WHERE clause are supported. The Having, Group By, Order By, Limit clauses are currently unsupported.

What it means

The converter supports only simple SELECT ... WHERE queries: if the PlainSelect contains HAVING, GROUP BY, ORDER BY or LIMIT, it throws IllegalArgumentException stating those clauses are unsupported, since they cannot be translated into Paimon pushed-down predicates.

Source

Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java:104

            statement = CCJSqlParserUtil.parse(query);
        } catch (JSQLParserException e) {
            throw new IllegalArgumentException("Error parsing SQL.", e);
        }
        // Confirm that the SQL statement is a Select statement
        if (!(statement instanceof Select)) {
            throw new IllegalArgumentException("Only SELECT statements are supported.");
        }
        Select select = (Select) statement;
        Select selectBody = select.getSelectBody();
        if (!(selectBody instanceof PlainSelect)) {
            throw new IllegalArgumentException("Only simple SELECT statements are supported.");
        }
        PlainSelect plainSelect = (PlainSelect) selectBody;
        if (plainSelect.getHaving() != null
                || plainSelect.getGroupBy() != null
                || plainSelect.getOrderByElements() != null
                || plainSelect.getLimit() != null) {
            throw new IllegalArgumentException(
                    "Only SELECT statements with WHERE clause are supported. The Having, Group By, Order By, Limit clauses are currently unsupported.");
        }
        return plainSelect;
    }

    public static int[] convertSqlSelectToPaimonProjectionIndex(
            String[] fieldNames, PlainSelect plainSelect) {
        int[] projectionIndex = null;
        List<SelectItem<?>> selectItems = plainSelect.getSelectItems();

        List<String> columnNames = new ArrayList<>();
        for (SelectItem selectItem : selectItems) {
            if (selectItem.getExpression() instanceof AllColumns) {
                return null;
            } else {
                String columnName = ((Column) selectItem.getExpression()).getColumnName();
                columnNames.add(columnName);
            }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Remove ORDER BY / LIMIT / GROUP BY / HAVING from the predicate SQL and keep only WHERE conditions
  2. Apply ordering/limiting/aggregation after reading, in the SeaTunnel job (transform/sink side)
  3. Split data processing: push down only the WHERE filter, do the rest downstream

Example fix

// before
String sql = "SELECT * FROM t WHERE x=1 ORDER BY id LIMIT 10";
// after
String sql = "SELECT * FROM t WHERE x=1";
Defensive patterns

Strategy: validation

Validate before calling

if (sql.toUpperCase().matches(".*(GROUP BY|HAVING|ORDER BY|LIMIT).*")) throw new IllegalArgumentException("Unsupported clause in filter SQL");

Try / catch

try { converter.convertToPlainSelect(query); } catch (IllegalArgumentException e) { if (e.getMessage().contains("WHERE clause")) { /* remove ORDER BY/LIMIT/etc. */ } throw e; }

Prevention

When it happens

Trigger: Providing a predicate SQL containing HAVING, GROUP BY, ORDER BY or LIMIT to the Paimon source predicate converter, e.g. 'SELECT * FROM t WHERE x=1 ORDER BY id LIMIT 10'.

Common situations: Users expecting pushdown filters to also sort/limit results; copying queries from OLAP tools with ORDER BY/LIMIT; generating filter SQL templates that include pagination clauses.

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/12cc6842771c1423. Report an issue: GitHub.