Repository navigation
fix: read partition source columns through PartitionExpr children - #92
Draft
NoahKusaba wants to merge 1 commit into
Draft
NoahKusaba wants to merge 1 commit into
NoahKusaba wants to merge 1 commit into
Conversation
NoahKusaba
force-pushed
the
fix/partition-expr-children
branch
from
October 29, 2026 19:33
4e98604 to
2552390
Compare
14 of 38 tasks
PartitionExpr read its source columns by position in the input batch but reported no children. When ProjectionPushdown merged the partition projection into the projection below it, nothing rewrote those positions, so partition values were computed from the wrong columns. Files landed in the wrong partitions and partition pruning skipped them. PartitionExpr's children are now the table's top-level columns, in table order, and it reads the batch only through them. The optimizer rewrites them like any other column reference. Evaluation lays the children out as the table and still uses iceberg's PartitionValueCalculator. The public `try_new` takes the columns, so a codec passes the decoded children. Closes apache#35
NoahKusaba
force-pushed
the
fix/partition-expr-children
branch
from
November 21, 2026 05:23
0eae2ff to
813e370
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.
Which issue does this PR close?
Rationale for this change
PartitionExprread its source columns by position in the input batch, but reported no children. WhenProjectionPushdownmerged the partition projection into the projection below it, it had no column references to rewrite, so the positions kept pointing at the old layout:partitioned the rows by
column1instead ofcolumn2. Files landed in the wrong partitions, and partition pruning then skipped matching rows:SELECT * FROM t WHERE id = 100returns nothing.What changes are included in this PR?
The table's columns are children.
PartitionExprhas one child per top-level table column, in table order, and reads the batch only through them. The optimizer rewrites them like any other column reference, and EXPLAIN shows the column each partition field reads:Iceberg still computes the values.
evaluatelays the children out as the table and passes them to iceberg'sPartitionValueCalculator, so the transforms and nested sources are handled as before.try_newtakes the columns. A codec passes the decoded children;project_with_partitionpasses its input's columns.with_new_childrenrejects the wrong number of children.Are these changes tested?
Yes.
insert_into::test_insert_into_partitioned_through_reordering_projectionruns theINSERTabove and snapshots the plan, the row count, and a read with a filter on the partition column. Onmainthe read returns no rows.try_newerror.Are there any user-facing changes?
PartitionExpr::try_newtakes a third argument,columns: Vec<Arc<dyn PhysicalExpr>>, one per top-level table column. A codec that rebuilds the expression should pass the decoded children.#19 relaxes the input schema check in
project_with_partition; whichever lands second resolves a small conflict there.AI Disclosure
main.