apache/seatunnel · error · IllegalArgumentException
Unsupported right expression in IN: expected a…
Error message
Unsupported right expression in IN: expected a parenthesized expression list
What it means
handleInExpression requires the right-hand side of an IN clause to be a JSqlParser ParenthesedExpressionList (e.g. IN ('a','b')). Any other right-side form, most commonly a subquery, is rejected because the converter can only evaluate literal value lists.
Solutions
- Replace the subquery with an explicit literal list: col IN ('a','b','c').
- Resolve subquery values beforehand and inline the literals.
- Expand parameter placeholders into a parenthesized literal list before conversion.
Example fix
// before: WHERE id IN (SELECT id FROM blacklist) | // after: WHERE id IN (1, 2, 3)
Defensive patterns
Strategy: validation
Validate before calling
if (!(rightExpr instanceof ParenthesedExpressionList)) throw new IllegalArgumentException("IN must use a parenthesized literal list"); Type guard
boolean isInList(Expression e) { return e instanceof ParenthesedExpressionList; } Try / catch
try { pred = converter.convertSqlWhereToPaimonPredicate(where, rowType); } catch (IllegalArgumentException e) { if (e.getMessage().contains("IN")) { /* fallback: no pushdown */ } } Prevention
- Never generate IN (subquery) for pushdown; inline resolved literals.
- Ensure the right side of IN is always parenthesized.
- Expand ?-parameter placeholders into a literal list before conversion.
When it happens
Trigger: WHERE clause uses `col IN (SELECT x FROM t)` or a function/parameter expression on the right of IN instead of a parenthesized literal list.
Common situations: Subquery IN clauses generated by query builders or ORMs; templated SQL emitting IN without parentheses (e.g. IN ?, unquoted lists).
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Empty value list in IN clause is not allowed
- Error parsing SQL.
- Expected Column expression, but got
- Failed to convert value in IN clause
- Invalid LIKE pattern
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/d56ab8d8490db12a.
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:321
} else if (expression instanceof Parenthesis) {
Parenthesis parenthesis = (Parenthesis) expression;
return parseExpressionToPredicate(builder, rowType, parenthesis.getExpression());
} else if (expression instanceof InExpression) {
return handleInExpression(builder, rowType, (InExpression) expression);
}
throw new IllegalArgumentException(
"Unsupported expression type: " + expression.getClass().getSimpleName());
}
private static Predicate handleInExpression(
PredicateBuilder builder, RowType rowType, InExpression expr) {
Expression left = expr.getLeftExpression();
Column column = safeGetColumn(left);
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) {View on GitHub (pinned to cf67b549a7)