Gautam Kumar Parai created DRILL-4992:
-----------------------------------------

             Summary: Failing query with same case statement in both select and 
order by clause using using hash aggregate
                 Key: DRILL-4992
                 URL: https://issues.apache.org/jira/browse/DRILL-4992
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.8.0, 1.7.0
            Reporter: Gautam Kumar Parai


Queries that contain case statement in both the select and order by clause as a 
sub query. Here is an example of such query:


dummy
+-------------+------------------------+
|   c_date    |      c_timestamp       |
+-------------+------------------------+
| 2015-04-23  | 2014-03-16 03:55:21.0  |
+-------------+------------------------+

alter session set `planner.enable_streamagg` = false;
select distinct a1 from ( select SUM(case when c_timestamp is null then 0 else 
1 end) from dummy group by c_date order by SUM(case when c_timestamp is null 
then 0 else 1 end)) as dt(a1);

Error: UNSUPPORTED_OPERATION ERROR: Hash aggregate does not support schema 
changes
Note that this table is a single table. 
Below is the stacktrace from log file:
{code}
2016-10-31 15:57:45,643 [27e83395-8074-7c94-e318-a6b54176ea9d:frag:0:0] INFO  
o.a.d.e.w.f.FragmentStatusReporter - 27e83395-8074-7c94-e318-a6b54176ea9d:0:0: 
State to report: RUNNING
2016-10-31 15:57:45,665 [27e83395-8074-7c94-e318-a6b54176ea9d:frag:0:0] INFO  
o.a.d.e.p.i.aggregate.HashAggBatch - User Error Occurred
org.apache.drill.common.exceptions.UserException: UNSUPPORTED_OPERATION ERROR: 
Hash aggregate does not support schema changes


[Error Id: ad36df25-3ea8-4c07-87a0-f105b1ce5ae1 ]
        at 
org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:543)
 ~[drill-common-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.physical.impl.aggregate.HashAggBatch.innerNext(HashAggBatch.java:144)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:135)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:104) 
[drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:81)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:94) 
[drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:232)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:226)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at java.security.AccessController.doPrivileged(Native Method) 
[na:1.7.0_67]
        at javax.security.auth.Subject.doAs(Subject.java:415) [na:1.7.0_67]
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1595)
 [hadoop-common-2.7.0-mapr-1607.jar:na]
        at 
org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:226)
 [drill-java-exec-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38) 
[drill-common-1.9.0-SNAPSHOT.jar:1.9.0-SNAPSHOT]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
[na:1.7.0_67]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
[na:1.7.0_67]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
2016-10-31 15:57:45,665 [27e83395-8074-7c94-e318-a6b54176ea9d:frag:0:0] INFO  
o.a.d.e.w.fragment.FragmentExecutor - 27e83395-8074-7c94-e318-a6b54176ea9d:0:0: 
State change requested RUNNING --> FAILED
{code}



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

Reply via email to