[vortex] Do not push unrepresentable timestamp predicate literals - #9675
Open
jackylee-ch wants to merge 1 commit into
Open
[vortex] Do not push unrepresentable timestamp predicate literals#9675jackylee-ch wants to merge 1 commit into
jackylee-ch wants to merge 1 commit into
Conversation
jackylee-ch
force-pushed
the
vortex-unrepresentable-ts
branch
from
September 7, 2026 11:21
5516d0c to
18885b5
Compare
toTimestampLiteral takes the precision from the column type but the value from the predicate literal, and nothing reconciles them. Spark builds the literal from its own type with Timestamp.fromMicros, so a TIMESTAMP(0) column can receive a millisecond literal. Dividing by 1000, or discarding the sub-millisecond part on TIMESTAMP(3), then yields a bound that answers some operators wrongly: "f_ts < 1500ms" on a seconds column pushed "< 1s" and dropped the 1000ms row, which no post scan filter can restore. Math.floorDiv is not enough, because "col < L" needs the residual rounded down while "col > L" needs it rounded up. Refuse to push a literal that is not exactly representable at the column's grain and let the existing null handling drop the leaf, as ParquetFilters.normalizeDecimal does with RoundingMode.UNNECESSARY.
jackylee-ch
force-pushed
the
vortex-unrepresentable-ts
branch
from
September 7, 2026 12:56
18885b5 to
2408119
Compare
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.
Purpose
toTimestampLiteraltakes the precision from the column type but the value from the predicate literal, and nothing reconciles them — Spark builds the literal from its own type withTimestamp.fromMicros, so aTIMESTAMP(0)column can receive a millisecond literal. Dividing by 1000 (or discarding the sub-millisecond part onTIMESTAMP(3)) then yields a bound that answers some operators wrongly:f_ts < 1500mson a seconds column pushed< 1sand dropped the 1000ms row, which no post-scan filter can restore.Math.floorDivis not enough. For a residual literal,col < Lneeds the bound rounded down butcol > Lneeds it rounded up, and=is unsatisfiable while!=is a tautology — one direction cannot serve all six operators. So a literal that is not exactly representable at the column's grain is no longer pushed, and the existing null handling drops the leaf.ParquetFilters.normalizeDecimalusesRoundingMode.UNNECESSARYfor the same reason.Tests
Three
roundTripcases inVortexPredicateConverterTest: millisecond literal onTIMESTAMP(0)with<and!=, a pre-epoch literal, and a sub-millisecond literal onTIMESTAMP(3). All three return 0 rows on master.Written with Claude Code; verification is mine.