Github user dongjoon-hyun commented on the issue:

    https://github.com/apache/spark/pull/21848
  
    Since this skips the evaluation of `if` condition, this will cause the 
following difference.
    
    **This PR**
    ```
    scala> sql("select * from t").show
    +----+
    |   a|
    +----+
    |   1|
    |null|
    +----+
    
    scala> sql("select if(assert_true(a is null),a,a) from t").show
    +-----------------------------------------------------+
    |(IF(CAST(assert_true((a IS NULL)) AS BOOLEAN), a, a))|
    +-----------------------------------------------------+
    |                                                    1|
    |                                                 null|
    +-----------------------------------------------------+
    ```
    
    **Spark 2.3.1**
    ```
    scala> sql("select * from t").show
    +----+
    |   a|
    +----+
    |   1|
    |null|
    +----+
    
    scala> sql("select if(assert_true(a is null),a,a) from t").show
    18/07/23 11:59:11 ERROR Executor: Exception in task 0.0 in stage 20.0 (TID 
20)
    java.lang.RuntimeException: 'isnull(input[0, int, true])' is not true!
    ```


---

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

Reply via email to