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

Calcite ignores ROWS window frames when there is no ORDER BY clause

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.35.0
    • 1.38.0
    • None

    Description

      When specifying window frame without an ORDER BY clause, Calcite will ignore it and will generate the frame UNBOUNDED PRECEDING to UNBOUNDED FOLLOWING. e.g, calcite will translate

      SELECT sum(x) over(partition by y ROWS between CURRENT ROW and UNBOUNDED FOLLOWING) from t
      

      into

      SELECT sum(x) over(partition by y RANGE between UNBOUNDED FOLLOWING and UNBOUNDED FOLLOWING) from t
      

      There is a comment in the offending code (SqlToRelConverter.java:2207) which states that
      "without ORDER BY, there must be no bracketing" . I've tried to find a specification like that in the SQL 2003 standard, but didn't find anything to that effect.

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              itiels Itiel Sadeh
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: