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-36124][SQL][WIP] Support subqueries with correlation through set operators #38432

Closed
wants to merge 1 commit into from

Conversation

jchen5
Copy link
Contributor

@jchen5 jchen5 commented Oct 28, 2022

What changes were proposed in this pull request?

Adds support for subquery decorrelation with UNION, INTERSECT, and EXCEPT on the correlation paths. For example:

SELECT t1a, (
  SELECT sum(b) FROM (
    SELECT t2b as b FROM t2 WHERE t2a = t1.t1a
    INTERSECT
    SELECT t3b as b FROM t3 WHERE t3a = t1.t1a
))
FROM t1

Why are the changes needed?

To improve subquery support in Spark.

Does this PR introduce any user-facing change?

Before this change, queries like this would return an error like: Decorrelate inner query through Union is not supported.

After this PR, this query can run successfully.

How was this patch tested?

Unit tests and (WIP) SQL query tests.

@jchen5
Copy link
Contributor Author

jchen5 commented Oct 28, 2022

@allisonwang-db @cloud-fan

@github-actions github-actions bot added the SQL label Oct 28, 2022
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@jchen5
Copy link
Contributor Author

jchen5 commented Oct 31, 2022

This rewrite still needs some work, I found that it is not introducing DomainJoins properly, working on a fix for that.

@jchen5
Copy link
Contributor Author

jchen5 commented Jan 5, 2023

Created a new PR here: #39375

@jchen5 jchen5 closed this Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants