apache/seatunnel · error · IllegalArgumentException

Failed to convert value in IN clause

Error message

Failed to convert value in IN clause: ${rawVal}

What it means

After getJSQLParserDataTypeValue returns a raw value, convertValueByPaimonDataType must map it to the column's Paimon/SeaTunnel type. If the conversion returns null (type mismatch or unparseable literal), the converter throws this error naming the offending raw value rather than emitting a corrupt predicate.

Solutions

  1. Quote string values and leave numbers unquoted so the literal type matches the column type.
  2. Fix date/timestamp literals to the format the converter's parse helpers expect.
  3. Verify the column's type in the Paimon schema matches what the query assumes.

Example fix

// before: WHERE int_col IN (1, '2', 3) | // after: WHERE int_col IN (1, 2, 3)
Defensive patterns

Strategy: validation

Validate before calling

for (Object v : values) { switch (columnType) { case INT: case BIGINT: require v instanceof Long; case VARCHAR: require v instanceof String; case DATE: case TIMESTAMP: validate parseable format; } }

Try / catch

try { pred = converter.convertSqlWhereToPaimonPredicate(where, rowType); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Failed to convert value")) log.error("Bad literal for column type", e); throw e; }

Prevention

When it happens

Trigger: An IN-list literal cannot be converted for the column's declared type, e.g. `int_col IN (1, 'abc', 3)` or a wrongly formatted date/timestamp literal.

Common situations: Quoted/unquoted literal mismatches with column types; locale/format issues in date literals; schema type changes after the query was written.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/f98c90839a867596. 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:340

                    "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());
        }
        return (Column) expr;
    }

    private static Object convertValueByPaimonDataType(
            RowType rowType, String columnName, Object jsqlParserDataTypeValue) {

View on GitHub (pinned to cf67b549a7)