uros-db commented on code in PR #46078:
URL: https://github.com/apache/spark/pull/46078#discussion_r1568635378
##########
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:
is there a need to switch to braces?
if not, I would say we should try to stay consistent with the formatting -
if the previous version used parentheses, then we should keep everything as it
is
(ditto below)
--
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]