apache/seatunnel · error · IotdbConnectorException
CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT
CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT
Error message
sql should not contain more than one where
What it means
Thrown by getIotDBSplit when parsing the configured query SQL and more than one WHERE clause keyword is found. The enumerator splits the SQL on WHERE once to build per-split range conditions; a second WHERE would break that construction, so the config is rejected as illegal. This is a user SQL configuration validation error before any split is emitted.
Source
Thrown at seatunnel-connectors-v2/connector-iotdb-v2/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdbv2/source/IoTDBv2SourceSplitEnumerator.java:144
// no need numPartitions, use one partition
if (!conf.getOptional(NUM_PARTITIONS).isPresent()) {
iotDBSourceSplits.add(new IoTDBv2SourceSplit(DEFAULT_PARTITIONS, sql));
return iotDBSourceSplits;
}
long start = conf.get(LOWER_BOUND);
long end = conf.get(UPPER_BOUND);
int numPartitions = conf.get(NUM_PARTITIONS);
String sqlBase = sql;
String sqlAlign = null;
String sqlCondition = null;
String[] sqls = sqlBase.split("(?i)" + SQL_ALIGN);
if (sqls.length > 1) {
sqlBase = sqls[0];
sqlAlign = sqls[1];
}
sqls = sqlBase.split("(?i)" + SQL_WHERE);
if (sqls.length > SQL_WHERE_SPLIT_LENGTH) {
throw new IotdbConnectorException(
CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,
"sql should not contain more than one where");
}
if (sqls.length > 1) {
sqlBase = sqls[0];
sqlCondition = sqls[1];
}
long size = (end - start) / numPartitions + 1;
long remainder = (end + 1 - start) % numPartitions;
if (end - start < numPartitions) {
numPartitions = (int) (end - start);
}
long currentStart = start;
int i = 0;
while (i < numPartitions) {
String query =
" where ("
+ RESERVED_TIMEView on GitHub (pinned to cf67b549a7)
Solutions
- Rewrite the query to use exactly one top-level WHERE, combining conditions with AND/OR
- Move subquery WHEREs into a join or restructure the query to avoid nested WHERE keywords
- Pre-filter conditions by merging them into the single WHERE clause (e.g. WHERE a=1 AND b=2)
- If you need complex queries, disable split-based querying or upgrade to a version supporting richer SQL parsing
Example fix
// before query = "select * from sensor where status=1 where region='us'" // after query = "select * from sensor where status=1 and region='us'"
Defensive patterns
Strategy: validation
Validate before calling
String query = conf.get("query");
String[] parts = query.split("(?i)where");
if (parts.length > 2) {
throw new IllegalArgumentException("query may contain at most one WHERE clause: " + query);
} Try / catch
try {
enumerator.getIotDBSplit();
} catch (IotdbConnectorException e) {
if (e.getSeaTunnelErrorCode().equals(CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT)) {
// rewrite config query with a single top-level WHERE and retry job
}
throw e;
} Prevention
- Lint the 'query' config at submit time: exactly one top-level WHERE
- Merge conditions with AND/OR instead of stacking WHERE clauses
- Avoid subqueries containing WHERE in the configured query
- Unit-test SQL parsing of your configured queries before deploy
When it happens
Trigger: The 'query'/'sql' sink-source config contains two WHERE clauses (e.g. a subquery or appended condition), so sqlBase.split(SQL_WHERE) yields more than SQL_WHERE_SPLIT_LENGTH parts.
Common situations: Users writing complex queries with subqueries containing WHERE; copy-pasted SQL with redundant conditions; dynamically built SQL appending an extra filter; also align-query SQL (sqlAlign) combined incorrectly.
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
- The source table[%s] is not found
- SQL_OPERATION_FAILED
- ILLEGAL_ARGUMENT
- CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT
- oracle_insert_mode=APPEND_VALUES only supports generated INS
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/ab20168ff20c8315.
Report an issue: GitHub.