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

Antonio Jesus Navarro commented on SPARK-10485:
-----------------------------------------------

Now, the bug is into the checking of the DataTypes:

https://github.com/apache/spark/blob/branch-1.5/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala#L33

else if (trueValue.dataType != falseValue.dataType) {
    TypeCheckResult.TypeCheckFailure(s"differing types in '$prettyString' " +
      s"(${trueValue.dataType.simpleString} and 
${falseValue.dataType.simpleString}).")
}

If the true expression or the false expression is a NullType, now the type 
validation fails.

> IF expression is not correctly resolved when one of the options have NullType
> -----------------------------------------------------------------------------
>
>                 Key: SPARK-10485
>                 URL: https://issues.apache.org/jira/browse/SPARK-10485
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.4.1
>            Reporter: Antonio Jesus Navarro
>
> If we have this query:
> {code}
> SELECT IF(column > 1, 1, NULL) FROM T1
> {code}
> On Spark 1.4.1 we have this:
> {code}
> override lazy val resolved = childrenResolved && trueValue.dataType == 
> falseValue.dataType
> {code}
> So if one of the types is NullType, the if expression is not resolved.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to