drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victoria Markman (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-3280) Missing OVER clause in window function query results in AssertionError
Date Fri, 11 Sep 2015 17:21:45 GMT

    [ https://issues.apache.org/jira/browse/DRILL-3280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14741179#comment-14741179
] 

Victoria Markman commented on DRILL-3280:
-----------------------------------------

Sean,

Case below should throw an error about rank() function requiring over clause:

{code}
0: jdbc:drill:schema=dfs> select 
. . . . . . . . . . . . >         row_number(),
. . . . . . . . . . . . >         rank() over (order by a1),
. . . . . . . . . . . . >         dense_rank() over(order by a1)
. . . . . . . . . . . . > from 
. . . . . . . . . . . . >         t1
. . . . . . . . . . . . > ;
Error: VALIDATION ERROR: From line 3, column 31 to line 3, column 32: Expression 'a1' is not
being grouped
{code}

If I remove row_number(), query works (it does not need 'group by clause'):
{code}
0: jdbc:drill:schema=dfs> select 
. . . . . . . . . . . . >         --row_number(),
. . . . . . . . . . . . >         rank() over (order by a1),
. . . . . . . . . . . . >         dense_rank() over(order by a1)
. . . . . . . . . . . . > from 
. . . . . . . . . . . . >         t1
. . . . . . . . . . . . > ;
+---------+---------+
| EXPR$0  | EXPR$1  |
+---------+---------+
| 1       | 1       |
| 2       | 2       |
| 3       | 3       |
| 4       | 4       |
| 5       | 5       |
| 6       | 6       |
| 7       | 7       |
| 8       | 8       |
| 9       | 9       |
| 10      | 10      |
+---------+---------+
10 rows selected (0.326 seconds)
{code}

When you I run it by itself, I get a correct error message:
{code}
0: jdbc:drill:schema=dfs> select row_number() from t1;
Error: VALIDATION ERROR: From line 1, column 8 to line 1, column 19: OVER clause is necessary
for window functions
[Error Id: 8324aa8b-758b-4ee3-b6ad-494d4a8e654d on atsqa4-133.qa.lab:31010] (state=,code=0)
{code}

> Missing OVER clause in window function query results in AssertionError
> ----------------------------------------------------------------------
>
>                 Key: DRILL-3280
>                 URL: https://issues.apache.org/jira/browse/DRILL-3280
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: SQL Parser
>    Affects Versions: 1.0.0
>            Reporter: Khurram Faraaz
>            Assignee: Sean Hsuan-Yi Chu
>             Fix For: 1.2.0
>
>
> Missing OVER clause results in AssertionError.
> Instead, we will need an error message that said, "window function call requires an OVER
clause"
> {code}
> 0: jdbc:drill:schema=dfs.tmp> select rank(), cume_dist() over w from `allDataInPrq/0_0_0.parquet`
window w as (partition by col_chr order by col_dbl);
> Error: SYSTEM ERROR: org.apache.drill.exec.work.foreman.ForemanException: Unexpected
exception during fragment initialization: null
> [Error Id: f8675256-eea9-4ca6-859c-4c0b714f27a0 on centos-02.qa.lab:31010] (state=,code=0)
> {code}
> Stack trace from drillbit.log
> {code}
> 2015-06-11 20:50:42,054 [2a860b5d-dd87-087f-3730-bf47a10f5d97:foreman] ERROR o.a.d.c.exceptions.UserException
- SYSTEM ERROR: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception
during fragment initialization: null
> [Error Id: f8675256-eea9-4ca6-859c-4c0b714f27a0 on centos-02.qa.lab:31010]
> org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: org.apache.drill.exec.work.foreman.ForemanException:
Unexpected exception during fragment initialization: null
> [Error Id: f8675256-eea9-4ca6-859c-4c0b714f27a0 on centos-02.qa.lab:31010]
>         at org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:522)
~[drill-common-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:738)
[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:840)
[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:782)
[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) [drill-common-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:784)
[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:893) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:253) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[na:1.7.0_45]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[na:1.7.0_45]
>         at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
> Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception
during fragment initialization: null
>         ... 4 common frames omitted
> Caused by: java.lang.AssertionError: null
>         at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.getRootField(SqlToRelConverter.java:3810)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.adjustInputRef(SqlToRelConverter.java:3139)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.convertIdentifier(SqlToRelConverter.java:3114)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.access$1400(SqlToRelConverter.java:180)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4061)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3489)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:274) ~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:3944)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertSortExpression(SqlToRelConverter.java:3962)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.convertOver(SqlToRelConverter.java:1756)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.access$1000(SqlToRelConverter.java:180)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:3937)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.createAggImpl(SqlToRelConverter.java:2521)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.convertAgg(SqlToRelConverter.java:2342)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:604)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:564)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:2741)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:522)
~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.calcite.prepare.PlannerImpl.convert(PlannerImpl.java:198) ~[calcite-core-1.1.0-drill-r7.jar:1.1.0-drill-r7]
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRel(DefaultSqlHandler.java:246)
~[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:182)
~[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:178)
~[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:904) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:242) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
>         ... 3 common frames omitted
> {code}



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

Mime
View raw message