{"record":{"id":"12cc6842771c1423","repo":"apache/seatunnel","slug":"only-select-statements-with-where-clause-are-suppo","errorCode":null,"errorMessage":"Only SELECT statements with WHERE clause are supported. The Having, Group By, Order By, Limit clauses are currently unsupported.","messagePattern":"Only SELECT statements with WHERE clause are supported\\. The Having, Group By, Order By, Limit clauses are currently unsupported\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java","lineNumber":104,"sourceCode":"            statement = CCJSqlParserUtil.parse(query);\n        } catch (JSQLParserException e) {\n            throw new IllegalArgumentException(\"Error parsing SQL.\", e);\n        }\n        // Confirm that the SQL statement is a Select statement\n        if (!(statement instanceof Select)) {\n            throw new IllegalArgumentException(\"Only SELECT statements are supported.\");\n        }\n        Select select = (Select) statement;\n        Select selectBody = select.getSelectBody();\n        if (!(selectBody instanceof PlainSelect)) {\n            throw new IllegalArgumentException(\"Only simple SELECT statements are supported.\");\n        }\n        PlainSelect plainSelect = (PlainSelect) selectBody;\n        if (plainSelect.getHaving() != null\n                || plainSelect.getGroupBy() != null\n                || plainSelect.getOrderByElements() != null\n                || plainSelect.getLimit() != null) {\n            throw new IllegalArgumentException(\n                    \"Only SELECT statements with WHERE clause are supported. The Having, Group By, Order By, Limit clauses are currently unsupported.\");\n        }\n        return plainSelect;\n    }\n\n    public static int[] convertSqlSelectToPaimonProjectionIndex(\n            String[] fieldNames, PlainSelect plainSelect) {\n        int[] projectionIndex = null;\n        List<SelectItem<?>> selectItems = plainSelect.getSelectItems();\n\n        List<String> columnNames = new ArrayList<>();\n        for (SelectItem selectItem : selectItems) {\n            if (selectItem.getExpression() instanceof AllColumns) {\n                return null;\n            } else {\n                String columnName = ((Column) selectItem.getExpression()).getColumnName();\n                columnNames.add(columnName);\n            }","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java#L86-L122","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","solutions":["Remove ORDER BY / LIMIT / GROUP BY / HAVING from the predicate SQL and keep only WHERE conditions","Apply ordering/limiting/aggregation after reading, in the SeaTunnel job (transform/sink side)","Split data processing: push down only the WHERE filter, do the rest downstream"],"exampleFix":"// before\nString sql = \"SELECT * FROM t WHERE x=1 ORDER BY id LIMIT 10\";\n// after\nString sql = \"SELECT * FROM t WHERE x=1\";","handlingStrategy":"validation","validationCode":"if (sql.toUpperCase().matches(\".*(GROUP BY|HAVING|ORDER BY|LIMIT).*\")) throw new IllegalArgumentException(\"Unsupported clause in filter SQL\");","typeGuard":null,"tryCatchPattern":"try { converter.convertToPlainSelect(query); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"WHERE clause\")) { /* remove ORDER BY/LIMIT/etc. */ } throw e; }","preventionTips":["Keep only WHERE clauses in pushdown predicates","Move ordering, limiting and aggregation to downstream transforms","Sanitize generated SQL templates to strip unsupported clauses"],"tags":["sql","paimon","predicate-pushdown","unsupported-clause"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}