GitHub user priyankagargnitk opened a pull request: https://github.com/apache/spark/pull/15609
[SPARK-18048][SQL] To make behaviour of If consistent, in case of true expression and false expression are of compatible data types. ## What changes were proposed in this pull request? This change adds a type conversion from false value datatype to true valueâs datatype. Earlier, the expression If(Literal.create(true, BooleanType), Literal.create(identity(1), DateType), Literal.create(identity(2L), TimestampType)) was throwing Exception while the expression If(Literal.create(true, BooleanType), Literal.create(identity(1L), TimestampType), Literal.create(identity(2), DateType)) was working fine. So , if we interchange the true and false expressions, behaviour of the IF expression changes. ## How was this patch tested? Added test case in ConditionalExpressionSuite.scala jira entry for detail: https://issues.apache.org/jira/browse/SPARK-18048 You can merge this pull request into a Git repository by running: $ git pull https://github.com/priyankagargnitk/spark SPARK-18048 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/15609.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #15609 ---- commit 9a8ef85c9e8924a44b4e7d5639f259c950d03a9c Author: prigarg <prig...@adobe.com> Date: 2016-10-24T06:34:58Z [SPARK-18048][SQL] To make behaviour of If consistent, in case of true expression and false expression are of compatible data types. ## What changes were proposed in this pull request? This change adds a type conversion from false value datatype to true valueâs datatype. Earlier, the expression If(Literal.create(true, BooleanType), Literal.create(identity(1), DateType), Literal.create(identity(2L), TimestampType)) was throwing Exception while the expression If(Literal.create(true, BooleanType), Literal.create(identity(1L), TimestampType), Literal.create(identity(2), DateType)) was working fine. So , if we interchange the true and false expressions, behaviour of the IF expression changes. ## How was this patch tested? Added test case in ConditionalExpressionSuite.scala jira entry for detail: https://issues.apache.org/jira/browse/SPARK-18048 ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org