Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18641#discussion_r150839052
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala 
---
    @@ -2158,4 +2158,21 @@ class DataFrameSuite extends QueryTest with 
SharedSQLContext {
         val mean = result.select("DecimalCol").where($"summary" === "mean")
         assert(mean.collect().toSet === 
Set(Row("0.0345678900000000000000000000000000000")))
       }
    +
    +  testQuietly("SPARK-21413: Multiple projections with CASE WHEN fails") {
    +    val schema = StructType(StructField("a", IntegerType) :: Nil)
    +    val df = spark.createDataFrame(sparkContext.parallelize(Seq(Row(1))), 
schema)
    +    val df1 =
    +      df.withColumn("a", when($"a" === 0, null).otherwise($"a"))
    --- End diff --
    
    Sure, the following code can throw an exception
    ```
    ...
        var df1 = df
        for (i <- 1 to 10) {
          df1 = df1.withColumn("a", when($"a" === 0, null).otherwise($"a"))
        }
    ...
    ```


---

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

Reply via email to