[flink] Fix BETWEEN literal extraction in PredicateConverter - #3947
Open
WenDing-Y wants to merge 1 commit into
Open
[flink] Fix BETWEEN literal extraction in PredicateConverter#3947WenDing-Y wants to merge 1 commit into
WenDing-Y wants to merge 1 commit into
Conversation
Author
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
PredicateConverterhandling of FlinkBETWEENso lower/upper bounds are real Java literals instead of unextractedValueLiteralExpressionnodes.fix #4000
Previously the converter did:
which stored Flink AST nodes as predicate literals. That made
toString()-based assertions pass (becauseValueLiteralExpression.toString()looks like"10"), whilepredicate.test(row)failed at runtime (Unsupported type: BIGINTinCompareUtils.compareLiteral).This change extracts both bounds via
extractLiteral(...), consistent withEQUALS/IN/LIKE, and adds a row-evaluation test that would have caught the bug.Changes
PredicateConverter: extractBETWEENlower/upper bounds withextractLiteralbefore callingbuilder.between.PredicateConverterTest:testBetweenEvaluatesAgainstRow(predicate.test(GenericRow...))10L/20L(BIGINT field + literal cast)Why the old test passed
The parameterized case only compared:
Both printed as something like:
even though one side held
ValueLiteralExpressionobjects and the other held numeric literals. String equality hid the type mismatch.Test plan
./mvnw -pl fluss-flink/fluss-flink-common -am test -Dtest=PredicateConverterTesttestBetweenEvaluatesAgainstRowfails on the unfixed code and passes after the fix