Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyum committed Oct 1, 2018
1 parent 3439992 commit 6c46ad5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ object AggregateBenchmark extends SqlBasedBenchmark {
override def benchmark(): Unit = {
runBenchmark("aggregate without grouping") {
val N = 500L << 22
runBenchmarkWithCodegen("agg w/o group", N) {
codegenBenchmark("agg w/o group", N) {
spark.range(N).selectExpr("sum(id)").collect()
}
}

runBenchmark("stat functions") {
val N = 100L << 20

runBenchmarkWithCodegen("stddev", N) {
codegenBenchmark("stddev", N) {
spark.range(N).groupBy().agg("id" -> "stddev").collect()
}

runBenchmarkWithCodegen("kurtosis", N) {
codegenBenchmark("kurtosis", N) {
spark.range(N).groupBy().agg("id" -> "kurtosis").collect()
}
}
Expand Down Expand Up @@ -313,7 +313,7 @@ object AggregateBenchmark extends SqlBasedBenchmark {
runBenchmark("cube") {
val N = 5 << 20

runBenchmarkWithCodegen("cube", N) {
codegenBenchmark("cube", N) {
spark.range(N).selectExpr("id", "id % 1000 as k1", "id & 256 as k2")
.cube("k1", "k2").sum("id").collect()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.apache.spark.sql.internal.SQLConf
*/
trait SqlBasedBenchmark extends BenchmarkBase with SQLHelper {

val spark: SparkSession = getSparkSession
protected val spark: SparkSession = getSparkSession

/** Subclass can override this function to build their own SparkSession */
def getSparkSession: SparkSession = {
Expand All @@ -40,7 +40,7 @@ trait SqlBasedBenchmark extends BenchmarkBase with SQLHelper {
}

/** Runs function `f` with whole stage codegen on and off. */
def runBenchmarkWithCodegen(name: String, cardinality: Long)(f: => Unit): Unit = {
final def codegenBenchmark(name: String, cardinality: Long)(f: => Unit): Unit = {
val benchmark = new Benchmark(name, cardinality, output = output)

benchmark.addCase(s"$name wholestage off", numIters = 2) { _ =>
Expand Down

0 comments on commit 6c46ad5

Please sign in to comment.