MaxGekk commented on code in PR #48748:
URL: https://github.com/apache/spark/pull/48748#discussion_r1833930335


##########
sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala:
##########
@@ -161,6 +161,267 @@ class SQLQuerySuite extends QueryTest with 
SharedSparkSession with AdaptiveSpark
     }
   }
 
+  private[this] def hexToBytes(s: String): Array[Byte] = {
+    val byteArray = BigInt(s, 16).toByteArray
+    if (byteArray.length > 1 && byteArray(0) == 0) {
+      // remove sign byte for positive numbers if exists
+      byteArray.tail
+    } else {
+      byteArray
+    }
+  }
+
+  test("listagg function") {
+    withTempView("df", "df2") {
+      Seq(("a", "b"), ("a", "c"), ("b", "c"), ("b", "d"), (null, 
null)).toDF("a", "b")
+        .createOrReplaceTempView("df")
+      checkAnswer(
+        sql("select listagg(b) from df group by a"),
+        Row(null) :: Row("bc") :: Row("cd") :: Nil)
+
+      checkAnswer(
+        sql("select string_agg(b) from df group by a"),
+        Row(null) :: Row("bc") :: Row("cd") :: Nil)
+
+      checkAnswer(
+        sql("select listagg(b, null) from df group by a"),
+        Row(null) :: Row("bc") :: Row("cd") :: Nil)

Review Comment:
   > I wrote listagg is non-deterministic and then added tests expecting 
particular order
   
   Defenetly, we should avoid this.



-- 
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