-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
[WIP][SPARK-24497][SQL] Support recursive SQL query #29210
[WIP][SPARK-24497][SQL] Support recursive SQL query #29210
Conversation
This is the static version of #23531 which means this PR doesn't do adaptive replanning in each recursive iteration, but the advantage is that the implementation comes with simplified code. Common relational DB implementations don't do replanning either. @maropu this is very close to what you suggested before, if you have some time please review. @maryannxue I think we can add adaptive support in a follow-up PR if needed. |
Test build #126431 has finished for PR 29210 at commit
|
The simpler design as a first step looks fine to me. Anyone preferring the adaptive one for this? I think we need to choose which approach to take first. @maryannxue @viirya @gatorsmile @viirya |
…497-recursive-sql-static
Test build #126490 has finished for PR 29210 at commit
|
|
||
CREATE TEMPORARY VIEW t AS SELECT * FROM VALUES 0, 1, 2 AS t(id); | ||
|
||
-- fails due to recursion isn't allowed with RECURSIVE keyword |
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.
without RECURSIVE ?
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.
Thanks @manuzhang. Fixed.
Test build #128152 has finished for PR 29210 at commit
|
retest this please |
Test build #128162 has finished for PR 29210 at commit
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #134884 has finished for PR 29210 at commit
|
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #134890 has finished for PR 29210 at commit
|
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #134933 has finished for PR 29210 at commit
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
I'm happy to update this PR if anyone is willing to review it. Just let me know... |
I would like to see recursive queries - why did this not go through? Is there an alternative? |
Pinging this to ensure it doesn't fall through the cracks. I'm currently hitting the common use case of wanting to create a materialized path from an adjacency list, and not having recursive queries built into Spark makes this more painful and less performant. |
Another +1, ran into a use case where recursive queries were needed and alternate technology was utilized to solve because it was not available in Spark SQL. |
Thanks for the feedback. I will try to rebase this PR on the latest |
Sorry guys, this is unlikely to land in Spark 3.4, maybe in 3.5... |
@peter-toth Could you rebase this PR on the master branch. I have removed the Stale tag. |
@wangyum, unfortunately this is a very old PR and a lots of changes are needed to make it work on the latest Spark. Let me close the PR for now and reopen once I have a working solution. |
This PR is rebased on latest |
What changes were proposed in this pull request?
This PR adds recursive query feature to Spark SQL.
A recursive query is defined using the
WITH RECURSIVE
keywords and referring the name of the common table expression within the query.The implementation complies with SQL standard and follows similar rules to other relational databases:
UNION
orUNION ALL
operators.Please see
cte-recursive.sql
andwith.sql
for some examples.Please note that this PR focuses on the minimal working implementation which means:
Why are the changes needed?
Recursive query is an ANSI SQL feature that is useful to process hierarchical data.
Does this PR introduce any user-facing change?
Yes, adds recursive query feature.
How was this patch tested?
Added new UTs and tests in
cte-recursion.sql
andwith.sql
.