apache/seatunnel · error · IllegalArgumentException

Unsupported expression type: ${expression.getClass().getSimp

Error message

Unsupported expression type: ${expression.getClass().getSimpleName()}

What it means

parseExpressionToPredicate throws this when a JSqlParser expression type in the WHERE clause has no conversion branch in the converter. Only comparison operators, LikeExpression, Parenthesis, InExpression, and logical AND/OR are handled; any other expression type reaches the final throw.

Source

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

            Pattern CONTAINS_PATTERN = Pattern.compile("^%([^%]+)%$");
            Matcher containsMatcher = CONTAINS_PATTERN.matcher(rightVal.toString());
            if (containsMatcher.matches()) {
                return builder.contains(
                        columnIndex, BinaryString.fromString(containsMatcher.group(1)));
            }
            throw new IllegalArgumentException(
                    String.format(
                            "Invalid LIKE pattern: '%s'. Supported patterns are: 'prefix%%', '%%suffix', and '%%substring%%'. "
                                    + "Please ensure your pattern matches one of these formats.",
                            rightVal.toString()));

        } 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()) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Rewrite the WHERE clause using only supported operators: =, <>, >, >=, <, <=, LIKE (3 supported shapes), IN, AND/OR, parentheses.
  2. Replace BETWEEN with col >= a AND col <= b.
  3. Handle NULL checks outside pushdown or filter after read.
  4. Add an instanceof branch to parseExpressionToPredicate if the expression type should be supported.

Example fix

// before: WHERE ts BETWEEN '2024-01-01' AND '2024-02-01' | // after: WHERE ts >= '2024-01-01' AND ts <= '2024-02-01'
Defensive patterns

Strategy: validation

Validate before calling

Set<Class<?>> OK = Set.of(EqualsTo.class, NotEqualsTo.class, GreaterThan.class, GreaterThanEquals.class, MinorThan.class, MinorThanEquals.class, LikeExpression.class, Parenthesis.class, InExpression.class, AndExpression.class, OrExpression.class); boolean convertible = OK.stream().anyMatch(c -> c.isInstance(expr));

Type guard

boolean isConvertible(Expression e) { return e instanceof BinaryExpression || e instanceof Parenthesis || e instanceof InExpression; }

Try / catch

try { pred = converter.convertSqlWhereToPaimonPredicate(where, rowType); } catch (IllegalArgumentException e) { log.warn("Unsupported expression, dropping pushdown: {}", e.getMessage()); pred = null; }

Prevention

When it happens

Trigger: A WHERE clause contains an unsupported expression type passed into convertSqlWhereToPaimonPredicate, e.g. BETWEEN, IS NULL / IS NOT NULL, function calls like UPPER(col)='X', arithmetic (a+1>5), or CASE expressions.

Common situations: Users assume full SQL predicate pushdown; upstream SQL generators emit IS NULL or BETWEEN clauses; JSqlParser version upgrades change the Expression class hierarchy so existing instanceof checks no longer match.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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