[SPARK-46946][SQL] Supporting broadcast of multiple filtering keys in DynamicPruning #44988
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.
What changes were proposed in this pull request?
This PR extends
DynamicPruningSubquery
to support broadcasting of multiple filtering keys (instead of one as before). The majority of the PR is to simply generalise singularity to plurality.Note: We actually do not use the multiple filtering keys
DynamicPruningSubquery
in this PR, we are doing this to make supporting DPP Null Safe Equality or multiple Equality predicates easier in the future.In Null Safe Equality JOIN, the JOIN condition
a <=> b
is transformed toCoalesce(key1, Literal(key1.dataType)) = Coalesce(key2, Literal(key2.dataType)) AND IsNull(key1) = IsNull(key2)
. In order to have the highest pruning efficiency, we broadcast the 2 keysCoalesce(key, Literal(key.dataType))
andIsNull(key)
and use them to prune the other side at the same time.Before, the
DynamicPruningSubquery
only has one broadcasting key and we only supports DPP for oneEqualTo
JOIN predicate, now we are extending the subquery to multiple broadcasting keys. Please note that DPP has not been supported for multiple JOIN predicates.Put it in another way, at the moment, we don't insert a DPP Filter for multiple JOIN predicates at the same time, only potentially insert a DPP Filter for a given Equality JOIN predicate.
Why are the changes needed?
To make supporting DPP Null Safe Equality or DPP multiple Equality predicates easier in the future.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added unit tests.
Was this patch authored or co-authored using generative AI tooling?
No.