drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aman Sinha (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-2966) HAVING clause with CASE statement with IN predicate causes assertion
Date Tue, 05 May 2015 23:28:00 GMT
Aman Sinha created DRILL-2966:
---------------------------------

             Summary: HAVING clause with CASE statement with IN predicate causes assertion
                 Key: DRILL-2966
                 URL: https://issues.apache.org/jira/browse/DRILL-2966
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 0.9.0
            Reporter: Aman Sinha
            Assignee: Sean Hsuan-Yi Chu
             Fix For: 1.0.0


The following query fails in sql-to-rel conversion: 
{code}
select count(*) from emp 
  group by emp.deptno
  having sum(case when emp.empno in (1, 2, 3) then emp.sal else 0 end) 
     between 10000.0 and 20000.0
{code}

{code}
java.lang.AssertionError: Internal error: while converting CASE WHEN `EMP`.`EMPNO` IN (1,
2, 3) THEN `EMP`.`SAL` ELSE 0 END
	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4058)
	at org.apache.calcite.sql2rel.StandardConvertletTable.convertCase(StandardConvertletTable.java:301)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:87)
	at org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4212)
	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3668)
	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:130)
	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4105)
	at org.apache.calcite.sql2rel.SqlToRelConverter$AggConverter.visit(SqlToRelConverter.java:4483)
	at org.apache.calcite.sql2rel.SqlToRelConverter$AggConverter.visit(SqlToRelConverter.java:4329)
	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:130)
	at org.apache.calcite.sql2rel.SqlToRelConverter$AggConverter.visit(SqlToRelConverter.java:4528)
	at org.apache.calcite.sql2rel.SqlToRelConverter$AggConverter.visit(SqlToRelConverter.java:4329)
	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:130)
	at org.apache.calcite.sql2rel.SqlToRelConverter.createAggImpl(SqlToRelConverter.java:2573)
	at org.apache.calcite.sql2rel.SqlToRelConverter.convertAgg(SqlToRelConverter.java:2510)
{code}

This is dependent on CALCITE-694 . 



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

Mime
View raw message