You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "benj (Jira)" <ji...@apache.org> on 2019/10/11 15:17:00 UTC

[jira] [Created] (CALCITE-3402) Allow RANGE with compoud ORDER BY clause

benj created CALCITE-3402:
-----------------------------

             Summary: Allow RANGE with compoud ORDER BY clause
                 Key: CALCITE-3402
                 URL: https://issues.apache.org/jira/browse/CALCITE-3402
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.19.0, 1.18.0
            Reporter: benj


It will be very useful to have the capacity to use compound ORDER BY clause with RANGE
{code:sql}
apache drill (dfs.tmp)> SELECT a
, last_value(c) OVER(PARTITION BY a ORDER BY c, b DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
FROM (SELECT 1 a, 'b' b, 3 c 
      UNION SELECT 2, 'c', 4 
      UNION SELECT 1, 'c', 4
      /* UNION ... */
     ) x;
Error: VALIDATION ERROR: From line 2, column 56 to line 2, column 60: RANGE clause cannot be used with compound ORDER BY clause
{code}
This is possible with some SGBDR like Postgres: [https://www.postgresql.org/docs/9.3/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS]



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