drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victoria Markman (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-3651) Window function should not be allowed in order by clause of over clause of window function
Date Fri, 14 Aug 2015 19:32:45 GMT
Victoria Markman created DRILL-3651:
---------------------------------------

             Summary: Window function should not be allowed in order by clause of over clause
of window function
                 Key: DRILL-3651
                 URL: https://issues.apache.org/jira/browse/DRILL-3651
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
            Reporter: Victoria Markman
            Assignee: Jinfeng Ni
            Priority: Minor


Should not parse and throw an error according to SQL standard.
"ISO/IEC 9075-2:2011(E) 7.11 <window clause>" 
d) If WDX has a window ordering clause, then WDEF shall not specify <window order clause>
(hope I'm reading it correctly)

{code}
SELECT rank() OVER (ORDER BY rank() OVER (ORDER BY c1)) from t1;
{code}

Instead, drill returns result:
{code}
0: jdbc:drill:schema=dfs> SELECT rank() OVER (ORDER BY rank() OVER (ORDER BY c1)) from
t1;
+---------+
| EXPR$0  |
+---------+
| 1       |
| 2       |
| 3       |
| 4       |
| 5       |
| 6       |
| 7       |
| 8       |
| 9       |
| 10      |
+---------+
10 rows selected (0.336 seconds)
{code}

Postgres throws an error in this case:
{code}
postgres=# SELECT rank() OVER (ORDER BY rank() OVER (ORDER BY c1)) from t1;
ERROR:  window functions are not allowed in window definitions
LINE 1: SELECT rank() OVER (ORDER BY rank() OVER (ORDER BY c1)) from...
{code}

Courtesy of postgres test suite.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message