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

support common table expression (CTE) #17472

Closed
zz-jason opened this issue May 28, 2020 · 6 comments · Fixed by #34574 or #36352
Closed

support common table expression (CTE) #17472

zz-jason opened this issue May 28, 2020 · 6 comments · Fixed by #34574 or #36352
Assignees
Labels
feature/accepted This feature request is accepted by product managers priority/P1 The issue has P1 priority. sig/execution SIG execution type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@zz-jason
Copy link
Member

zz-jason commented May 28, 2020

Description

Is your feature request related to a problem? Please describe:

Related issues:

Describe the feature you'd like:

Support the common table expression feature like MySQL 13.2.15 WITH (Common Table Expressions):

A common table expression (CTE) is a named temporary result set that exists within the scope of a single statement and that can be referred to later within that statement, possibly multiple times. The following discussion describes how to write statements that use CTEs.

There are two kinds of CTEs:

  • non-recursive CTE
  • recursive CTE

A typical query example of non-recursive CTE:

WITH
  cte1 AS (SELECT a, b FROM table1),
  cte2 AS (SELECT c, d FROM table2)
SELECT b, d FROM cte1 JOIN cte2
WHERE cte1.a = cte2.c;

A typical query example of recursive CTE:

WITH RECURSIVE cte (n) AS
(
  SELECT 1
  UNION ALL
  SELECT n + 1 FROM cte WHERE n < 5
)
SELECT * FROM cte;
@zz-jason zz-jason added sig/execution SIG execution type/feature-request Categorizes issue or PR as related to a new feature. labels May 28, 2020
@scsldb scsldb added the priority/P1 The issue has P1 priority. label Jun 12, 2020
@scsldb scsldb added this to the v5.0-alpha.1 milestone Jun 12, 2020
@pingyu
Copy link
Contributor

pingyu commented Jun 16, 2020

Let me try...

@pingyu
Copy link
Contributor

pingyu commented Jun 17, 2020

Find these:

@SunRunAway SunRunAway changed the title support common table expression support common table expression (CTE) Jul 5, 2020
@scsldb scsldb modified the milestones: v5.0.0-alpha.1, pools Jul 15, 2020
@ghost ghost mentioned this issue Jul 23, 2020
@zz-jason zz-jason added the feature/accepted This feature request is accepted by product managers label Jul 29, 2020
@ghost ghost mentioned this issue Sep 10, 2020
70 tasks
@tisonkun
Copy link
Contributor

tisonkun commented Apr 22, 2021

Here is the link to weekly report of CTE development: https://docs.google.com/document/d/1b-nL0c2akLL03ZhXXcQT6tj_tqQMmfAE8oKSfcaaDqE

@morgo
Copy link
Contributor

morgo commented Jun 11, 2021

@wjhuang2016 should we close this issue now since CTEs are in master?

@tisonkun
Copy link
Contributor

tisonkun commented Jun 11, 2021

@wjhuang2016 should we close this issue now since CTEs are in master?

A feature implemented without design doc #24147 merged 😂

@wjhuang2016
Copy link
Member

The design doc is merged. So I close it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers priority/P1 The issue has P1 priority. sig/execution SIG execution type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
6 participants