[
https://issues.apache.org/jira/browse/CALCITE-900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14934440#comment-14934440
]
Sean Hsuan-Yi Chu commented on CALCITE-900:
-------------------------------------------
We found out more issues on Drill. For the following two queries. Doing trivial
project check cannot help escape from looping.
{code}
WITH year_total_1
AS (SELECT c.r_regionkey customer_id,
1 year_total
FROM table c
UNION ALL
SELECT c.r_regionkey customer_id,
1 year_total
FROM table c),
year_total_2
AS (SELECT c.c_customer_id customer_id,
1 year_total
FROM table c
UNION ALL
SELECT c.c_customer_id customer_id,
1 year_total
FROM table c)
SELECT t_w_firstyear.customer_id
FROM year_total_1 t_w_firstyear,
year_total_2 t_w_secyear
WHERE t_w_firstyear.year_total = t_w_secyear.year_total
AND t_w_firstyear.year_total > 0 and t_w_secyear.year_total > 0
{code}
{code}
WITH year_total_1
AS (SELECT c.r_regionkey customer_id,
1 year_total
FROM table c
UNION ALL
SELECT c.c_customer_id customer_id,
1 year_total
FROM table c),
year_total_2
AS (SELECT c.r_regionkey customer_id,
1 year_total
FROM table c
UNION ALL
SELECT c.c_customer_id customer_id,
1 year_total
FROM table c)
SELECT t_w_firstyear.customer_id
FROM year_total_1 t_w_firstyear,
year_total_2 t_w_secyear
WHERE t_w_firstyear.year_total = t_w_secyear.year_total
AND t_w_firstyear.year_total > 0 and t_w_secyear.year_total > 0
{code}
And so far, we have not figured out a solution yet. Will try to have a more
general approach for this type of queries.
> ProjectSetOpTransposeRule can be improved when the input is a SetOperator
> with Trivial Project on top
> -----------------------------------------------------------------------------------------------------
>
> Key: CALCITE-900
> URL: https://issues.apache.org/jira/browse/CALCITE-900
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Sean Hsuan-Yi Chu
> Assignee: Julian Hyde
> Attachments: trace.log
>
>
> When SetOperator with Trivial Project on top, pushing this trivial project
> does not necessary. An improvement can be done if we just discard this
> trivial project.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)