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


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/CollationBenchmark.scala:
##########
@@ -185,6 +185,48 @@ abstract class CollationBenchmarkBase extends 
BenchmarkBase {
     }
     benchmark.run(relativeTime = true)
   }
+
+  def benchmarkInitCap(
+      collationTypes: Seq[String],
+      utf8Strings: Seq[UTF8String]): Unit = {
+    type collationType = Int
+    type InitCapEstimator = (UTF8String, collationType) => Unit
+    def skipCollationTypeFilter: Any => Boolean = _ => true
+    def createBenchmark(
+        implName: String,
+        impl: InitCapEstimator,
+        collationTypeFilter: String => Boolean): Unit = {
+      val benchmark = new Benchmark(
+        s"collation unit benchmarks - initCap using impl ${implName}",

Review Comment:
   nit: the enclosing braces are redundant:
   ```suggestion
           s"collation unit benchmarks - initCap using $implName",
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/CollationBenchmark.scala:
##########
@@ -185,6 +185,48 @@ abstract class CollationBenchmarkBase extends 
BenchmarkBase {
     }
     benchmark.run(relativeTime = true)
   }
+
+  def benchmarkInitCap(
+      collationTypes: Seq[String],
+      utf8Strings: Seq[UTF8String]): Unit = {
+    type collationType = Int

Review Comment:
   It is a collation id, and types should begin from an upper case letter.



##########
sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/CollationBenchmark.scala:
##########
@@ -185,6 +185,48 @@ abstract class CollationBenchmarkBase extends 
BenchmarkBase {
     }
     benchmark.run(relativeTime = true)
   }
+
+  def benchmarkInitCap(
+      collationTypes: Seq[String],
+      utf8Strings: Seq[UTF8String]): Unit = {
+    type collationType = Int
+    type InitCapEstimator = (UTF8String, collationType) => Unit
+    def skipCollationTypeFilter: Any => Boolean = _ => true
+    def createBenchmark(
+        implName: String,
+        impl: InitCapEstimator,
+        collationTypeFilter: String => Boolean): Unit = {
+      val benchmark = new Benchmark(
+        s"collation unit benchmarks - initCap using impl ${implName}",
+        utf8Strings.size * 10,
+        warmupTime = 10.seconds,
+        output = output)
+      collationTypes.filter(collationTypeFilter).foreach { collationType => {
+        val collationId = CollationFactory.collationNameToId(collationType)
+        benchmark.addCase(s"$collationType") { _ =>

Review Comment:
   nit:
   ```suggestion
           benchmark.addCase(collationType) { _ =>
   ```



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