uros-db commented on code in PR #47503:
URL: https://github.com/apache/spark/pull/47503#discussion_r1698813196
##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSQLExpressionsSuite.scala:
##########
@@ -2319,6 +2319,44 @@ class CollationSQLExpressionsSuite
)
}
+ test("Support HyperLogLogPlusPlus expression with collation") {
+
+ case class HyperLogLogPlusPlusTestCase(
+ collation: String,
+ input: Seq[String],
+ output: Seq[Row]
+ )
+
+ val testCases = Seq(
+ HyperLogLogPlusPlusTestCase("utf8_binary", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(10))),
+ HyperLogLogPlusPlusTestCase("utf8_lcase", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(5))),
+ HyperLogLogPlusPlusTestCase("UNICODE", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(10))),
+ HyperLogLogPlusPlusTestCase("UNICODE_CI", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(5)))
+ )
+
+ testCases.foreach( t => {
Review Comment:
let's add a comment here:
`// Using explicit collate clause.`
##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSQLExpressionsSuite.scala:
##########
@@ -2319,6 +2319,44 @@ class CollationSQLExpressionsSuite
)
}
+ test("Support HyperLogLogPlusPlus expression with collation") {
+
+ case class HyperLogLogPlusPlusTestCase(
+ collation: String,
+ input: Seq[String],
+ output: Seq[Row]
+ )
+
+ val testCases = Seq(
+ HyperLogLogPlusPlusTestCase("utf8_binary", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(10))),
+ HyperLogLogPlusPlusTestCase("utf8_lcase", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(5))),
+ HyperLogLogPlusPlusTestCase("UNICODE", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(10))),
+ HyperLogLogPlusPlusTestCase("UNICODE_CI", Seq("a", "a", "A", "z", "zz",
"ZZ", "w", "AA",
+ "aA", "Aa", "aa"), Seq(Row(5)))
+ )
+
+ testCases.foreach( t => {
+ val query =
+ s"""
+ |SELECT approx_count_distinct(col) FROM VALUES
+ |${t.input.map(s => s"('${s}' collate ${t.collation})").mkString(",
") } tab(col)
+ |""".stripMargin
+ checkAnswer(sql(query), t.output)
+
+ withSQLConf(SqlApiConf.DEFAULT_COLLATION -> t.collation) {
Review Comment:
let's add a comment here:
`// Using default collation.`
--
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]