API: Fix Identity projection for mismatched transform types#17261
Open
yadavay-amzn wants to merge 1 commit into
Open
API: Fix Identity projection for mismatched transform types#17261yadavay-amzn wants to merge 1 commit into
yadavay-amzn wants to merge 1 commit into
Conversation
…5502) Identity.project() and projectStrict() delegate to projectStrict() which creates an unbound predicate with the literal from the input predicate. When the predicate term is a transform (e.g. hours(ts) = 490674), the literal type (integer) does not match the partition field type (timestamptz), causing a ValidationException when the unbound predicate is later bound to the partition schema. Fix: Return null from projectStrict() when the predicate term is not a BoundReference, indicating the identity transform cannot project transform-based predicates. This causes the projection to fall back to alwaysTrue (inclusive) or alwaysFalse (strict), which is correct.
Contributor
Author
|
@ebyhr this is the rebased continuation of #16074 (which the stale bot closed and GitHub won't let me reopen - the branch was force-pushed/recreated). It's a small fix (+35/-0) for Identity projection on mismatched transform types (#15502), now rebased onto current main and green. Would you be willing to take another look when you have a moment? |
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.
This continues #16074, which was auto-closed by the stale bot and can no longer be reopened (GitHub blocks reopening because the branch was force-pushed/recreated). Same fix, rebased onto current
main.What
Identity.projectStrict()currently produces a predicate even when the predicate term is a transform expression rather than aBoundReference, which yields an invalid cross-type predicate during partition projection. This adds a guard so that a non-BoundReferenceterm makesprojectStrict()returnnull, letting the projection framework fall back toalwaysTrue/alwaysFalse.project()delegates toprojectStrict(), so both paths are covered.Why
Fixes #15502 - Identity partition projection returns incorrect results when the source and projected transform types differ.
Tests
Adds a regression test in
TestProjectionthat exercises the mismatched-transform case; it fails on the pre-fix code (producing an invalidref(...) == ...predicate instead ofalwaysTrue) and passes with the fix.