coderfender commented on code in PR #2956:
URL: https://github.com/apache/datafusion-comet/pull/2956#discussion_r2640592326
##########
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:
Minor : Would we be needing exec and scan exec for all types of benchmarks
@andygrove ?
--
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]