[flink] BETWEEN predicate fails at runtime after pushdown: literal extraction missing in PredicateConverter
- Dominant language
- Java
- Stars
- 2.1k
- Forks
- 625
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 97
Description
### Search before asking
- [x] I searched in the [issues](https://github.com/apache/fluss/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:
```java
// 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!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in PredicateConverter and compare the BETWEEN conversion with the existing EQUALS, IN, and LIKE branches. Add the named testBetweenEvaluatesAgainstRow regression test using GenericRow.of(...), then verify predicate.test(row) evaluates typed bounds correctly rather than relying only on toString() output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100