drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Nadeau (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (DRILL-665) Drill throw NPE or UnsupportedOperationException when case expression contains null value
Date Wed, 28 May 2014 22:16:03 GMT

     [ https://issues.apache.org/jira/browse/DRILL-665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jacques Nadeau resolved DRILL-665.
----------------------------------

    Resolution: Fixed

> Drill throw NPE or UnsupportedOperationException when case expression contains null value
> -----------------------------------------------------------------------------------------
>
>                 Key: DRILL-665
>                 URL: https://issues.apache.org/jira/browse/DRILL-665
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Jinfeng Ni
>            Assignee: Timothy Chen
>         Attachments: DRILL-665-1.patch
>
>
> Hi Tim,
> Per discussion yesterday,  we found Drill will throw NPE or UnsupportedOperationException
when case expression contains null value.  (null value is added for the optional 'else' branch).
 
> Q1:
> select case when n_nationkey < 100 then 100 end from cp.`tpch/nation.parquet`;
> java.lang.NullPointerException
> 	org.apache.drill.exec.planner.logical.DrillOptiq$RexToDrill.visitLiteral(DrillOptiq.java:330)
~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
> ......
> Q2.
> select case when n_nationkey < 100 then n_name end from cp.`tpch/nation.parquet`;
> java.lang.UnsupportedOperationException: Unable to convert the value of null and type
NULL to a Drill constant expression.
> 	org.apache.drill.exec.planner.logical.DrillOptiq$RexToDrill.visitLiteral(DrillOptiq.java:367)
~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
> ......
> Our conclusion is Drill need create proper TypedNullConstant in DrillOptiq when the null
value is associated with regular SQL type, or resolve to proper SQL typed null constant, in
IExpressionTreeMaterializer.visitIfExpression. ( case/if expression requires all the branches
return the type of value).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message