[ https://issues.apache.org/jira/browse/SPARK-18048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15653331#comment-15653331 ]
Wenchen Fan commented on SPARK-18048: ------------------------------------- according to the discussion in the PR, this ticket is invalid, I'm clsoing it. > If expression behaves differently if true and false expression are > interchanged in case of different data types. > ---------------------------------------------------------------------------------------------------------------- > > Key: SPARK-18048 > URL: https://issues.apache.org/jira/browse/SPARK-18048 > Project: Spark > Issue Type: Bug > Components: SQL > Reporter: Priyanka Garg > > If expression behaves differently if true and false expression are > interchanged in case of different data types. > For eg. > checkEvaluation( > If(Literal.create(true, BooleanType), > Literal.create(identity(1), DateType), > Literal.create(identity(2L), TimestampType)), > identity(1)) is throwing error while > checkEvaluation( > If(Literal.create(true, BooleanType), > Literal.create(identity(1L), TimestampType), > Literal.create(identity(2), DateType)), > identity(1L)) works fine. > The reason for the same is that the If expression 's datatype only considers > trueValue.dataType. > Also, > checkEvaluation( > If(Literal.create(true, BooleanType), > Literal.create(identity(1), DateType), > Literal.create(identity(2L), TimestampType)), > identity(1)) > is breaking only in case of Generated mutable Projection and Unsafe > projection. For all other types its working fine. > Either both should work or none should work -- 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