[ 
https://issues.apache.org/jira/browse/DRILL-6417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16475786#comment-16475786
 ] 

Vitalii Diravka edited comment on DRILL-6417 at 7/11/18 12:39 PM:
------------------------------------------------------------------

Looks like the rule doesn't support UNION DISTINCT:
 
[https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/ProjectSetOpTransposeRule.java#L79]
{code:java}
// cannot push project past a distinct
if (!setOp.all) {
 return;
}


{code}


was (Author: vitalii):
Looks like the rule doesn't support UNION DISTINC:
 
[https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/ProjectSetOpTransposeRule.java#L79]
{code:java}
// cannot push project past a distinct
if (!setOp.all) {
 return;
}


{code}

> Project is not pushed into scan if use subquery with UNION operator
> -------------------------------------------------------------------
>
>                 Key: DRILL-6417
>                 URL: https://issues.apache.org/jira/browse/DRILL-6417
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.14.0
>            Reporter: Anton Gozhiy
>            Priority: Major
>         Attachments: Test_data.tar.gz
>
>
> *Data:*
> Use attached dataset
> *Query:*
> {code:sql}
> explain plan for select id
> from 
>   (select id, part_col, int_col, bool_col, date_col, float_col, time_col, 
> ts_col
>    from dfs.tmp.`DRILL_3855_test_data`
>    where part_col = 'Partition_one' or part_col = 'Partition_two'
>    union
>    select id, part_col, int_col, bool_col, date_col, float_col, time_col, 
> ts_col
>    from dfs.tmp.`DRILL_3855_test_data`
>    where part_col = 'Partition_two' or part_col = 'Partition_three')
> where int_col = 0
> {code}
> *Expected plan:*
> {noformat}
> Scan ... columns=[`part_col`, `id`, `int_col`]
> {noformat}
> *Actual plan:*
> {noformat}
> Scan ... columns=[`part_col`, `id`, `int_col`, `bool_col`, `date_col`, 
> `float_col`, `time_col`, `ts_col`]
> {noformat}
> *Notes:*
> Works as expected if change "union" to "union all"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to