You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Arina Ielchiieva (JIRA)" <ji...@apache.org> on 2018/08/31 10:22:00 UTC

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

Arina Ielchiieva created CALCITE-2514:
-----------------------------------------

             Summary: 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
             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)