[jira] [Commented] (DRILL-3823) Exception when grouping by case expression and columns array

2016-05-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on DRILL-3823:
---

Github user hsuanyi commented on the pull request:

https://github.com/apache/drill/pull/490#issuecomment-216919724
  
merge this PR with https://github.com/apache/drill/pull/489. So close this 
one.


> Exception when grouping by case expression and columns array
> 
>
> Key: DRILL-3823
> URL: https://issues.apache.org/jira/browse/DRILL-3823
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Affects Versions: 1.1.0, 1.2.0
>Reporter: Victoria Markman
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
> Attachments: t1.csv
>
>
> In drill version 1.2.0:
> {code}
> 0: jdbc:drill:schema=dfs> select 
> . . . . . . . . . . . . > count(*),
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end
> . . . . . . . . . . . . > from
> . . . . . . . . . . . . > `t1.csv`
> . . . . . . . . . . . . > group by
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end;
> Error: SYSTEM ERROR: UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: e4b37748-e81a-41c9-bfbc-e8f60cb43977 on atsqa4-133.qa.lab:31010] 
> (state=,code=0)
> {code}
> drillbit.log
> {code}
> 2015-09-23 00:00:13,947 [29fe1472-1af8-ba17-4184-3bc38da1d372:foreman] ERROR 
> o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:524)
>  ~[drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:742)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:841)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:786)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) 
> [drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:788)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:894) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:255) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_71]
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_71]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
> Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected 
> exception during fragment initialization: Internal error: while converting 
> CASE WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER)
>  END
> ... 4 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: while converting CASE 
> WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER) END
> at org.apache.calcite.util.Util.newInternal(Util.java:792) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:96)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4162)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3595)
>  ~[calcite-core-1.4.0-drill-r2.jar:

[jira] [Commented] (DRILL-3823) Exception when grouping by case expression and columns array

2016-05-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on DRILL-3823:
---

Github user hsuanyi closed the pull request at:

https://github.com/apache/drill/pull/490


> Exception when grouping by case expression and columns array
> 
>
> Key: DRILL-3823
> URL: https://issues.apache.org/jira/browse/DRILL-3823
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Affects Versions: 1.1.0, 1.2.0
>Reporter: Victoria Markman
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
> Attachments: t1.csv
>
>
> In drill version 1.2.0:
> {code}
> 0: jdbc:drill:schema=dfs> select 
> . . . . . . . . . . . . > count(*),
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end
> . . . . . . . . . . . . > from
> . . . . . . . . . . . . > `t1.csv`
> . . . . . . . . . . . . > group by
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end;
> Error: SYSTEM ERROR: UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: e4b37748-e81a-41c9-bfbc-e8f60cb43977 on atsqa4-133.qa.lab:31010] 
> (state=,code=0)
> {code}
> drillbit.log
> {code}
> 2015-09-23 00:00:13,947 [29fe1472-1af8-ba17-4184-3bc38da1d372:foreman] ERROR 
> o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:524)
>  ~[drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:742)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:841)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:786)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) 
> [drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:788)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:894) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:255) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_71]
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_71]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
> Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected 
> exception during fragment initialization: Internal error: while converting 
> CASE WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER)
>  END
> ... 4 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: while converting CASE 
> WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER) END
> at org.apache.calcite.util.Util.newInternal(Util.java:792) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:96)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4162)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3595)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:130) 
> ~[calcite-core-1.4.0-drill

[jira] [Commented] (DRILL-3823) Exception when grouping by case expression and columns array

2016-04-28 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on DRILL-3823:
---

GitHub user hsuanyi opened a pull request:

https://github.com/apache/drill/pull/490

DRILL-3823, DRILL-4507: Add unit tests.



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/hsuanyi/incubator-drill DRILL-3823

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/drill/pull/490.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #490


commit 0ba6056baad9981088195c7809fd0abb93a29c94
Author: hsuanyi 
Date:   2016-04-29T03:58:25Z

DRILL-3823, DRILL-4507: Add unit tests.




> Exception when grouping by case expression and columns array
> 
>
> Key: DRILL-3823
> URL: https://issues.apache.org/jira/browse/DRILL-3823
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Affects Versions: 1.1.0, 1.2.0
>Reporter: Victoria Markman
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
> Attachments: t1.csv
>
>
> In drill version 1.2.0:
> {code}
> 0: jdbc:drill:schema=dfs> select 
> . . . . . . . . . . . . > count(*),
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end
> . . . . . . . . . . . . > from
> . . . . . . . . . . . . > `t1.csv`
> . . . . . . . . . . . . > group by
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end;
> Error: SYSTEM ERROR: UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: e4b37748-e81a-41c9-bfbc-e8f60cb43977 on atsqa4-133.qa.lab:31010] 
> (state=,code=0)
> {code}
> drillbit.log
> {code}
> 2015-09-23 00:00:13,947 [29fe1472-1af8-ba17-4184-3bc38da1d372:foreman] ERROR 
> o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:524)
>  ~[drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:742)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:841)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:786)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) 
> [drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:788)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:894) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:255) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_71]
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_71]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
> Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected 
> exception during fragment initialization: Internal error: while converting 
> CASE WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER)
>  END
> ... 4 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: while converting CASE 
> WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER) END
> at org.apache.calcite.util.Util.newInternal(Util.java:792) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:96)
>  ~[calcite-core-1.4.0-drill-r2.

[jira] [Commented] (DRILL-3823) Exception when grouping by case expression and columns array

2015-10-05 Thread Sean Hsuan-Yi Chu (JIRA)

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

Sean Hsuan-Yi Chu commented on DRILL-3823:
--

[~jni] Can you help review this? 

> Exception when grouping by case expression and columns array
> 
>
> Key: DRILL-3823
> URL: https://issues.apache.org/jira/browse/DRILL-3823
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Affects Versions: 1.1.0, 1.2.0
>Reporter: Victoria Markman
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.3.0
>
> Attachments: t1.csv
>
>
> In drill version 1.2.0:
> {code}
> 0: jdbc:drill:schema=dfs> select 
> . . . . . . . . . . . . > count(*),
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end
> . . . . . . . . . . . . > from
> . . . . . . . . . . . . > `t1.csv`
> . . . . . . . . . . . . > group by
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end;
> Error: SYSTEM ERROR: UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: e4b37748-e81a-41c9-bfbc-e8f60cb43977 on atsqa4-133.qa.lab:31010] 
> (state=,code=0)
> {code}
> drillbit.log
> {code}
> 2015-09-23 00:00:13,947 [29fe1472-1af8-ba17-4184-3bc38da1d372:foreman] ERROR 
> o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:524)
>  ~[drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:742)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:841)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:786)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) 
> [drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:788)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:894) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:255) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_71]
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_71]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
> Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected 
> exception during fragment initialization: Internal error: while converting 
> CASE WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER)
>  END
> ... 4 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: while converting CASE 
> WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER) END
> at org.apache.calcite.util.Util.newInternal(Util.java:792) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:96)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4162)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3595)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:130) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calc

[jira] [Commented] (DRILL-3823) Exception when grouping by case expression and columns array

2015-09-29 Thread Sean Hsuan-Yi Chu (JIRA)

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

Sean Hsuan-Yi Chu commented on DRILL-3823:
--

We have to fix from forked-calcite:
https://github.com/hsuanyi/incubator-calcite/tree/DRILL-3823

(This commit should be merged with [StarColumn] When group-by a column, 
projecting on a star which cannot be expanded at planning time, use ITEM 
operator to wrap this column)

> Exception when grouping by case expression and columns array
> 
>
> Key: DRILL-3823
> URL: https://issues.apache.org/jira/browse/DRILL-3823
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Affects Versions: 1.1.0, 1.2.0
>Reporter: Victoria Markman
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.3.0
>
> Attachments: t1.csv
>
>
> In drill version 1.2.0:
> {code}
> 0: jdbc:drill:schema=dfs> select 
> . . . . . . . . . . . . > count(*),
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end
> . . . . . . . . . . . . > from
> . . . . . . . . . . . . > `t1.csv`
> . . . . . . . . . . . . > group by
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end;
> Error: SYSTEM ERROR: UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: e4b37748-e81a-41c9-bfbc-e8f60cb43977 on atsqa4-133.qa.lab:31010] 
> (state=,code=0)
> {code}
> drillbit.log
> {code}
> 2015-09-23 00:00:13,947 [29fe1472-1af8-ba17-4184-3bc38da1d372:foreman] ERROR 
> o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:524)
>  ~[drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:742)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:841)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:786)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) 
> [drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:788)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:894) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:255) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_71]
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_71]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
> Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected 
> exception during fragment initialization: Internal error: while converting 
> CASE WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER)
>  END
> ... 4 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: while converting CASE 
> WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER) END
> at org.apache.calcite.util.Util.newInternal(Util.java:792) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:96)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4162)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.

[jira] [Commented] (DRILL-3823) Exception when grouping by case expression and columns array

2015-09-22 Thread Sean Hsuan-Yi Chu (JIRA)

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

Sean Hsuan-Yi Chu commented on DRILL-3823:
--

[~jni] Can I work on this issue ?

> Exception when grouping by case expression and columns array
> 
>
> Key: DRILL-3823
> URL: https://issues.apache.org/jira/browse/DRILL-3823
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Affects Versions: 1.1.0, 1.2.0
>Reporter: Victoria Markman
>Assignee: Jinfeng Ni
> Attachments: t1.csv
>
>
> In drill version 1.2.0:
> {code}
> 0: jdbc:drill:schema=dfs> select 
> . . . . . . . . . . . . > count(*),
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end
> . . . . . . . . . . . . > from
> . . . . . . . . . . . . > `t1.csv`
> . . . . . . . . . . . . > group by
> . . . . . . . . . . . . > case when columns[0] = '' then cast(null as 
> integer) else cast(columns[0] as integer) end;
> Error: SYSTEM ERROR: UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: e4b37748-e81a-41c9-bfbc-e8f60cb43977 on atsqa4-133.qa.lab:31010] 
> (state=,code=0)
> {code}
> drillbit.log
> {code}
> 2015-09-23 00:00:13,947 [29fe1472-1af8-ba17-4184-3bc38da1d372:foreman] ERROR 
> o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: 
> UnsupportedOperationException: class org.apache.calcite.sql.SqlLiteral: NULL
> [Error Id: 46bce8a5-048a-4caa-bcfc-9b2326cfd831 on atsqa4-133.qa.lab:31010]
> at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:524)
>  ~[drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:742)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:841)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:786)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) 
> [drill-common-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:788)
>  [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:894) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:255) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_71]
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_71]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
> Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected 
> exception during fragment initialization: Internal error: while converting 
> CASE WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER)
>  END
> ... 4 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: while converting CASE 
> WHEN `t1.csv`.`columns`[0] = '' THEN CAST(NULL AS INTEGER) ELSE 
> CAST(`t1.csv`.`columns`[0] AS INTEGER) END
> at org.apache.calcite.util.Util.newInternal(Util.java:792) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:96)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4162)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3595)
>  ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:130) 
> ~[calcite-core-1.4.0-drill-r2.jar:1.4.0-drill-r2]
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboa