This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 37cb5c90c chore: Improve microbenchmark for string expressions (#2964)
37cb5c90c is described below
commit 37cb5c90ced540b0744b7dd597d6c0c3ccfc10b8
Author: Andy Grove <[email protected]>
AuthorDate: Sat Jan 3 09:27:42 2026 -0700
chore: Improve microbenchmark for string expressions (#2964)
---
.../benchmark/CometStringExpressionBenchmark.scala | 44 ++++++++++++----------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git
a/spark/src/test/scala/org/apache/spark/sql/benchmark/CometStringExpressionBenchmark.scala
b/spark/src/test/scala/org/apache/spark/sql/benchmark/CometStringExpressionBenchmark.scala
index 41eabb851..8f0082bf9 100644
---
a/spark/src/test/scala/org/apache/spark/sql/benchmark/CometStringExpressionBenchmark.scala
+++
b/spark/src/test/scala/org/apache/spark/sql/benchmark/CometStringExpressionBenchmark.scala
@@ -44,22 +44,6 @@ case class StringExprConfig(
// spotless:on
object CometStringExpressionBenchmark extends CometBenchmarkBase {
- /**
- * Generic method to run a string expression benchmark with the given
configuration.
- */
- def runStringExprBenchmark(config: StringExprConfig, values: Int): Unit = {
- withTempPath { dir =>
- withTempTable("parquetV1Table") {
- prepareTable(dir, spark.sql(s"SELECT REPEAT(CAST(value AS STRING),
100) AS c1 FROM $tbl"))
-
- val extraConfigs =
- Map(CometConf.COMET_CASE_CONVERSION_ENABLED.key -> "true") ++
config.extraCometConfigs
-
- runExpressionBenchmark(config.name, values, config.query, extraConfigs)
- }
- }
- }
-
// Configuration for all string expression benchmarks
private val stringExpressions = List(
StringExprConfig("Substring", "select substring(c1, 1, 100) from
parquetV1Table"),
@@ -71,7 +55,16 @@ object CometStringExpressionBenchmark extends
CometBenchmarkBase {
StringExprConfig("chr", "select chr(c1) from parquetV1Table"),
StringExprConfig("initCap", "select initCap(c1) from parquetV1Table"),
StringExprConfig("trim", "select trim(c1) from parquetV1Table"),
+ StringExprConfig("btrim", "select btrim(c1) from parquetV1Table"),
+ StringExprConfig("ltrim", "select ltrim(c1) from parquetV1Table"),
+ StringExprConfig("rtrim", "select rtrim(c1) from parquetV1Table"),
+ StringExprConfig("lpad", "select lpad(c1, 120, 'x') from parquetV1Table"),
+ StringExprConfig("rpad", "select rpad(c1, 120, 'x') from parquetV1Table"),
+ StringExprConfig("concat", "select concat(c1, c1) from parquetV1Table"),
StringExprConfig("concatws", "select concat_ws(' ', c1, c1) from
parquetV1Table"),
+ StringExprConfig("contains", "select contains(c1, '123') from
parquetV1Table"),
+ StringExprConfig("startsWith", "select startswith(c1, '123') from
parquetV1Table"),
+ StringExprConfig("endsWith", "select endswith(c1, '123') from
parquetV1Table"),
StringExprConfig("length", "select length(c1) from parquetV1Table"),
StringExprConfig("repeat", "select repeat(c1, 3) from parquetV1Table"),
StringExprConfig("reverse", "select reverse(c1) from parquetV1Table"),
@@ -81,11 +74,22 @@ object CometStringExpressionBenchmark extends
CometBenchmarkBase {
StringExprConfig("translate", "select translate(c1, '123456', 'aBcDeF')
from parquetV1Table"))
override def runCometBenchmark(mainArgs: Array[String]): Unit = {
- val values = 1024 * 1024;
+ runBenchmarkWithTable("String expressions", 1024) { v =>
+ withTempPath { dir =>
+ withTempTable("parquetV1Table") {
+ prepareTable(
+ dir,
+ spark.sql(s"SELECT REPEAT(CAST(value AS STRING), 10) AS c1 FROM
$tbl"))
+
+ val extraConfigs = Map(CometConf.COMET_CASE_CONVERSION_ENABLED.key
-> "true")
- stringExpressions.foreach { config =>
- runBenchmarkWithTable(config.name, values) { v =>
- runStringExprBenchmark(config, v)
+ stringExpressions.foreach { config =>
+ val allConfigs = extraConfigs ++ config.extraCometConfigs
+ runBenchmark(config.name) {
+ runExpressionBenchmark(config.name, v, config.query, allConfigs)
+ }
+ }
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]