drill-dev 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-1927) Aggregation or Group-By on a CASE expression with IN subquery fails
Date Mon, 05 Jan 2015 17:33:36 GMT
Aman Sinha created DRILL-1927:
---------------------------------

             Summary: Aggregation or Group-By on a CASE expression with IN subquery fails
                 Key: DRILL-1927
                 URL: https://issues.apache.org/jira/browse/DRILL-1927
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 0.7.0
            Reporter: Aman Sinha
            Assignee: Jinfeng Ni


The following queries fail within Calcite and depend on the fix for CALCITE-516.  I am creating
a Drill JIRA such that we can add tests with data verification. 

{code}
select (case when emp.empno in (3) then 0 else 1 end) 
  from emp 
group by (case when emp.empno in (3) then 0 else 1 end);

java.lang.AssertionError: Internal error: while converting CASE WHEN `EMP`.`EMPNO` IN (3)
THEN 0 ELSE 1 END
	at org.eigenbase.util.Util.newInternal(Util.java:750)
	at org.eigenbase.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:93)
	at org.eigenbase.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:52)
	at org.eigenbase.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4093)
	at org.eigenbase.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:1)
	at org.eigenbase.sql.SqlCall.accept(SqlCall.java:125)
	at org.eigenbase.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:3988)
	at org.eigenbase.sql2rel.SqlToRelConverter$AggConverter.addGroupExpr(SqlToRelConverter.java:4314)
	at org.eigenbase.sql2rel.SqlToRelConverter.createAggImpl(SqlToRelConverter.java:2240)
	at org.eigenbase.sql2rel.SqlToRelConverter.convertAgg(SqlToRelConverter.java:2191)
	at org.eigenbase.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:514)
	at org.eigenbase.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:474)
{code}

{code}
   SELECT SUM(CASE WHEN empno IN (3) THEN 0 ELSE 1 END) FROM emp;

java.lang.AssertionError: Internal error: Identifier 'EMP.EMPNO' is not a group expr
	at org.apache.calcite.util.Util.newInternal(Util.java:727)
	at org.apache.calcite.sql2rel.SqlToRelConverter.convertIdentifier(SqlToRelConverter.java:3307)
	at org.apache.calcite.sql2rel.SqlToRelConverter.access$6(SqlToRelConverter.java:3296)
	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4299)
	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:1)
	at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:271)
	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4182)
	at org.apache.calcite.sql2rel.SqlToRelConverter.substituteSubquery(SqlToRelConverter.java:979)
	at org.apache.calcite.sql2rel.SqlToRelConverter.replaceSubqueries(SqlToRelConverter.java:937)
	at org.apache.calcite.sql2rel.SqlToRelConverter.createAggImpl(SqlToRelConverter.java:2685)
	at org.apache.calcite.sql2rel.SqlToRelConverter.convertAgg(SqlToRelConverter.java:2525)
	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:608)
{code}





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

Mime
View raw message