vladimirg-db commented on code in PR #46078:
URL: https://github.com/apache/spark/pull/46078#discussion_r1568639177


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/CollationBenchmark.scala:
##########
@@ -85,19 +86,103 @@ abstract class CollationBenchmarkBase extends 
BenchmarkBase {
       utf8Strings.size * 10,
       warmupTime = 10.seconds,
       output = output)
-    collationTypes.foreach(collationType => {
+    collationTypes.foreach { collationType => {
       val collation = CollationFactory.fetchCollation(collationType)
       benchmark.addCase(s"$collationType") { _ =>
-        sublistStrings.foreach(_ =>
-          utf8Strings.foreach(s =>
-            (0 to 10).foreach(_ =>
+        sublistStrings.foreach { _ =>
+          utf8Strings.foreach { s =>
+            (0 to 10).foreach { _ =>
               collation.hashFunction.applyAsLong(s)
-            )
-          )
-        )
+            }
+          }
+        }
+      }
+    }
+    }
+    benchmark.run()
+  }
+
+  def benchmarkUTFStringContains(
+      collationTypes: Seq[String],
+      utf8Strings: Seq[UTF8String]): Unit = {
+    val sublistStrings = utf8Strings
+
+    val benchmark = new Benchmark(
+      "collation unit benchmarks - contains",
+      utf8Strings.size * 10,
+      warmupTime = 10.seconds,
+      output = output)
+    collationTypes.foreach { collationType => {
+      val collation = CollationFactory.fetchCollation(collationType)
+      benchmark.addCase(s"$collationType") { _ =>
+        sublistStrings.foreach { s1 =>
+          utf8Strings.foreach { s =>
+            (0 to 10).foreach { _ =>
+              CollationSupport.Contains.exec(
+                s, s1, 
CollationFactory.collationNameToId(collation.collationName)
+              )
+            }
+          }
+        }
       }
     }
-    )
+    }
+    benchmark.run()
+  }

Review Comment:
   This was a request of [HyukjinKwon](https://github.com/HyukjinKwon) (see his 
comment above)



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