Skip to content
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

[SPARK-46946][SQL] Supporting broadcast of multiple filtering keys in DynamicPruning #44988

Closed

Conversation

longvu-db
Copy link
Contributor

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 to Coalesce(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 keys Coalesce(key, Literal(key.dataType)) and IsNull(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 one EqualTo 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.

@github-actions github-actions bot added the SQL label Feb 1, 2024
@longvu-db longvu-db changed the title [SQL] Supporting broadcast of multiple filtering keys in DynamicPruning [SPARK - ?][SQL] Supporting broadcast of multiple filtering keys in DynamicPruning Feb 1, 2024
@longvu-db longvu-db changed the title [SPARK - ?][SQL] Supporting broadcast of multiple filtering keys in DynamicPruning [SPARK-?][SQL] Supporting broadcast of multiple filtering keys in DynamicPruning Feb 1, 2024
@longvu-db longvu-db changed the title [SPARK-?][SQL] Supporting broadcast of multiple filtering keys in DynamicPruning [SPARK-46946][SQL] Supporting broadcast of multiple filtering keys in DynamicPruning Feb 1, 2024
@longvu-db
Copy link
Contributor Author

longvu-db commented Feb 2, 2024

All the tests passed, if I understand the process correctly, it would be awesome if someone from Apache Spark can merge this PR :)

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 22e5938 Feb 2, 2024
@longvu-db
Copy link
Contributor Author

Thanks @cloud-fan for kindly merging this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants