andygrove commented on code in PR #2907:
URL: https://github.com/apache/datafusion-comet/pull/2907#discussion_r2617655876
##########
spark/src/test/scala/org/apache/spark/sql/benchmark/CometStringExpressionBenchmark.scala:
##########
@@ -512,105 +85,33 @@ object CometStringExpressionBenchmark extends
CometBenchmarkBase {
}
}
- def translateExprBenchmark(values: Int): Unit = {
- val benchmark = new Benchmark("Expr translate", values, output = output)
-
- withTempPath { dir =>
- withTempTable("parquetV1Table") {
- prepareTable(dir, spark.sql(s"SELECT REPEAT(CAST(value AS STRING),
100) AS c1 FROM $tbl"))
-
- benchmark.addCase("SQL Parquet - Spark") { _ =>
- spark.sql("select translate(c1, '123456', 'aBcDeF') from
parquetV1Table").noop()
- }
-
- benchmark.addCase("SQL Parquet - Comet (Scan)") { _ =>
- withSQLConf(CometConf.COMET_ENABLED.key -> "true") {
- spark.sql("select translate(c1, '123456', 'aBcDeF') from
parquetV1Table").noop()
- }
- }
-
- benchmark.addCase("SQL Parquet - Comet (Scan, Exec)") { _ =>
- withSQLConf(
- CometConf.COMET_ENABLED.key -> "true",
- CometConf.COMET_EXEC_ENABLED.key -> "true") {
- spark.sql("select translate(c1, '123456', 'aBcDeF') from
parquetV1Table").noop()
- }
- }
-
- benchmark.run()
- }
- }
- }
+ // Configuration for all string expression benchmarks
+ private val stringExpressions = List(
+ StringExprConfig("Substring", "select substring(c1, 1, 100) from
parquetV1Table"),
+ StringExprConfig("ascii", "select ascii(c1) from parquetV1Table"),
+ StringExprConfig("bitLength", "select bit_length(c1) from parquetV1Table"),
+ StringExprConfig("octet_length", "select octet_length(c1) from
parquetV1Table"),
+ StringExprConfig("upper", "select upper(c1) from parquetV1Table"),
+ StringExprConfig("lower", "select lower(c1) from parquetV1Table"),
+ StringExprConfig("chr", "select chr(c1) from parquetV1Table"),
+ StringExprConfig("initCap", "select initCap(c1) from parquetV1Table"),
+ StringExprConfig("trim", "select trim(c1) from parquetV1Table"),
+ StringExprConfig("concatws", "select concat_ws(' ', c1, c1) from
parquetV1Table"),
+ StringExprConfig("length", "select length(c1) from parquetV1Table"),
+ StringExprConfig("repeat", "select repeat(c1, 3) from parquetV1Table"),
+ StringExprConfig("reverse", "select reverse(c1) from parquetV1Table"),
+ StringExprConfig("instr", "select instr(c1, '123') from parquetV1Table"),
+ StringExprConfig("replace", "select replace(c1, '123', 'ab') from
parquetV1Table"),
+ StringExprConfig("space", "select space(2) from parquetV1Table"),
+ StringExprConfig("translate", "select translate(c1, '123456', 'aBcDeF')
from parquetV1Table"))
Review Comment:
This is how the benchmarks are defined now. Each line here replaces ~20
lines in the original version.
--
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]