yhuang-db commented on code in PR #52673:
URL: https://github.com/apache/spark/pull/52673#discussion_r2447044455


##########
sql/core/src/test/scala/org/apache/spark/sql/ApproxTopKSuite.scala:
##########
@@ -702,4 +770,76 @@ class ApproxTopKSuite extends QueryTest with 
SharedSparkSession {
       parameters = Map("size1" -> "10", "size2" -> "20")
     )
   }
+
+  test("SPARK-53960: combine and estimate count NULL values") {
+    sql(
+      """SELECT approx_top_k_accumulate(expr, 10) as acc
+        |FROM VALUES 'a', 'a', 'b', NULL, NULL AS tab(expr)""".stripMargin)
+      .createOrReplaceTempView("accumulation1")
+
+    sql(
+      """SELECT approx_top_k_accumulate(expr, 10) as acc
+        |FROM VALUES 'b', 'b', NULL, NULL AS tab(expr)""".stripMargin)
+      .createOrReplaceTempView("accumulation2")
+
+    sql("SELECT acc from accumulation1 UNION ALL SELECT acc FROM 
accumulation2")
+      .createOrReplaceTempView("unioned")
+
+    sql("SELECT approx_top_k_combine(acc, 20) as com FROM unioned")
+      .createOrReplaceTempView("combined")
+
+    val est = sql("SELECT approx_top_k_estimate(com, 2) FROM combined")
+    checkAnswer(est, Row(Seq(Row(null, 4), Row("b", 3))))
+  }
+
+  test("SPARK-53960: combine with a sketch of all nulls") {

Review Comment:
   Added 
https://github.com/apache/spark/pull/52673/files#diff-6fefa9db05fd13cba298c3e28d85bdb0fca70a3141b64d9fecf3ebc489386257R887



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to