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

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

[~sharnyk], [~khfaraaz]
Now I'm facing the same problem with a parquet file but the casting solution 
isn't working as expected. The weird part is that the following query against 
parquet doesn't fail if it's limited to 0 results (i.e. LIMIT 0) while 
unlimiting the query or limiting it to 1 or more rows causes the query to fail.

That's opposite to what happens if the query mentioned in this issue 
description is limited, as the query always fails. Whether it's limited or not.

Could this be due to a specific nature of the data contained by the parquet 
file ? I understand that the problem occurs before Drill knowing anything about 
the data it's about to read.

This is the query that we run against the parquet file (i.e. after changing the 
table and columns names)
{code:sql}
SELECT CASE
         WHEN (
               CASE
                  WHEN `mytable`.`column_1` = ' '
                  THEN
                     (
                     CASE
                        WHEN `mytable`.`column_1` = 'XYZ'
                        THEN CAST(`mytable`.`column_1` AS VARCHAR)
                        ELSE NULL
                        END
                     ) 
                     ELSE NULL
                     END
               ) <> 'ABC'
      THEN CAST(`mytable`.`column_2` AS DOUBLE) 
      WHEN `mytable`.`column_3` = 0
      THEN NULL
      ELSE NULL
   END
 `CASE_RESULT` 
FROM
   dfs.`/home/mgelbana/workspace/Parquet/mytable` `mytable` LIMIT 1
{code}

> 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