apache/seatunnel · error · IllegalArgumentException
Only support sql: delete from ... where ..., Not support: {}
Error message
Only support sql: delete from ... where ..., Not support: {} What it means
IcebergCatalog.executeSql only supports JSqlParser-parseable DELETE FROM ... WHERE statements; any other SQL syntax (or non-DELETE statements) fails to parse or fails the cast to Delete, so an IllegalArgumentException is thrown wrapping the offending SQL.
Source
Thrown at seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java:231
throw new TableNotExistException("table not exist", tablePath);
}
TableIdentifier icebergTableIdentifier = toIcebergTableIdentifier(tablePath);
Snapshot snapshot = catalog.loadTable(icebergTableIdentifier).currentSnapshot();
if (snapshot != null) {
String total = snapshot.summary().getOrDefault("total-records", null);
return total != null && !total.equals("0");
}
return false;
}
@Override
public void executeSql(TablePath tablePath, String sql) {
Delete delete;
try {
Statement statement = CCJSqlParserUtil.parse(sql);
delete = (Delete) statement;
} catch (Throwable e) {
throw new IllegalArgumentException(
"Only support sql: delete from ... where ..., Not support: " + sql, e);
}
TablePath targetTablePath = TablePath.of(delete.getTable().getFullyQualifiedName(), false);
if (targetTablePath.getDatabaseName() == null) {
targetTablePath =
TablePath.of(tablePath.getDatabaseName(), targetTablePath.getTableName());
}
if (!targetTablePath.equals(tablePath)) {
log.warn(
"The delete table {} is not equal to the target table {}",
targetTablePath,
tablePath);
}
TableIdentifier icebergTableIdentifier = toIcebergTableIdentifier(targetTablePath);
Table table = catalog.loadTable(icebergTableIdentifier);
Expression expression = ExpressionUtils.convert(delete.getWhere(), table.schema());View on GitHub (pinned to cf67b549a7)
Solutions
- Rewrite the SQL as a simple 'DELETE FROM <table> WHERE <predicate>' statement.
- Use the Iceberg API directly instead of SQL: catalog.loadTable(id).newDelete().deleteFromRowFilter(Expressions.equal(...)).commit()
- Use truncateTable() when the intent is deleting all rows.
- Pre-validate the SQL shape (starts with 'delete from') before calling executeSql.
Example fix
// before catalog.executeSql(path, "UPDATE t SET a = 1 WHERE id = 2"); // after catalog.executeSql(path, "DELETE FROM t WHERE id = 2");
Defensive patterns
Strategy: validation
Validate before calling
if (sql == null || !sql.trim().toLowerCase().startsWith("delete from")) {
throw new IllegalArgumentException("executeSql only supports DELETE FROM ... WHERE: " + sql);
} Try / catch
try { catalog.executeSql(path, sql); } catch (IllegalArgumentException e) { log.error("Unsupported SQL: {}", sql, e); } Prevention
- Restrict user-supplied SQL to DELETE statements
- Prefer catalog APIs (newDelete/truncateTable) over raw SQL
- Document the supported SQL subset for users
When it happens
Trigger: Calling catalog.executeSql(tablePath, sql) with SQL that is not a DELETE statement (INSERT/UPDATE/SELECT/DDL), or a DELETE whose syntax JSqlParser cannot parse (dialect-specific functions, hints, comments, multi-table deletes).
Common situations: Users pass Hive/Spark-dialect DELETE syntax, pass other SQL statements expecting generic SQL execution, or use version-specific parser-incompatible syntax; also common when wiring generic SQL from user config.
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
- Preview action is not supported
- Truncate table failed
- Failed EXECUTE SQL in catalog %s
- Failed executeSql error %s
- catalog not implements SupportsNamespaces so can't check dat
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/f82e6034fa994a5d.
Report an issue: GitHub.