Push expressions through layout plans - #9166
Draft
joseph-isaacs wants to merge 1 commit into
Draft
Conversation
Merging this PR will improve performance by 25.44%
Performance Changes
Tip Curious why this is faster? Comment Comparing Footnotes
|
joseph-isaacs
marked this pull request as ready for review
August 4, 2026 11:52
joseph-isaacs
marked this pull request as draft
August 4, 2026 11:52
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 4, 2026 16:48
4dced78 to
7968c7e
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 5, 2026 14:35
7968c7e to
a9043d5
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 6, 2026 09:27
a9043d5 to
bda6747
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 6, 2026 12:41
bda6747 to
042e358
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 6, 2026 20:40
2028928 to
0134c4b
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 6, 2026 23:58
0134c4b to
6c41c35
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 7, 2026 12:04
6c41c35 to
65aad23
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 7, 2026 15:33
65aad23 to
265f6c2
Compare
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 7, 2026 15:57
265f6c2 to
b121a9e
Compare
Add the four parent-reduction rules that push an `Eval` into the operator
below it, and drive them from a top-down optimizer:
Eval x Concat push into every chunk, unless the expression reads
row indices, which are relative to the whole domain
Eval x Take evaluate over dictionary values instead of codes, only
when the expression is strict, infallible, and boolean
Eval x Pack partition per field, push each partition into its field,
and prune fields the expression never reads
Eval x RowIdx partition between generated row indices and the data
child, evaluating each independently
Two operators support the row-index rule: `RowIdxValues` generates global
row indices over a domain, and `RowIdxPartition` pairs an independently
evaluated row-index branch with a data branch.
The optimizer becomes top-down, driven from `Eval` nodes. A rewrite can
leave a residual expression above the same operator kind, so the driver
tracks the child it just reduced and does not immediately re-fire the same
rule on that residual. This replaces the bottom-up rewriter, whose two
rules (identity elimination and expression fusion) are subsumed by it.
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012obBhJ8oPZoBbKyeS79yMv
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
joseph-isaacs
force-pushed
the
vortex-plan-optimizer
branch
from
August 7, 2026 16:05
b121a9e to
0e24b8f
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.
Summary
Plan::optimize_expressionhook with static typed parent-child rulesExpressionPlanand every concrete expression rule operate onBoundExpression(ExpressionPlan, StructPlan),(ExpressionPlan, DictPlan),(ExpressionPlan, ChunkedPlan), and(ExpressionPlan, RowIdxPlan)physical-plan optimization does not recursively type-check expressions
StructPlancontaining only referenced fields
StructPlancontinues traversal from that replacement
regression proving an unused struct field is never optimized
Stack
This is part 3 of the plan-native scan stack. It is based on #9196 and is followed by #9187.
Example
Before optimization:
After optimization, the predicates are pushed into
aandb, the residual combines theirboolean outputs, and the rewritten node is
StructPlan({a, b}). Fieldcis absent. No syntheticstruct-partition plan node is introduced.
Safety
referenced fields
Checks
RUSTC_WRAPPER= cargo test -p vortex-layout plan::— 12 passed on this branchRUSTC_WRAPPER= cargo clippy -p vortex-layout --all-targets --all-features -- -D warningscargo +nightly fmt --all -- --checkgit diff --check