You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Volodymyr Vysotskyi (JIRA)" <ji...@apache.org> on 2018/09/03 12:07:00 UTC

[jira] [Resolved] (CALCITE-2514) Add SqlIdentifier conversion to ITEM operator for dynamic tables in ExtendedExpander

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

Volodymyr Vysotskyi resolved CALCITE-2514.
------------------------------------------
    Resolution: Fixed

Fixed in [d125495|https://github.com/apache/calcite/commit/d12549530c0aeeedbd6b03f5473c15029d93566f].
Thanks, [~arina] for fixing this issue!

> Add SqlIdentifier conversion to ITEM operator for dynamic tables in ExtendedExpander
> ------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2514
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2514
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.17.0
>            Reporter: Arina Ielchiieva
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.18.0
>
>
> {{SqlIdentifier}} is not converted to ITEM operator for dynamic tables in {{ExtendedExpander}} and thus query returns wrong results. Happens when {{isGroupByAlias}} is set to true in SQL conformance.
> Query example:
> {noformat}
> select n_regionkey, max(min(n_nationkey)) over(partition by n_regionkey)
> from (select * from SALES.NATION)
> group by n_regionkey
> {noformat}
> Incorrect logical plan:
> {noformat}
> LogicalProject(N_REGIONKEY=[ITEM($0, 'N_REGIONKEY')], EXPR$1=[MAX($1) OVER (PARTITION BY ITEM($0, 'N_REGIONKEY') RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)])
>   LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
>     LogicalProject(**=[$0], $f1=[ITEM($0, 'N_NATIONKEY')])
>       LogicalProject(**=[$0])
>         LogicalTableScan(table=[[CATALOG, SALES, NATION]])
> {noformat}
> Correct logical plan:
> {noformat}
> LogicalProject(N_REGIONKEY=[$0], EXPR$1=[MAX($1) OVER (PARTITION BY $0 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)])
>   LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
>     LogicalProject(N_REGIONKEY=[ITEM($0, 'N_REGIONKEY')], $f1=[ITEM($0, 'N_NATIONKEY')])
>       LogicalProject(**=[$0])
>         LogicalTableScan(table=[[CATALOG, SALES, NATION]])
> {noformat}



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