Repository navigation
perf(scan): prune pages based on dictionary values before materialization - #10991
ilya-zlobintsev wants to merge 4 commits into
Conversation
Add `CoreFieldDecoderStrategy::rows_that_may_match`, which checks a column's dictionary, constant and all-null pages against a `ValuePredicate` without decoding their rows. Page metadata is loaded through the shared cache, so a later read of the same pages reuses it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Plumb `rows_that_may_match` through `ProjectedFileReader`, `GenericFileReader` and `FragmentReader`. Fields replaced by overlays are not checked, because page values don't include the overlaid values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ng them Split the fragment filter into per-column conjuncts and check them against page values before reading, dropping the row ranges of pages that can't contain a match (e.g. pages whose dictionary has none of the ids in `id IN (...)`). Co-Authored-By: Claude Opus 5.5 <[email protected]>
f4cbc07 to
faa6211
Compare
westonpace
left a comment
There was a problem hiding this comment.
This PR makes me a little nervous though I can see the appeal. I've tried very hard to avoid compute calculations into the file itself, preferring those to be handled by indexes.
Primarily I am concerned it becomes a slippery slope and the file format ends up with far too many heavy dependencies and complexity.
However, this PR strikes a pretty compelling middle ground. The lance-encoding crate remains blissfully unaware of things like "expressions". Instead it seems we are mainly saying "look, I can sometimes give you a preview of the data, in Arrow format, before I've decoded, and you the caller can tell me if you want to proceed or not".
I think this is an acceptable compromise. My main request is that we write some of this (what this PR does and what I've just said) up in the spec files or top-level comment files. Can you add something to this section (https://lance.org/format/file/#functional-decomposition) basically stating that we expect query engines to be responsible for anything beyond encoding and decoding (e.g. filtering and projection) but we may provide hooks for those engines to interact in the encoding and decoding process early to save work?
|
Important Format specification voteThis PR modifies the Lance format specification, so it requires 3 binding +1 votes from PMC members (excluding the proposer), at least one of them on the latest commit, and a minimum 72-hour voting period, weekends excluded, before it can merge. Vote by approving this PR (+1) or requesting changes (−1, a veto). See the voting process. Approvals carry over across pushes, so a rebase or a typo fix does not send everyone back to re-vote. Whoever approves the latest commit is vouching that nothing substantive has changed since the earlier approvals; if something has, ask for fresh votes. Status: ❌ Blocked — vetoed by @westonpace
Updated automatically by the format-spec vote gate, which re-checks every 15 minutes — just voted? Re-check now (press Run workflow; leave the input blank to re-check every open format PR). A PMC member may apply the |
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The added documentation makes query-engine ownership of filtering and optional decoder hints explicit. Pruning remains conservative for nulls and unsupported pages, and surviving rows still receive the original filter. No blocking issues found.
Done, feel free to rephrase or expand the wording if you think there's a better way to describe it. |
Closes #10310.
For dictionary-encoded pages, filters are now checked against the dictionary itself, and pages that are known to not match the filter are pruned and not materialized. Previously they would be materialized into an array with mostly-duplicate values, only to then compare each row again. This provides significant performance improvements for unindexed filtered reads on such pages, and I expect that a lot of data in different workloads is low cardinality and falls into dictionary encoding.
The same pruning is also applied for constant and all-null pages. All other page types, pages with overlays, pre-2.1 fragments, nested or dictionary-typed columns, etc are excluded.
Using the example python script from the linked issue, these are the numbers:
Lance 14.0.2
With this PR: