Skip to content

Commit 150e21a

Browse files
committed
save
1 parent 4614e96 commit 150e21a

1 file changed

Lines changed: 7 additions & 28 deletions

File tree

spark/src/test/scala/org/apache/spark/sql/benchmark/CometBenchmarkBase.scala

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,6 @@ trait CometBenchmarkBase extends SqlBasedBenchmark with AdaptiveSparkPlanHelper
9292
}
9393
}
9494

95-
/** Runs function `f` with Comet on and off. */
96-
final def runWithComet(name: String, cardinality: Long)(f: => Unit): Unit = {
97-
val benchmark = new Benchmark(name, cardinality, output = output)
98-
99-
benchmark.addCase(s"$name - Spark ") { _ =>
100-
withSQLConf(CometConf.COMET_ENABLED.key -> "false") {
101-
f
102-
}
103-
}
104-
105-
benchmark.addCase(s"$name - Comet") { _ =>
106-
withSQLConf(
107-
CometConf.COMET_ENABLED.key -> "true",
108-
CometConf.COMET_EXEC_ENABLED.key -> "true",
109-
SQLConf.ANSI_ENABLED.key -> "false") {
110-
f
111-
}
112-
}
113-
114-
benchmark.run()
115-
}
116-
11795
/**
11896
* Runs an expression benchmark with standard cases: Spark, Comet (Scan), Comet (Scan + Exec).
11997
* This provides a consistent benchmark structure for expression evaluation.
@@ -153,15 +131,10 @@ trait CometBenchmarkBase extends SqlBasedBenchmark with AdaptiveSparkPlanHelper
153131
CometConf.COMET_EXEC_ENABLED.key -> "true",
154132
"spark.sql.optimizer.constantFolding.enabled" -> "false") ++ extraCometConfigs
155133

156-
benchmark.addCase("Comet (Scan + Exec)") { _ =>
157-
withSQLConf(cometExecConfigs.toSeq: _*) {
158-
spark.sql(query).noop()
159-
}
160-
}
161-
162134
// Check that the plan is fully Comet native before running the benchmark
163135
withSQLConf(cometExecConfigs.toSeq: _*) {
164136
val df = spark.sql(query)
137+
df.noop()
165138
val plan = stripAQEPlan(df.queryExecution.executedPlan)
166139
findFirstNonCometOperator(plan) match {
167140
case Some(op) =>
@@ -181,6 +154,12 @@ trait CometBenchmarkBase extends SqlBasedBenchmark with AdaptiveSparkPlanHelper
181154
}
182155
}
183156

157+
benchmark.addCase("Comet (Scan + Exec)") { _ =>
158+
withSQLConf(cometExecConfigs.toSeq: _*) {
159+
spark.sql(query).noop()
160+
}
161+
}
162+
184163
benchmark.run()
185164
}
186165

0 commit comments

Comments
 (0)