[
https://issues.apache.org/jira/browse/TAJO-1406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14484524#comment-14484524
]
Seungun Choe commented on TAJO-1406:
------------------------------------
To solve the with clause, I think the best way is to use a temporary table.
However, this method have many things to consider.
Query-Stage-Task-TaskAtmp sequence is changed
Query-Stage1-Stage2-Task-TaskAtmp, and stage1,2 have their's Task and TaskAtmp.
This goes against Tajo's idea to solve queries.
And we need to discuss how to do this show on the web.
This issue should be considered as also scalar subquery.
To fully resolve this problem requires a considerable amount of time.
So I first, query which included with clauses solve replace instead of with
clause's alias table name.
{code}
<ex>
origin: with a as (select * from table1) select * from table2 b join a on
b.id=a.id;
replae: select * from table2 b join (select * from table1) a on b.id=a.id;
{code}
After, I proposed method tries to resolve above.
How about your idea?
> Support WITH clause without RECURSIVE
> -------------------------------------
>
> Key: TAJO-1406
> URL: https://issues.apache.org/jira/browse/TAJO-1406
> Project: Tajo
> Issue Type: New Feature
> Components: parser, planner/optimizer
> Reporter: Dongjoon Hyun
> Assignee: Seungun Choe
>
> WITH clause is widely used expression in SQL language, for e.g., TPC-DS Q1,
> Q2, Q4, Q5, Q11, Q14, Q23, Q24, Q30, Q31, Q33, Q39, Q47, Q51, Q54, Q56, Q57,
> Q58, Q59, Q60, Q64, Q74, Q75, Q77, Q78, Q80, Q81, Q83, Q95, Q97.
> Refer the following queries in
> http://www.postgresql.org/docs/9.4/static/queries-with.html.
> {code:sql}
> WITH regional_sales AS (
> SELECT region, SUM(amount) AS total_sales
> FROM orders
> GROUP BY region
> ), top_regions AS (
> SELECT region
> FROM regional_sales
> WHERE total_sales > (SELECT SUM(total_sales)/10 FROM regional_sales)
> )
> SELECT region,
> product,
> SUM(quantity) AS product_units,
> SUM(amount) AS product_sales
> FROM orders
> WHERE region IN (SELECT region FROM top_regions)
> GROUP BY region, product;
> {code}
> In this issue, WITH RECURSIVE does not support. It should be handled as a
> separate issue.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)