andygrove commented on code in PR #2956:
URL: https://github.com/apache/datafusion-comet/pull/2956#discussion_r2640688669


##########
spark/src/test/scala/org/apache/spark/sql/benchmark/CometBenchmarkBase.scala:
##########
@@ -110,6 +110,52 @@ trait CometBenchmarkBase extends SqlBasedBenchmark {
     benchmark.run()
   }
 
+  /**
+   * Runs an expression benchmark with standard cases: Spark, Comet (Scan), 
Comet (Scan + Exec).
+   * This provides a consistent benchmark structure for expression evaluation.
+   *
+   * @param name
+   *   Benchmark name
+   * @param cardinality
+   *   Number of rows being processed
+   * @param query
+   *   SQL query to benchmark
+   * @param extraCometConfigs
+   *   Additional configurations to apply for Comet cases (optional)
+   */
+  final def runExpressionBenchmark(
+      name: String,
+      cardinality: Long,
+      query: String,
+      extraCometConfigs: Map[String, String] = Map.empty): Unit = {
+    val benchmark = new Benchmark(name, cardinality, output = output)
+
+    benchmark.addCase("Spark") { _ =>
+      withSQLConf(CometConf.COMET_ENABLED.key -> "false") {
+        spark.sql(query).noop()
+      }
+    }
+
+    benchmark.addCase("Comet (Scan)") { _ =>
+      withSQLConf(CometConf.COMET_ENABLED.key -> "true") {
+        spark.sql(query).noop()
+      }
+    }

Review Comment:
   Yes, I only updated expression benchmarks in this PR but will follow up for 
the other ones (shuffle, exec, aggregate) in separate PRs in the future but 
those ones are a little more involved. My short term goal is to add benchmarks 
for all expressions, so wanted to refactor the expression benchmarks before 
doing that.



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