apache/seatunnel · error · IllegalArgumentException
Only SELECT statements are supported.
Error message
Only SELECT statements are supported.
What it means
After successfully parsing, convertToPlainSelect verifies the Statement is a Select; anything else (INSERT, UPDATE, DELETE, CREATE, etc.) is rejected with IllegalArgumentException('Only SELECT statements are supported.') because the converter only translates SELECT predicates into Paimon predicates.
Source
Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java:92
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SqlToPaimonPredicateConverter {
public static PlainSelect convertToPlainSelect(String query) {
if (StringUtils.isBlank(query)) {
return null;
}
Statement statement = null;
try {
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(View on GitHub (pinned to cf67b549a7)
Solutions
- Ensure the SQL string is a SELECT statement
- Use only WHERE-based filter expressions, e.g. 'SELECT * FROM table WHERE col = x'
- Remove any trailing statements separated by semicolons
- Strip comments/DDL prefixes from the query string
Example fix
// before String sql = "DELETE FROM t WHERE id = 1"; // after String sql = "SELECT * FROM t WHERE id = 1";
Defensive patterns
Strategy: validation
Validate before calling
String trimmed = sql.trim().toUpperCase(); if (!trimmed.startsWith("SELECT")) throw new IllegalArgumentException("Filter SQL must be a SELECT statement"); Try / catch
try { converter.convertToPlainSelect(query); } catch (IllegalArgumentException e) { if ("Only SELECT statements are supported.".equals(e.getMessage())) { /* fix query to SELECT */ } throw e; } Prevention
- Only pass SELECT statements as predicate/query strings
- Strip trailing semicolons and extra statements
- Document that the converter is for filter pushdown, not DML/DDL
When it happens
Trigger: Supplying a non-SELECT SQL statement (UPDATE/DELETE/DDL/EXPLAIN) as the predicate/query to the Paimon source predicate converter.
Common situations: Users pasting mutation or DDL statements as filter expressions; tools that build query strings dynamically appending '; DELETE ...'; misunderstanding that the converter is for filter predicates, not arbitrary SQL execution.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Only simple SELECT statements are supported.
- Error parsing SQL.
- Only SELECT statements with WHERE clause are supported. The
- Invalid LIKE pattern: '%s'. Supported patterns are: 'prefix%
- Unsupported expression type: ${expression.getClass().getSimp
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e478eb7af5d6636b.
Report an issue: GitHub.