Julian Hyde created CALCITE-3897:
------------------------------------

             Summary: Windowed aggregate with bracket (ROWS or RANGE) without 
ORDER BY is invalid
                 Key: CALCITE-3897
                 URL: https://issues.apache.org/jira/browse/CALCITE-3897
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


I believe that windowed aggregate with bracket (ROWS or RANGE) without ORDER BY 
is invalid. If so, we should throw.

[~danny0405] 
[reports|https://github.com/apache/calcite/pull/1896#discussion_r403420946] 
that the syntax is invalid on MSSQL 2017.

Someone should check the SQL standard. If it is invalid in the SQL standard 
(but only if) the validator should give an error.

I am a little ambivalent. A missing {{ORDER BY}} is basically sorting by zero 
columns, an of course it's not deterministic, but even with {{ORDER BY}}, the 
ordering may not be deterministic (e.g. apply {{ORDER BY deptno}} to the 
{{Emp}} table). So we should go with the SQL standard.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to