apache/seatunnel · error · InfluxdbConnectorException
ILLEGAL_ARGUMENT
ILLEGAL_ARGUMENT
Error message
sql should not contain more than one where
What it means
InfluxDBSourceSplitEnumerator.getInfluxDBSplit() splits the configured SQL on the literal string 'WHERE' to inject partition range predicates. If the SQL contains more than one 'WHERE', the split produces more than two parts and an ILLEGAL_ARGUMENT error is thrown.
Source
Thrown at seatunnel-connectors-v2/connector-influxdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/influxdb/source/InfluxDBSourceSplitEnumerator.java:144
}
private Set<InfluxDBSourceSplit> getInfluxDBSplit() {
String sql = config.getSql();
Set<InfluxDBSourceSplit> influxDBSourceSplits = new HashSet<>();
// no need numPartitions, use one partition
if (config.getPartitionNum() == 0) {
influxDBSourceSplits.add(
new InfluxDBSourceSplit(String.valueOf(SourceConfig.DEFAULT_PARTITIONS), sql));
return influxDBSourceSplits;
}
// calculate numRange base on (lowerBound upperBound partitionNum)
List<Pair<Long, Long>> rangePairs =
genSplitNumRange(
config.getLowerBound(), config.getUpperBound(), config.getPartitionNum());
String[] sqls = sql.split(InfluxDBSourceOptions.SQL_WHERE.key());
if (sqls.length > 2) {
throw new InfluxdbConnectorException(
CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,
"sql should not contain more than one where");
}
int i = 0;
while (i < rangePairs.size()) {
String query =
" where ("
+ config.getSplitKey()
+ " >= "
+ rangePairs.get(i).getLeft()
+ " and "
+ config.getSplitKey()
+ " < "
+ rangePairs.get(i).getRight()
+ ") ";
i++;
query = sqls[0] + query;View on GitHub (pinned to cf67b549a7)
Solutions
- Rewrite the SQL to use a single WHERE clause with AND-combined conditions.
- Remove duplicate/redundant WHERE clauses from the query config.
- Move extra filter conditions into the existing WHERE using AND.
Example fix
// before sql = "SELECT * FROM m WHERE time > now() - 1h WHERE region = 'us'" // after sql = "SELECT * FROM m WHERE time > now() - 1h AND region = 'us'"
Defensive patterns
Strategy: validation
Validate before calling
// validate SQL before submit
String sql = config.getSql();
long count = Arrays.stream(sql.split("\\bWHERE\\b", -1)).count() - 1;
if (count > 1) throw new IllegalArgumentException("sql must contain at most one WHERE: " + sql); Prevention
- Use exactly one WHERE clause and combine filters with AND.
- Never append raw WHERE when programmatically building the query.
- Review pasted SQL for duplicated clauses.
When it happens
Trigger: User provides an InfluxQL query with two or more WHERE clauses (conditions combined with a second WHERE) to a partitioned source.
Common situations: Copy-pasted queries with redundant WHERE clauses, programmatic SQL assembly that appends its own WHERE, or queries using 'WHERE' inside a string literal.
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
- CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT
- oracle_insert_mode=APPEND_VALUES only supports generated INS
- COMMON-24
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/435adb983097d61a.
Report an issue: GitHub.