Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-888

Overlay window loses PARTITION BY list

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5.0
    • Component/s: None
    • Labels:
      None

      Description

      Having parenthesis around window would produce wrong result. For example,

      select empno, sum(empno) over (w), count(*) over w
      from emp
      window w as (partition by empno order by empno)
      

      Notice that the second select item has parenthesis in the window clause. This query would generate a wrong plan:

      LogicalProject(EMPNO=[$0], $1=[$9], $2=[$10])
        LogicalWindow(window#0=[window(partition {} order by [0] range between UNBOUNDED PRECEDING and CURRENT ROW aggs [SUM($0)])], window#1=[window(partition {0} order by [0] range between UNBOUNDED PRECEDING and CURRENT ROW aggs [COUNT()])])
          LogicalTableScan(table=[[CATALOG, SALES, EMP]])
      

      where we have two windows in the LogicalWindow.

        Activity

        Hide
        seanhychu Sean Hsuan-Yi Chu added a comment -

        Pull request:
        https://github.com/apache/incubator-calcite/pull/134

        Julian Hyde Can you please help review? Thanks!

        Show
        seanhychu Sean Hsuan-Yi Chu added a comment - Pull request: https://github.com/apache/incubator-calcite/pull/134 Julian Hyde Can you please help review? Thanks!
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/aaac1d23 .
        Hide
        jcamachorodriguez Jesus Camacho Rodriguez added a comment -

        Resolved in release 1.5.0 (2015-11-10)

        Show
        jcamachorodriguez Jesus Camacho Rodriguez added a comment - Resolved in release 1.5.0 (2015-11-10)

          People

          • Assignee:
            julianhyde Julian Hyde
            Reporter:
            seanhychu Sean Hsuan-Yi Chu
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development