{"record":{"id":"fd4ae9291f584d95","repo":"apache/seatunnel","slug":"empty-value-list-in-in-clause-is-not-allowed","errorCode":null,"errorMessage":"Empty value list in IN clause is not allowed","messagePattern":"Empty value list in IN clause is not allowed","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java","lineNumber":328,"sourceCode":"                \"Unsupported expression type: \" + expression.getClass().getSimpleName());\n    }\n\n    private static Predicate handleInExpression(\n            PredicateBuilder builder, RowType rowType, InExpression expr) {\n        Expression left = expr.getLeftExpression();\n        Column column = safeGetColumn(left);\n        int index = getColumnIndex(builder, column);\n\n        Expression right = expr.getRightExpression();\n        if (!(right instanceof ParenthesedExpressionList)) {\n            throw new IllegalArgumentException(\n                    \"Unsupported right expression in IN: expected a parenthesized expression list\");\n        }\n\n        ParenthesedExpressionList list = (ParenthesedExpressionList) right;\n        List<Expression> expressions = list.getExpressions();\n        if (expressions.isEmpty()) {\n            throw new IllegalArgumentException(\"Empty value list in IN clause is not allowed\");\n        }\n\n        List<Object> values = new ArrayList<>(expressions.size());\n        for (Expression expression : expressions) {\n            Object rawVal = getJSQLParserDataTypeValue(expression);\n            if (rawVal == null) {\n                throw new IllegalArgumentException(\"Null value found in IN clause values\");\n            }\n            Object convertedVal =\n                    convertValueByPaimonDataType(rowType, column.getColumnName(), rawVal);\n            if (convertedVal == null) {\n                throw new IllegalArgumentException(\n                        \"Failed to convert value in IN clause: \" + rawVal);\n            }\n            values.add(convertedVal);\n        }\n\n        return expr.isNot() ? builder.notIn(index, values) : builder.in(index, values);","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java#L310-L346","documentation":"An IN clause whose parenthesized list contains no values (col IN ()) is rejected. An empty IN predicate is semantically always false, and the converter refuses to build a Paimon predicate from an empty value list instead of producing a vacuous filter.","triggerScenarios":"Dynamic SQL generation produces `col IN ()` when the caller's value collection is empty; string concatenation joins an empty list.","commonSituations":"Code building 'IN (' + join(values) + ')' with empty values; query builders emitting empty IN for empty collections.","solutions":["Guard the caller: if the collection is empty, skip the predicate or short-circuit the query to no rows.","Emit `1 = 0` (always false) when an empty filter must remain valid SQL.","Add a size check before building the WHERE clause."],"exampleFix":"// before: 'id IN (' + join(ids) + ')' with empty ids | // after: if (ids.isEmpty()) skip pushdown or force empty result","handlingStrategy":"validation","validationCode":"if (values == null || values.isEmpty()) { /* skip predicate or force empty result */ } else { buildSql(values); }","typeGuard":null,"tryCatchPattern":"try { pred = converter.convertSqlWhereToPaimonPredicate(where, rowType); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Empty value list\")) return emptyResult(); throw e; }","preventionTips":["Check collection size before templating IN clauses.","Emit 1 = 0 for intentionally empty filters.","Add unit tests for empty-collection SQL generation."],"tags":["sql","paimon","in-clause","empty-list"],"backgroundTag":"empty-required-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}