[ 
https://issues.apache.org/jira/browse/CALCITE-4021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rui Wang updated CALCITE-4021:
------------------------------
    Description: 
For query:

{code:sql}
select name from sales_dept
union 
select name from it_dept
order by mgr

{code}


We could generate a plan based on 
https://issues.apache.org/jira/browse/CALCITE-4017:

{code:java}
EnumerableUnion
    EnumerableProject
        EnumerableSort
           EnumerableTableScan[name="sales_dept"]
    EnumerableProject
        EnumerableSort
           EnumerableTableScan[name="it_dept"]
{code}

So EnumerableUnion should preserve ordering when all input have the same 
collation to make sure result of query is correct.



  was:
For query:

"select name from sales_dept
union 
select name from it_dept
order by mgr"

We could generate a plan based on 
https://issues.apache.org/jira/browse/CALCITE-4017:

{code:java}
EnumerableUnion
    EnumerableProject
        EnumerableSort
           EnumerableTableScan[name="sales_dept"]
    EnumerableProject
        EnumerableSort
           EnumerableTableScan[name="it_dept"]
{code}

So EnumerableUnion should preserve ordering when all input have the same 
collation to make sure result of query is correct.




> EnumerableUnion should preserve ordering when all inputs have the same 
> collation
> --------------------------------------------------------------------------------
>
>                 Key: CALCITE-4021
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4021
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>
> For query:
> {code:sql}
> select name from sales_dept
> union 
> select name from it_dept
> order by mgr
> {code}
> We could generate a plan based on 
> https://issues.apache.org/jira/browse/CALCITE-4017:
> {code:java}
> EnumerableUnion
>     EnumerableProject
>         EnumerableSort
>            EnumerableTableScan[name="sales_dept"]
>     EnumerableProject
>         EnumerableSort
>            EnumerableTableScan[name="it_dept"]
> {code}
> So EnumerableUnion should preserve ordering when all input have the same 
> collation to make sure result of query is correct.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to