Skip to content

[flink] BETWEEN predicate fails at runtime after pushdown: literal extraction missing in PredicateConverter #4000

Description

@WenDing-Y

Search before asking

  • I searched in the issues and found nothing similar.

Fluss version

0.9.0 (latest release)

Please describe the bug 🐞

PredicateConverter mishandles the Flink BETWEEN expression when converting to a Fluss Predicate: the lower/upper bounds are passed through as raw ValueLiteralExpression AST nodes instead of being extracted to real Java literals:

// before the fix
return builder.between(builder.indexOf(fieldRefExpr.getName()), children.get(1), children.get(2));
This is inconsistent with how EQUALS / IN / LIKE are handled (they all call extractLiteral(...)). The consequence:

toString()-based assertions still pass, because ValueLiteralExpression.toString() prints something like "10", so the converted predicate looks correct (And([GreaterOrEqual(long1, 10), LessOrEqual(long1, 20)])).
But at runtime, predicate.test(row) fails with Unsupported type: BIGINT in CompareUtils.compareLiteral, because the predicate holds Flink AST nodes rather than typed literal values.

### Solution

Extract both bounds with `extractLiteral(fieldRefExpr.getOutputDataType(), ...)` before calling `builder.between(...)`, consistent with the other comparison branches (`EQUALS` / `IN` / `LIKE`). Also add a row-evaluation regression test (`testBetweenEvaluatesAgainstRow`) that calls `predicate.test(GenericRow.of(...))` — the kind of test that would have caught this bug, since the previous parameterized test only compared `toString()` output.


### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions