-
Notifications
You must be signed in to change notification settings - Fork 284
feat: CometNativeScan per-partition plan data, add DPP [iceberg] #3446
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
Draft
mbutrovich
wants to merge
45
commits into
apache:main
Choose a base branch
from
mbutrovich:cometnativescan-dpp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+69,321
−67,568
Conversation
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
# Conflicts: # spark/src/main/scala/org/apache/comet/rules/CometScanRule.scala
….sql.execution.SubqueryExec
…Row -> CometNativeExec into SubqueryBroadcast -> CometColumnarToRow -> CometBroadcastExchange -> CometNativeExec - This allows CometBroadcastExchange to be reused by both the SubqueryBroadcast path and the join path - CometColumnarToRowExec is still needed because SubqueryBroadcastExec expects HashedRelation from doExecuteBroadcast()
…SubqueryExec. - New plans.
andygrove
approved these changes
Feb 11, 2026
Member
andygrove
left a comment
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.
Awesome work @mbutrovich! LGTM pending CI. Let's get this merged and keep iterating/testing.
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?
Closes #3442
Rationale for this change
Dynamic Partition Pruning (DPP) is essential for optimizing star schema queries. Previously,
native_datafusionscans would fall back to Spark when DPP was present. This PR enables full DPP support by deferring partition serialization until execution time, after DPP subqueries are resolved.Additionally, this approach reduces serialization overhead when scanning large Parquet datasets, as partition metadata is no longer replicated across all Spark partitions.
What changes are included in this PR?
Architecture:
CometNativeScanExecnow uses lazyserializedPartitionDatato defer serialization to execution timeCometNativeScan.convert()creates a placeholder with only ascan_idat planning timeserializePartitions()resolves DPP subqueries and serializes filtered partitions at executionoriginalPlan.partitionFiltersinstead ofpartitionFiltersbecause AQE'sPlanDynamicPruningFiltersconverts subqueries to literals viamakeCopySubqueryBroadcast Transformation:
SubqueryBroadcastExecchildren to useCometBroadcastExchangeExecwrapped inCometColumnarToRowExecfor row-based outputCometBroadcastExchangeExecused in the join can be reused by the DPP subquery filtertransformUpinstead oftransformUpWithSubqueriesto preserveReusedSubqueryExecobject identity for scalar subqueriesConfiguration:
spark.comet.scan.dpp.enabled(default: true) replacesspark.comet.dppFallback.enabledShims:
getDppFilteredFilePartitions()andgetDppFilteredBucketedFilePartitions()toShimCometScanExecfor Spark 3.4/3.5/4.0resolveSubqueryAdaptiveBroadcast()toShimSubqueryBroadcastSpark Diff Updates:
DynamicPartitionPruningSuite.checkPartitionPruningPredicateto recognizeCometColumnarToRowExec → CometBroadcastExchangeExecas a valid SubqueryBroadcast child structureOther:
equals/hashCodefromCometNativeScanExecto prevent incorrect AQE exchange reuse between scans with different projectionsHow are these changes tested?
CometExecSuitetests for DPP with native_datafusion scans, multiple partition columns, non-broadcast subqueries (SubqueryExec), and subquery reuse (ReusedSubqueryExec)CometIcebergNativeSuitetest for Iceberg DPP with non-broadcast joins