apache/seatunnel · error · IllegalArgumentException

Null value found in IN clause values

Error message

Null value found in IN clause values

What it means

Within an IN clause, a value expression evaluated by getJSQLParserDataTypeValue returned null (e.g. a NULL literal), and the converter rejects NULL as an IN-list member because Paimon's PredicateBuilder.in operates on concrete values and cannot include NULL.

Solutions

  1. Remove NULL from the IN list; x IN (... NULL ...) never matches NULL anyway.
  2. If NULL rows are needed, split the condition (col IN (1,3) OR col IS NULL), noting IS NULL may not be pushdown-supported.
  3. Validate values and drop nulls before generating SQL.

Example fix

// before: WHERE id IN (1, NULL, 3) | // after: WHERE id IN (1, 3)
Defensive patterns

Strategy: validation

Validate before calling

List<Object> nonNull = values.stream().filter(Objects::nonNull).collect(Collectors.toList());

Try / catch

try { pred = converter.convertSqlWhereToPaimonPredicate(where, rowType); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Null value")) { /* rebuild clause without nulls */ } throw e; }

Prevention

When it happens

Trigger: WHERE clause like `col IN (1, NULL, 3)` reaches handleInExpression; getJSQLParserDataTypeValue returns null for the NULL expression.

Common situations: Generated SQL that inserts null values into an IN list; users expecting SQL NULL semantics from IN; query builders that stringify nulls.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/adf84c3787460321. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/converter/SqlToPaimonPredicateConverter.java:335

        int index = getColumnIndex(builder, column);

        Expression right = expr.getRightExpression();
        if (!(right instanceof ParenthesedExpressionList)) {
            throw new IllegalArgumentException(
                    "Unsupported right expression in IN: expected a parenthesized expression list");
        }

        ParenthesedExpressionList list = (ParenthesedExpressionList) right;
        List<Expression> expressions = list.getExpressions();
        if (expressions.isEmpty()) {
            throw new IllegalArgumentException("Empty value list in IN clause is not allowed");
        }

        List<Object> values = new ArrayList<>(expressions.size());
        for (Expression expression : expressions) {
            Object rawVal = getJSQLParserDataTypeValue(expression);
            if (rawVal == null) {
                throw new IllegalArgumentException("Null value found in IN clause values");
            }
            Object convertedVal =
                    convertValueByPaimonDataType(rowType, column.getColumnName(), rawVal);
            if (convertedVal == null) {
                throw new IllegalArgumentException(
                        "Failed to convert value in IN clause: " + rawVal);
            }
            values.add(convertedVal);
        }

        return expr.isNot() ? builder.notIn(index, values) : builder.in(index, values);
    }

    private static Column safeGetColumn(Expression expr) {
        if (!(expr instanceof Column)) {
            throw new IllegalArgumentException(
                    "Expected Column expression, but got: " + expr.getClass().getSimpleName());
        }

View on GitHub (pinned to cf67b549a7)