File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -47,19 +47,19 @@ object AggregateBenchmark extends SqlBasedBenchmark {
4747 override def benchmark (): Unit = {
4848 runBenchmark(" aggregate without grouping" ) {
4949 val N = 500L << 22
50- runBenchmarkWithCodegen (" agg w/o group" , N ) {
50+ codegenBenchmark (" agg w/o group" , N ) {
5151 spark.range(N ).selectExpr(" sum(id)" ).collect()
5252 }
5353 }
5454
5555 runBenchmark(" stat functions" ) {
5656 val N = 100L << 20
5757
58- runBenchmarkWithCodegen (" stddev" , N ) {
58+ codegenBenchmark (" stddev" , N ) {
5959 spark.range(N ).groupBy().agg(" id" -> " stddev" ).collect()
6060 }
6161
62- runBenchmarkWithCodegen (" kurtosis" , N ) {
62+ codegenBenchmark (" kurtosis" , N ) {
6363 spark.range(N ).groupBy().agg(" id" -> " kurtosis" ).collect()
6464 }
6565 }
@@ -313,7 +313,7 @@ object AggregateBenchmark extends SqlBasedBenchmark {
313313 runBenchmark(" cube" ) {
314314 val N = 5 << 20
315315
316- runBenchmarkWithCodegen (" cube" , N ) {
316+ codegenBenchmark (" cube" , N ) {
317317 spark.range(N ).selectExpr(" id" , " id % 1000 as k1" , " id & 256 as k2" )
318318 .cube(" k1" , " k2" ).sum(" id" ).collect()
319319 }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import org.apache.spark.sql.internal.SQLConf
2727 */
2828trait SqlBasedBenchmark extends BenchmarkBase with SQLHelper {
2929
30- val spark : SparkSession = getSparkSession
30+ protected val spark : SparkSession = getSparkSession
3131
3232 /** Subclass can override this function to build their own SparkSession */
3333 def getSparkSession : SparkSession = {
@@ -40,7 +40,7 @@ trait SqlBasedBenchmark extends BenchmarkBase with SQLHelper {
4040 }
4141
4242 /** Runs function `f` with whole stage codegen on and off. */
43- def runBenchmarkWithCodegen (name : String , cardinality : Long )(f : => Unit ): Unit = {
43+ final def codegenBenchmark (name : String , cardinality : Long )(f : => Unit ): Unit = {
4444 val benchmark = new Benchmark (name, cardinality, output = output)
4545
4646 benchmark.addCase(s " $name wholestage off " , numIters = 2 ) { _ =>
You can’t perform that action at this time.
0 commit comments