Repository navigation
GH-55886: [C++][Dataset] Preserve narrowing casts during Parquet pruning - #55941
Open
TatvagnaTandel wants to merge 1 commit into
Open
TatvagnaTandel wants to merge 1 commit into
TatvagnaTandel wants to merge 1 commit into
Conversation
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.
Rationale for this change
Arrow uses Parquet row group statistics to skip groups that cannot match a filter. Those statistics describe the original
float64column. When a filter casts that column tofloat32, rounding can move a value onto the comparison boundary.In the reported case,
17.799999999999997is greater than the threshold17.799999237060547before casting. After casting tofloat32, it equals the threshold and should satisfy the<=comparison. The simplifier stripped the cast, so pruning compared the originalfloat64bound against the threshold and skipped a row group that contained a match. The same problem affected>=comparisons.What changes are included in this PR?
The expression simplifier retains narrowing floating point casts and still simplifies widening casts. When a widening cast wraps a narrowing cast, the simplifier can remove the outer cast while preserving the inner one. The patch leaves integer to floating point handling unchanged.
Are these changes tested?
<=and>=. Each scan returned zero rows before the fix and the expected matching row afterward.Are there any user-facing changes?
Affected Parquet Dataset filters now return matching rows that were previously skipped.
Critical Fix: The bug produced incomplete query results by dropping matching rows during pruning. The patch changes no public APIs.
Was AI used for this PR?
Codex generated the implementation and documentation.
I personally reviewed the implementation and test.