{"record":{"id":"435adb983097d61a","repo":"apache/seatunnel","slug":"illegal-argument-435adb","errorCode":"ILLEGAL_ARGUMENT","errorMessage":"sql should not contain more than one where","messagePattern":"sql should not contain more than one where","errorType":"error_code","errorClass":"InfluxdbConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-influxdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/influxdb/source/InfluxDBSourceSplitEnumerator.java","lineNumber":144,"sourceCode":"    }\n\n    private Set<InfluxDBSourceSplit> getInfluxDBSplit() {\n        String sql = config.getSql();\n        Set<InfluxDBSourceSplit> influxDBSourceSplits = new HashSet<>();\n        // no need numPartitions, use one partition\n        if (config.getPartitionNum() == 0) {\n            influxDBSourceSplits.add(\n                    new InfluxDBSourceSplit(String.valueOf(SourceConfig.DEFAULT_PARTITIONS), sql));\n            return influxDBSourceSplits;\n        }\n        // calculate numRange base on (lowerBound upperBound partitionNum)\n        List<Pair<Long, Long>> rangePairs =\n                genSplitNumRange(\n                        config.getLowerBound(), config.getUpperBound(), config.getPartitionNum());\n\n        String[] sqls = sql.split(InfluxDBSourceOptions.SQL_WHERE.key());\n        if (sqls.length > 2) {\n            throw new InfluxdbConnectorException(\n                    CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,\n                    \"sql should not contain more than one where\");\n        }\n\n        int i = 0;\n        while (i < rangePairs.size()) {\n            String query =\n                    \" where (\"\n                            + config.getSplitKey()\n                            + \" >= \"\n                            + rangePairs.get(i).getLeft()\n                            + \" and \"\n                            + config.getSplitKey()\n                            + \" < \"\n                            + rangePairs.get(i).getRight()\n                            + \") \";\n            i++;\n            query = sqls[0] + query;","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-influxdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/influxdb/source/InfluxDBSourceSplitEnumerator.java#L126-L162","documentation":"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.","triggerScenarios":"User provides an InfluxQL query with two or more WHERE clauses (conditions combined with a second WHERE) to a partitioned source.","commonSituations":"Copy-pasted queries with redundant WHERE clauses, programmatic SQL assembly that appends its own WHERE, or queries using 'WHERE' inside a string literal.","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."],"exampleFix":"// before\nsql = \"SELECT * FROM m WHERE time > now() - 1h WHERE region = 'us'\"\n// after\nsql = \"SELECT * FROM m WHERE time > now() - 1h AND region = 'us'\"","handlingStrategy":"validation","validationCode":"// validate SQL before submit\nString sql = config.getSql();\nlong count = Arrays.stream(sql.split(\"\\\\bWHERE\\\\b\", -1)).count() - 1;\nif (count > 1) throw new IllegalArgumentException(\"sql must contain at most one WHERE: \" + sql);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["influxdb","sql","config"],"backgroundTag":"invalid-argument-value","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"}