feat: CometNativeScan per-partition plan data, add DPP [iceberg]#3446
Closed
mbutrovich wants to merge 45 commits intoapache:mainfrom
Closed
feat: CometNativeScan per-partition plan data, add DPP [iceberg]#3446mbutrovich wants to merge 45 commits intoapache:mainfrom
mbutrovich wants to merge 45 commits intoapache:mainfrom
Conversation
# 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.
Awesome work @mbutrovich! LGTM pending CI. Let's get this merged and keep iterating/testing.
Open
5 tasks
Contributor
Author
|
Closing. See #3510. I will open a smaller follow-up for the first task in a few minutes. |
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?
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