-
Notifications
You must be signed in to change notification settings - Fork 532
Skip partition pruning for manifests whose spec references a dropped source column #2845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,9 +175,23 @@ impl PlanContext { | |
| .await | ||
| } | ||
|
|
||
| /// Returns the partition filter for a manifest, or an always-true filter when the | ||
| /// manifest's spec cannot be resolved against the snapshot schema. Files of such | ||
| /// manifests are not partition-pruned but still receive the row filter. | ||
| fn get_partition_filter(&self, manifest_file: &ManifestFile) -> Result<Arc<BoundPredicate>> { | ||
| let partition_spec_id = manifest_file.partition_spec_id; | ||
|
|
||
| // Historical specs may reference source columns that were later dropped from the | ||
| // schema, in which case the partition type cannot be resolved. A missing spec is | ||
| // reported by the partition filter cache instead. | ||
| let resolvable = self | ||
| .table_metadata | ||
| .partition_spec_by_id(partition_spec_id) | ||
| .is_none_or(|spec| spec.partition_type(&self.snapshot_schema).is_ok()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (non-blocking, efficiency): this resolvability check computes |
||
| if !resolvable { | ||
| return Ok(Arc::new(BoundPredicate::AlwaysTrue)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (non-blocking): a |
||
| } | ||
|
|
||
| let partition_filter = self.partition_filter_cache.get( | ||
| partition_spec_id, | ||
| &self.table_metadata, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up (non-blocking, coverage): this
constants_mapbranch isn't reached by the native scan flow today —FileScanTaskis built withwith_partition_spec(None)(scan/context.rs, with aTODO: Pass actual PartitionSpec through context chain), andpipeline.rsonly callswith_partitionwhen the spec isSome. So this change is a reasonable forward-looking guard, but it's currently unexercised (the new scan test usesNone). A direct unit test here — mirroring the existingwith_partitiontests in this file — would prevent a future refactor that threads the spec through from silently reintroducing the panic.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. I have filed followup to fix these #2869
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do pass PartitionSpec thru the context chain. It happened last week in this PR: #2695
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah you're right, I missed #2695, the spec is threaded through now, so this is a live-path fix, not the forward-looking guard, thanks for the pointer. test's covered in #2869.