You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Abhishek Girish (JIRA)" <ji...@apache.org> on 2017/06/12 21:04:00 UTC
[jira] [Created] (DRILL-5579) Nested cast to boolean fails for
integer values greater than 1
Abhishek Girish created DRILL-5579:
--------------------------------------
Summary: Nested cast to boolean fails for integer values greater than 1
Key: DRILL-5579
URL: https://issues.apache.org/jira/browse/DRILL-5579
Project: Apache Drill
Issue Type: Bug
Components: Execution - Data Types, Query Planning & Optimization
Affects Versions: 1.11.0
Reporter: Abhishek Girish
Assignee: Chunhui Shi
As per Drill's casting rules, integer value 0 when casted to Boolean returns false. All other integers when casted to Boolean should return true.
The following query fails:
{code}
> select cast(cast(345 as int) as boolean) as a from (values(1));
Error: SYSTEM ERROR: IllegalArgumentException: Invalid value for boolean: 345
(java.lang.IllegalArgumentException) Invalid value for boolean: 345
org.apache.drill.exec.expr.BooleanType.get():74
org.apache.drill.exec.test.generated.ProjectorGen10.doSetup():88
org.apache.drill.exec.test.generated.ProjectorGen10.setup():101
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchema():492
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():78
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():135
org.apache.drill.exec.record.AbstractRecordBatch.next():162
org.apache.drill.exec.physical.impl.BaseRootExec.next():104
org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():81
org.apache.drill.exec.physical.impl.BaseRootExec.next():94
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():232
org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():226
java.security.AccessController.doPrivileged():-2
javax.security.auth.Subject.doAs():422
org.apache.hadoop.security.UserGroupInformation.doAs():1595
org.apache.drill.exec.work.fragment.FragmentExecutor.run():226
org.apache.drill.common.SelfCleaningRunnable.run():38
java.util.concurrent.ThreadPoolExecutor.runWorker():1142
java.util.concurrent.ThreadPoolExecutor$Worker.run():617
java.lang.Thread.run():745 (state=,code=0)
{code}
The following query works as expected:
{code}
> select cast(t.a as boolean) from (select cast(345 as int) as a from (values(1)) )t;
+---------+
| EXPR$0 |
+---------+
| true |
+---------+
1 row selected (0.244 seconds)
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)