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

Muhammad Gelbana commented on DRILL-5197:
-----------------------------------------

[~sharnyk], how is this applied to the above query ? If I replace the 
{code:sql}THEN `tname`.`full_name`{code} statement with a literal value, the 
query runs without errors. Why is this considered a different case from 
returning a column value ?

> CASE statement fails due to error: Unable to get value vector class for minor 
> type [NULL] and mode [OPTIONAL]
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-5197
>                 URL: https://issues.apache.org/jira/browse/DRILL-5197
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Data Types
>    Affects Versions: 1.9.0
>            Reporter: Muhammad Gelbana
>
> The following query fails for no obvious reason
> {code:sql}
> SELECT
>    CASE
>       WHEN `tname`.`full_name` = 'ABC' 
>       THEN
>          ( 
>          CASE
>             WHEN `tname`.`full_name` = 'ABC' 
>             THEN
>                (
>                   CASE
>                      WHEN `tname`.`full_name` = ' ' 
>                      THEN
>                         (
>                            CASE
>                               WHEN `tname`.`full_name` = 'ABC' 
>                               THEN `tname`.`full_name` 
>                               ELSE NULL 
>                            END
>                         )
>                         ELSE NULL 
>                   END
>                )
>                ELSE NULL 
>          END
>          )
>          WHEN `tname`.`full_name` = 'ABC' 
>          THEN NULL 
>          ELSE NULL 
>    END
> FROM
>    cp.`employee.json` `tname`
> {code}
> If the `THEN `tname`.`full_name`` statements is changed to `THEN 'ABC'` the 
> error does not occur.
> Thrown exception
> {noformat}
> [Error Id: e75fd0fe-132b-4eb4-b2e8-7b34dc39657e on mgelbana-incorta:31010]
>       at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:543)
>  ~[drill-common-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor.sendFinalState(FragmentExecutor.java:293)
>  [drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor.cleanup(FragmentExecutor.java:160)
>  [drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:262)
>  [drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38)
>  [drill-common-1.9.0.jar:1.9.0]
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [na:1.8.0_111]
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [na:1.8.0_111]
>       at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
> Caused by: java.lang.UnsupportedOperationException: Unable to get value 
> vector class for minor type [NULL] and mode [OPTIONAL]
>       at 
> org.apache.drill.exec.expr.BasicTypeHelper.getValueVectorClass(BasicTypeHelper.java:441)
>  ~[vector-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.record.VectorContainer.addOrGet(VectorContainer.java:123)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchema(ProjectRecordBatch.java:463)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:78)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:135)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:104) 
> ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:81)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:94) 
> ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:232)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:226)
>  ~[drill-java-exec-1.9.0.jar:1.9.0]
>       at java.security.AccessController.doPrivileged(Native Method) 
> ~[na:1.8.0_111]
>       at javax.security.auth.Subject.doAs(Subject.java:422) ~[na:1.8.0_111]
>       at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
>  ~[hadoop-common-2.7.1.jar:na]
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:226)
>  [drill-java-exec-1.9.0.jar:1.9.0]
>       ... 4 common frames omitted
> {noformat}



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

Reply via email to