Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-25581][SQL] Rename method benchmark as runBenchmarkSuite in BenchmarkBase #22599

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ import java.io.{File, FileOutputStream, OutputStream}
abstract class BenchmarkBase {
var output: Option[OutputStream] = None

def benchmark(): Unit
/**
* Main process of the whole benchmark.
* Implementations of this method are supposed to use the wrapper method `runBenchmark`
* for each benchmark scenario.
*/
def runBenchmarkSuite(): Unit

final def runBenchmark(benchmarkName: String)(func: => Any): Unit = {
val separator = "=" * 96
Expand All @@ -46,7 +51,7 @@ abstract class BenchmarkBase {
output = Some(new FileOutputStream(file))
}

benchmark()
runBenchmarkSuite()

output.foreach { o =>
if (o != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
*/
object UDTSerializationBenchmark extends BenchmarkBase {

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {

runBenchmark("VectorUDT de/serialization") {
val iters = 1e2.toInt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object UnsafeProjectionBenchmark extends BenchmarkBase {
(1 to numRows).map(_ => encoder.toRow(generator().asInstanceOf[Row]).copy()).toArray
}

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("unsafe projection") {
val iters = 1024 * 16
val numRows = 1024 * 16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import org.apache.spark.unsafe.map.BytesToBytesMap
*/
object AggregateBenchmark extends SqlBasedBenchmark {

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("aggregate without grouping") {
val N = 500L << 22
codegenBenchmark("agg w/o group", N) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ object FilterPushdownBenchmark extends BenchmarkBase with SQLHelper {
}
}

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("Pushdown for many distinct value case") {
withTempPath { dir =>
withTempTable("orcTable", "parquetTable") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object PrimitiveArrayBenchmark extends BenchmarkBase {
.config("spark.sql.autoBroadcastJoinThreshold", 1)
.getOrCreate()

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("Write primitive arrays in dataset") {
writeDatasetArray(4)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ object SortBenchmark extends BenchmarkBase {
benchmark.run()
}

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("radix sort") {
sortBenchmark()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ object CompressionSchemeBenchmark extends BenchmarkBase with AllCompressionSchem
runDecodeBenchmark("STRING Decode", iters, count, STRING, testData)
}

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("Compression Scheme Benchmark") {
bitEncodingBenchmark(1024)
shortEncodingBenchmark(1024)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ object ColumnarBatchBenchmark extends BenchmarkBase {
benchmark.run
}

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("Int Read/Write") {
intAccess(1024 * 40)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ object OrcReadBenchmark extends BenchmarkBase with SQLHelper {
}
}

override def benchmark(): Unit = {
override def runBenchmarkSuite(): Unit = {
runBenchmark("SQL Single Numeric Column Scan") {
Seq(ByteType, ShortType, IntegerType, LongType, FloatType, DoubleType).foreach { dataType =>
numericScanBenchmark(1024 * 1024 * 15, dataType)
Expand Down