You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Andrei Sereda (Jira)" <ji...@apache.org> on 2020/08/22 22:25:00 UTC
[jira] [Closed] (CALCITE-4133) Shouldn't trim fields when it's
under Union
[ https://issues.apache.org/jira/browse/CALCITE-4133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrei Sereda closed CALCITE-4133.
----------------------------------
> Shouldn't trim fields when it's under Union
> -------------------------------------------
>
> Key: CALCITE-4133
> URL: https://issues.apache.org/jira/browse/CALCITE-4133
> Project: Calcite
> Issue Type: Bug
> Reporter: Jiatao Tao
> Assignee: Jiatao Tao
> Priority: Major
> Fix For: 1.25.0
>
>
> Consider case like this:
>
> {code:java}
> String sql =
> "select \n"
> + " gender, \n"
> + " count(*) \n"
> + "from \n"
> + "(\n"
> + " (select gender, empno from EMPS) \n"
> + " union \n"
> + " (select gender, empno from EMPS)\n"
> + ") group by gender";
> {code}
> And the plan is:
>
> {code:java}
> EnumerableAggregate(group=[{0}], EXPR$1=[COUNT()])
> EnumerableUnion(all=[false])
> EnumerableProject(GENDER=[$3])
> EnumerableTableScan(table=[[SALES, EMPS]])
> EnumerableProject(GENDER=[$3])
> EnumerableTableScan(table=[[SALES, EMPS]])
> {code}
>
> The col empno has been trimmed, this changes the semantics cuz union will distinct values.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)