Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19752#discussion_r153080028
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
---
@@ -2126,4 +2126,17 @@ class DataFrameSuite extends QueryTest with
SharedSQLContext {
val mean = result.select("DecimalCol").where($"summary" === "mean")
assert(mean.collect().toSet ===
Set(Row("0.0345678900000000000000000000000000000")))
}
+
+ test("SPARK-22520: support code generation for large CaseWhen") {
+ val N = 30
+ var expr1 = when($"id" === lit(0), 0)
+ var expr2 = when($"id" === lit(0), 10)
+ (1 to N).foreach { i =>
+ expr1 = expr1.when($"id" === lit(i), -i)
+ expr2 = expr2.when($"id" === lit(i + 10), i)
+ }
+ val df = spark.range(1).select(expr1, expr2.otherwise(0))
+ df.show
--- End diff --
compare the results?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]