From 8d1bb56826d04051708b90fae6fc3a536c92feb7 Mon Sep 17 00:00:00 2001 From: Gengliang Wang Date: Fri, 21 Sep 2018 13:07:01 +0800 Subject: [PATCH 1/3] refactor BenchmarkBase --- .../spark/{util => sql/execution/benchmark}/Benchmark.scala | 4 +++- .../{util => sql/execution/benchmark}/BenchmarkBase.scala | 2 +- .../scala/org/apache/spark/serializer/KryoBenchmark.scala | 2 +- .../spark/mllib/linalg/UDTSerializationBenchmark.scala | 2 +- .../src/test/scala/org/apache/spark/sql/HashBenchmark.scala | 2 +- .../scala/org/apache/spark/sql/HashByteArrayBenchmark.scala | 2 +- .../org/apache/spark/sql/UnsafeProjectionBenchmark.scala | 2 +- .../test/scala/org/apache/spark/sql/DatasetBenchmark.scala | 2 +- .../ExternalAppendOnlyUnsafeRowArrayBenchmark.scala | 2 +- .../spark/sql/execution/benchmark/AggregateBenchmark.scala | 3 +-- .../spark/sql/execution/benchmark/BenchmarkWideTable.scala | 5 +---- .../{BenchmarkBase.scala => BenchmarkWithCodegen.scala} | 3 +-- .../sql/execution/benchmark/DataSourceReadBenchmark.scala | 2 +- .../sql/execution/benchmark/DataSourceWriteBenchmark.scala | 1 - .../sql/execution/benchmark/FilterPushdownBenchmark.scala | 4 ++-- .../apache/spark/sql/execution/benchmark/JoinBenchmark.scala | 2 +- .../apache/spark/sql/execution/benchmark/MiscBenchmark.scala | 4 +--- .../sql/execution/benchmark/PrimitiveArrayBenchmark.scala | 3 +-- .../apache/spark/sql/execution/benchmark/SortBenchmark.scala | 3 +-- .../spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala | 1 - .../sql/execution/benchmark/UnsafeArrayDataBenchmark.scala | 3 +-- .../spark/sql/execution/benchmark/WideSchemaBenchmark.scala | 3 ++- .../columnar/compression/CompressionSchemeBenchmark.scala | 2 +- .../spark/sql/execution/datasources/csv/CSVBenchmarks.scala | 3 ++- .../sql/execution/datasources/json/JsonBenchmarks.scala | 3 ++- .../sql/execution/vectorized/ColumnarBatchBenchmark.scala | 2 +- .../benchmark/ObjectHashAggregateExecBenchmark.scala | 3 +-- .../org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala | 4 ++-- 28 files changed, 33 insertions(+), 41 deletions(-) rename core/src/main/scala/org/apache/spark/{util => sql/execution/benchmark}/Benchmark.scala (98%) rename core/src/main/scala/org/apache/spark/{util => sql/execution/benchmark}/BenchmarkBase.scala (97%) rename sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/{BenchmarkBase.scala => BenchmarkWithCodegen.scala} (94%) diff --git a/core/src/main/scala/org/apache/spark/util/Benchmark.scala b/core/src/main/scala/org/apache/spark/sql/execution/benchmark/Benchmark.scala similarity index 98% rename from core/src/main/scala/org/apache/spark/util/Benchmark.scala rename to core/src/main/scala/org/apache/spark/sql/execution/benchmark/Benchmark.scala index 7def44bd2a2b1..52d680ffbf99d 100644 --- a/core/src/main/scala/org/apache/spark/util/Benchmark.scala +++ b/core/src/main/scala/org/apache/spark/sql/execution/benchmark/Benchmark.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.spark.util +package org.apache.spark.sql.execution.benchmark import java.io.{OutputStream, PrintStream} @@ -27,6 +27,8 @@ import scala.util.Try import org.apache.commons.io.output.TeeOutputStream import org.apache.commons.lang3.SystemUtils +import org.apache.spark.util.Utils + /** * Utility class to benchmark components. An example of how to use this is: * val benchmark = new Benchmark("My Benchmark", valuesPerIteration) diff --git a/core/src/main/scala/org/apache/spark/util/BenchmarkBase.scala b/core/src/main/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala similarity index 97% rename from core/src/main/scala/org/apache/spark/util/BenchmarkBase.scala rename to core/src/main/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala index c84032b8726db..62e5f1aaeda42 100644 --- a/core/src/main/scala/org/apache/spark/util/BenchmarkBase.scala +++ b/core/src/main/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.spark.util +package org.apache.spark.sql.execution.benchmark import java.io.{File, FileOutputStream, OutputStream} diff --git a/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala b/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala index a1cf3570a7a6d..e56e17d7590e7 100644 --- a/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala +++ b/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala @@ -22,7 +22,7 @@ import scala.util.Random import org.apache.spark.{SparkConf, SparkFunSuite} import org.apache.spark.serializer.KryoTest._ -import org.apache.spark.util.Benchmark +import org.apache.spark.sql.execution.benchmark.Benchmark class KryoBenchmark extends SparkFunSuite { val benchmark = new Benchmark("Benchmark Kryo Unsafe vs safe Serialization", 1024 * 1024 * 15, 10) diff --git a/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala b/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala index 5973479dfb5ed..bbbd4d71f36e1 100644 --- a/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala +++ b/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala @@ -18,7 +18,7 @@ package org.apache.spark.mllib.linalg import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder -import org.apache.spark.util.Benchmark +import org.apache.spark.sql.execution.benchmark.Benchmark /** * Serialization benchmark for VectorUDT. diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala index 9a89e6290e695..b1789283405d1 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala @@ -20,8 +20,8 @@ package org.apache.spark.sql import org.apache.spark.sql.catalyst.encoders.RowEncoder import org.apache.spark.sql.catalyst.expressions._ import org.apache.spark.sql.catalyst.expressions.codegen.GenerateSafeProjection +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.types._ -import org.apache.spark.util.Benchmark /** * Benchmark for the previous interpreted hash function(InternalRow.hashCode) vs codegened diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala index f6c8111f5bc57..96a9008561448 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala @@ -20,9 +20,9 @@ package org.apache.spark.sql import java.util.Random import org.apache.spark.sql.catalyst.expressions.{HiveHasher, XXH64} +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.unsafe.Platform import org.apache.spark.unsafe.hash.Murmur3_x86_32 -import org.apache.spark.util.Benchmark /** * Synthetic benchmark for MurMurHash 3 and xxHash64. diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala index 6c63769945312..4edff012541df 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala @@ -20,8 +20,8 @@ package org.apache.spark.sql import org.apache.spark.sql.catalyst.InternalRow import org.apache.spark.sql.catalyst.encoders.RowEncoder import org.apache.spark.sql.catalyst.expressions.UnsafeProjection +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.types._ -import org.apache.spark.util.Benchmark /** * Benchmark `UnsafeProjection` for fixed-length/primitive-type fields. diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala index 1a0672b8876da..f2eb85b038ade 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala @@ -18,11 +18,11 @@ package org.apache.spark.sql import org.apache.spark.{SparkConf, SparkContext} +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.expressions.Aggregator import org.apache.spark.sql.expressions.scalalang.typed import org.apache.spark.sql.functions._ import org.apache.spark.sql.types.StringType -import org.apache.spark.util.Benchmark /** * Benchmark for Dataset typed operations comparing with DataFrame and RDD versions. diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala index 59397dbcb1cab..f82da0864b8a5 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala @@ -23,7 +23,7 @@ import org.apache.spark.{SparkConf, SparkContext, SparkEnv, TaskContext} import org.apache.spark.internal.config import org.apache.spark.memory.MemoryTestingUtils import org.apache.spark.sql.catalyst.expressions.UnsafeRow -import org.apache.spark.util.Benchmark +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter object ExternalAppendOnlyUnsafeRowArrayBenchmark { diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala index 8f4ee8533e599..18c76f5191f24 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala @@ -30,7 +30,6 @@ import org.apache.spark.sql.types.{LongType, StructType} import org.apache.spark.unsafe.Platform import org.apache.spark.unsafe.hash.Murmur3_x86_32 import org.apache.spark.unsafe.map.BytesToBytesMap -import org.apache.spark.util.Benchmark /** * Benchmark to measure performance for aggregate primitives. @@ -39,7 +38,7 @@ import org.apache.spark.util.Benchmark * * Benchmarks in this file are skipped in normal builds. */ -class AggregateBenchmark extends BenchmarkBase { +class AggregateBenchmark extends BenchmarkWithCodegen { ignore("aggregate without grouping") { val N = 500L << 22 diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala index 9dcaca0ca93ee..0cf091888d76c 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala @@ -17,9 +17,6 @@ package org.apache.spark.sql.execution.benchmark -import org.apache.spark.util.Benchmark - - /** * Benchmark to measure performance for wide table. * To run this: @@ -27,7 +24,7 @@ import org.apache.spark.util.Benchmark * * Benchmarks in this file are skipped in normal builds. */ -class BenchmarkWideTable extends BenchmarkBase { +class BenchmarkWideTable extends BenchmarkWithCodegen { ignore("project on wide table") { val N = 1 << 20 diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWithCodegen.scala similarity index 94% rename from sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala rename to sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWithCodegen.scala index c99a5aec1cd6e..372e97aa6eace 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWithCodegen.scala @@ -19,13 +19,12 @@ package org.apache.spark.sql.execution.benchmark import org.apache.spark.SparkFunSuite import org.apache.spark.sql.SparkSession -import org.apache.spark.util.Benchmark /** * Common base trait for micro benchmarks that are supposed to run standalone (i.e. not together * with other test suites). */ -private[benchmark] trait BenchmarkBase extends SparkFunSuite { +private[benchmark] trait BenchmarkWithCodegen extends SparkFunSuite { lazy val sparkSession = SparkSession.builder .master("local[1]") diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala index 8711f5a8fa1ce..3cec68fb658d8 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala @@ -28,7 +28,7 @@ import org.apache.spark.sql.execution.datasources.parquet.{SpecificParquetRecord import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.types._ import org.apache.spark.sql.vectorized.ColumnVector -import org.apache.spark.util.{Benchmark, Utils} +import org.apache.spark.util.Utils /** diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala index e3463d9e28acc..478a8f816e282 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala @@ -19,7 +19,6 @@ package org.apache.spark.sql.execution.benchmark import org.apache.spark.SparkConf import org.apache.spark.sql.SparkSession import org.apache.spark.sql.internal.SQLConf -import org.apache.spark.util.Benchmark trait DataSourceWriteBenchmark { val conf = new SparkConf() diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala index 9ecea99f12895..9fcb8ff0cc67b 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala @@ -27,7 +27,7 @@ import org.apache.spark.sql.functions.monotonically_increasing_id import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.internal.SQLConf.ParquetOutputTimestampType import org.apache.spark.sql.types.{ByteType, Decimal, DecimalType, TimestampType} -import org.apache.spark.util.{Benchmark, BenchmarkBase => FileBenchmarkBase, Utils} +import org.apache.spark.util.Utils /** * Benchmark to measure read performance with Filter pushdown. @@ -37,7 +37,7 @@ import org.apache.spark.util.{Benchmark, BenchmarkBase => FileBenchmarkBase, Uti * 3. generate result: SPARK_GENERATE_BENCHMARK_FILES=1 build/sbt "sql/test:runMain " * Results will be written to "benchmarks/FilterPushdownBenchmark-results.txt". */ -object FilterPushdownBenchmark extends FileBenchmarkBase { +object FilterPushdownBenchmark extends BenchmarkBase { private val conf = new SparkConf() .setAppName(this.getClass.getSimpleName) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/JoinBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/JoinBenchmark.scala index 5a25d72308370..37744dccc06f8 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/JoinBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/JoinBenchmark.scala @@ -28,7 +28,7 @@ import org.apache.spark.sql.types.IntegerType * * Benchmarks in this file are skipped in normal builds. */ -class JoinBenchmark extends BenchmarkBase { +class JoinBenchmark extends BenchmarkWithCodegen { ignore("broadcast hash join, long key") { val N = 20 << 20 diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala index f039aeaad442c..d2c1f2bf3b428 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala @@ -17,8 +17,6 @@ package org.apache.spark.sql.execution.benchmark -import org.apache.spark.util.Benchmark - /** * Benchmark to measure whole stage codegen performance. * To run this: @@ -26,7 +24,7 @@ import org.apache.spark.util.Benchmark * * Benchmarks in this file are skipped in normal builds. */ -class MiscBenchmark extends BenchmarkBase { +class MiscBenchmark extends BenchmarkWithCodegen { ignore("filter & aggregate without group") { val N = 500L << 22 diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala index 7f467d161081a..303f1270054a0 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala @@ -18,7 +18,6 @@ package org.apache.spark.sql.execution.benchmark import org.apache.spark.sql.SparkSession -import org.apache.spark.util.{Benchmark, BenchmarkBase => FileBenchmarkBase} /** * Benchmark primitive arrays via DataFrame and Dataset program using primitive arrays @@ -28,7 +27,7 @@ import org.apache.spark.util.{Benchmark, BenchmarkBase => FileBenchmarkBase} * 3. generate result: SPARK_GENERATE_BENCHMARK_FILES=1 build/sbt "sql/test:runMain " * Results will be written to "benchmarks/PrimitiveArrayBenchmark-results.txt". */ -object PrimitiveArrayBenchmark extends FileBenchmarkBase { +object PrimitiveArrayBenchmark extends BenchmarkBase { lazy val sparkSession = SparkSession.builder .master("local[1]") .appName("microbenchmark") diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala index 50ae26a3ff9d9..e4a717b2b9271 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala @@ -21,7 +21,6 @@ import java.util.{Arrays, Comparator} import org.apache.spark.unsafe.array.LongArray import org.apache.spark.unsafe.memory.MemoryBlock -import org.apache.spark.util.Benchmark import org.apache.spark.util.collection.Sorter import org.apache.spark.util.collection.unsafe.sort._ import org.apache.spark.util.random.XORShiftRandom @@ -33,7 +32,7 @@ import org.apache.spark.util.random.XORShiftRandom * * Benchmarks in this file are skipped in normal builds. */ -class SortBenchmark extends BenchmarkBase { +class SortBenchmark extends BenchmarkWithCodegen { private def referenceKeyPrefixSort(buf: LongArray, lo: Int, hi: Int, refCmp: PrefixComparator) { val sortBuffer = new LongArray(MemoryBlock.fromLongArray(new Array[Long](buf.size().toInt))) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala index fccee97820e75..edc37a2e9010c 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala @@ -24,7 +24,6 @@ import org.apache.spark.sql.catalyst.catalog.HiveTableRelation import org.apache.spark.sql.catalyst.plans.logical.SubqueryAlias import org.apache.spark.sql.catalyst.util._ import org.apache.spark.sql.execution.datasources.LogicalRelation -import org.apache.spark.util.Benchmark /** * Benchmark to measure TPCDS query performance. diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala index 6c7779b5790d0..922748c42f732 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala @@ -22,7 +22,6 @@ import scala.util.Random import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder import org.apache.spark.sql.catalyst.expressions.{UnsafeArrayData, UnsafeRow} import org.apache.spark.sql.catalyst.expressions.codegen.{BufferHolder, UnsafeArrayWriter} -import org.apache.spark.util.Benchmark /** * Benchmark [[UnsafeArrayDataBenchmark]] for UnsafeArrayData @@ -32,7 +31,7 @@ import org.apache.spark.util.Benchmark * * Benchmarks in this file are skipped in normal builds. */ -class UnsafeArrayDataBenchmark extends BenchmarkBase { +class UnsafeArrayDataBenchmark extends BenchmarkWithCodegen { def calculateHeaderPortionInBytes(count: Int) : Int = { /* 4 + 4 * count // Use this expression for SPARK-15962 */ diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala index c368f17a84364..cea4e3623df88 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala @@ -22,8 +22,9 @@ import java.io.{File, FileOutputStream, OutputStream} import org.scalatest.BeforeAndAfterEach import org.apache.spark.SparkFunSuite +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.functions._ -import org.apache.spark.util.{Benchmark, Utils} +import org.apache.spark.util.Utils /** * Benchmark for performance with very wide and nested DataFrames. diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala index 619b76fabdd5e..814918baed29f 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala @@ -24,9 +24,9 @@ import org.apache.commons.lang3.RandomStringUtils import org.apache.commons.math3.distribution.LogNormalDistribution import org.apache.spark.sql.catalyst.expressions.GenericInternalRow +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.execution.columnar.{BOOLEAN, INT, LONG, NativeColumnType, SHORT, STRING} import org.apache.spark.sql.types.AtomicType -import org.apache.spark.util.Benchmark import org.apache.spark.util.Utils._ /** diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala index 24f5f55d55485..a57e3b5c23a2f 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala @@ -20,9 +20,10 @@ import java.io.File import org.apache.spark.SparkConf import org.apache.spark.sql.{Column, Row, SparkSession} +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.functions.lit import org.apache.spark.sql.types._ -import org.apache.spark.util.{Benchmark, Utils} +import org.apache.spark.util.Utils /** * Benchmark to measure CSV read/write performance. diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala index a2b747eaab411..634c922a63693 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala @@ -20,9 +20,10 @@ import java.io.File import org.apache.spark.SparkConf import org.apache.spark.sql.{Row, SparkSession} +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.functions.lit import org.apache.spark.sql.types._ -import org.apache.spark.util.{Benchmark, Utils} +import org.apache.spark.util.Utils /** * The benchmarks aims to measure performance of JSON parsing when encoding is set and isn't. diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala index 8aeb06d428951..e5f03138ca6ea 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala @@ -23,9 +23,9 @@ import scala.util.Random import org.apache.spark.memory.MemoryMode import org.apache.spark.sql.catalyst.expressions.UnsafeRow +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.types.{ArrayType, BinaryType, IntegerType} import org.apache.spark.unsafe.Platform -import org.apache.spark.util.Benchmark import org.apache.spark.util.collection.BitSet /** diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala b/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala index e599d1ab1d486..7d4aaeaf57370 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala @@ -31,9 +31,8 @@ import org.apache.spark.sql.hive.execution.TestingTypedCount import org.apache.spark.sql.hive.test.TestHiveSingleton import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.types.LongType -import org.apache.spark.util.Benchmark -class ObjectHashAggregateExecBenchmark extends BenchmarkBase with TestHiveSingleton { +class ObjectHashAggregateExecBenchmark extends BenchmarkWithCodegen with TestHiveSingleton { ignore("Hive UDAF vs Spark AF") { val N = 2 << 15 diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala index bf6efa7c4c08c..ddd3ebfa35d73 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala @@ -23,10 +23,10 @@ import scala.util.{Random, Try} import org.apache.spark.SparkConf import org.apache.spark.sql.{DataFrame, SparkSession} +import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.types._ -import org.apache.spark.util.{Benchmark, Utils} - +import org.apache.spark.util.Utils /** * Benchmark to measure ORC read performance. From 1c3c0f692d38b361f35017df3e999f7838e28e48 Mon Sep 17 00:00:00 2001 From: Gengliang Wang Date: Fri, 21 Sep 2018 14:46:00 +0800 Subject: [PATCH 2/3] revise doc --- .../execution/benchmark/FilterPushdownBenchmark.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala index 9fcb8ff0cc67b..214943076c040 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala @@ -32,10 +32,12 @@ import org.apache.spark.util.Utils /** * Benchmark to measure read performance with Filter pushdown. * To run this benchmark: - * 1. without sbt: bin/spark-submit --class - * 2. build/sbt "sql/test:runMain " - * 3. generate result: SPARK_GENERATE_BENCHMARK_FILES=1 build/sbt "sql/test:runMain " - * Results will be written to "benchmarks/FilterPushdownBenchmark-results.txt". + * {{{ + * 1. without sbt: bin/spark-submit --class + * 2. build/sbt "sql/test:runMain " + * 3. generate result: SPARK_GENERATE_BENCHMARK_FILES=1 build/sbt "sql/test:runMain " + * Results will be written to "benchmarks/FilterPushdownBenchmark-results.txt". + * }}} */ object FilterPushdownBenchmark extends BenchmarkBase { From 1a5e1e927072e4438ea1ce7dc579a6d5b0986835 Mon Sep 17 00:00:00 2001 From: Gengliang Wang Date: Fri, 21 Sep 2018 16:56:09 +0800 Subject: [PATCH 3/3] address comment --- .../scala/org/apache/spark}/benchmark/Benchmark.scala | 2 +- .../scala/org/apache/spark}/benchmark/BenchmarkBase.scala | 2 +- .../test/scala/org/apache/spark/serializer/KryoBenchmark.scala | 2 +- .../apache/spark/mllib/linalg/UDTSerializationBenchmark.scala | 2 +- .../src/test/scala/org/apache/spark/sql/HashBenchmark.scala | 2 +- .../scala/org/apache/spark/sql/HashByteArrayBenchmark.scala | 2 +- .../scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala | 2 +- .../src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala | 2 +- .../execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala | 2 +- .../spark/sql/execution/benchmark/AggregateBenchmark.scala | 1 + .../spark/sql/execution/benchmark/BenchmarkWideTable.scala | 2 ++ .../spark/sql/execution/benchmark/BenchmarkWithCodegen.scala | 1 + .../spark/sql/execution/benchmark/DataSourceReadBenchmark.scala | 1 + .../sql/execution/benchmark/DataSourceWriteBenchmark.scala | 1 + .../spark/sql/execution/benchmark/FilterPushdownBenchmark.scala | 1 + .../apache/spark/sql/execution/benchmark/MiscBenchmark.scala | 2 ++ .../spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala | 1 + .../apache/spark/sql/execution/benchmark/SortBenchmark.scala | 1 + .../spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala | 1 + .../sql/execution/benchmark/UnsafeArrayDataBenchmark.scala | 1 + .../spark/sql/execution/benchmark/WideSchemaBenchmark.scala | 2 +- .../columnar/compression/CompressionSchemeBenchmark.scala | 2 +- .../spark/sql/execution/datasources/csv/CSVBenchmarks.scala | 2 +- .../spark/sql/execution/datasources/json/JsonBenchmarks.scala | 2 +- .../spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala | 2 +- .../execution/benchmark/ObjectHashAggregateExecBenchmark.scala | 1 + .../scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala | 2 +- 27 files changed, 29 insertions(+), 15 deletions(-) rename core/src/{main/scala/org/apache/spark/sql/execution => test/scala/org/apache/spark}/benchmark/Benchmark.scala (99%) rename core/src/{main/scala/org/apache/spark/sql/execution => test/scala/org/apache/spark}/benchmark/BenchmarkBase.scala (97%) diff --git a/core/src/main/scala/org/apache/spark/sql/execution/benchmark/Benchmark.scala b/core/src/test/scala/org/apache/spark/benchmark/Benchmark.scala similarity index 99% rename from core/src/main/scala/org/apache/spark/sql/execution/benchmark/Benchmark.scala rename to core/src/test/scala/org/apache/spark/benchmark/Benchmark.scala index 52d680ffbf99d..7a36b5f02dc4c 100644 --- a/core/src/main/scala/org/apache/spark/sql/execution/benchmark/Benchmark.scala +++ b/core/src/test/scala/org/apache/spark/benchmark/Benchmark.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.spark.sql.execution.benchmark +package org.apache.spark.benchmark import java.io.{OutputStream, PrintStream} diff --git a/core/src/main/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala b/core/src/test/scala/org/apache/spark/benchmark/BenchmarkBase.scala similarity index 97% rename from core/src/main/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala rename to core/src/test/scala/org/apache/spark/benchmark/BenchmarkBase.scala index 62e5f1aaeda42..9a37e0221b27b 100644 --- a/core/src/main/scala/org/apache/spark/sql/execution/benchmark/BenchmarkBase.scala +++ b/core/src/test/scala/org/apache/spark/benchmark/BenchmarkBase.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.spark.sql.execution.benchmark +package org.apache.spark.benchmark import java.io.{File, FileOutputStream, OutputStream} diff --git a/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala b/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala index e56e17d7590e7..f4fc0080f3108 100644 --- a/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala +++ b/core/src/test/scala/org/apache/spark/serializer/KryoBenchmark.scala @@ -21,8 +21,8 @@ import scala.reflect.ClassTag import scala.util.Random import org.apache.spark.{SparkConf, SparkFunSuite} +import org.apache.spark.benchmark.Benchmark import org.apache.spark.serializer.KryoTest._ -import org.apache.spark.sql.execution.benchmark.Benchmark class KryoBenchmark extends SparkFunSuite { val benchmark = new Benchmark("Benchmark Kryo Unsafe vs safe Serialization", 1024 * 1024 * 15, 10) diff --git a/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala b/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala index bbbd4d71f36e1..e2976e1ab022b 100644 --- a/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala +++ b/mllib/src/test/scala/org/apache/spark/mllib/linalg/UDTSerializationBenchmark.scala @@ -17,8 +17,8 @@ package org.apache.spark.mllib.linalg +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder -import org.apache.spark.sql.execution.benchmark.Benchmark /** * Serialization benchmark for VectorUDT. diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala index b1789283405d1..7a2a66c9b1d33 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashBenchmark.scala @@ -17,10 +17,10 @@ package org.apache.spark.sql +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.catalyst.encoders.RowEncoder import org.apache.spark.sql.catalyst.expressions._ import org.apache.spark.sql.catalyst.expressions.codegen.GenerateSafeProjection -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.types._ /** diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala index 96a9008561448..a60eb20d9edef 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/HashByteArrayBenchmark.scala @@ -19,8 +19,8 @@ package org.apache.spark.sql import java.util.Random +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.catalyst.expressions.{HiveHasher, XXH64} -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.unsafe.Platform import org.apache.spark.unsafe.hash.Murmur3_x86_32 diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala index 4edff012541df..faff681e13955 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/UnsafeProjectionBenchmark.scala @@ -17,10 +17,10 @@ package org.apache.spark.sql +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.catalyst.InternalRow import org.apache.spark.sql.catalyst.encoders.RowEncoder import org.apache.spark.sql.catalyst.expressions.UnsafeProjection -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.types._ /** diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala index f2eb85b038ade..fa2f0b6ba61d4 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/DatasetBenchmark.scala @@ -18,7 +18,7 @@ package org.apache.spark.sql import org.apache.spark.{SparkConf, SparkContext} -import org.apache.spark.sql.execution.benchmark.Benchmark +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.expressions.Aggregator import org.apache.spark.sql.expressions.scalalang.typed import org.apache.spark.sql.functions._ diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala index f82da0864b8a5..611b2fc037f3d 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArrayBenchmark.scala @@ -20,10 +20,10 @@ package org.apache.spark.sql.execution import scala.collection.mutable.ArrayBuffer import org.apache.spark.{SparkConf, SparkContext, SparkEnv, TaskContext} +import org.apache.spark.benchmark.Benchmark import org.apache.spark.internal.config import org.apache.spark.memory.MemoryTestingUtils import org.apache.spark.sql.catalyst.expressions.UnsafeRow -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter object ExternalAppendOnlyUnsafeRowArrayBenchmark { diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala index 18c76f5191f24..57a6fdb800ea4 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AggregateBenchmark.scala @@ -20,6 +20,7 @@ package org.apache.spark.sql.execution.benchmark import java.util.HashMap import org.apache.spark.SparkConf +import org.apache.spark.benchmark.Benchmark import org.apache.spark.internal.config._ import org.apache.spark.memory.{StaticMemoryManager, TaskMemoryManager} import org.apache.spark.sql.catalyst.expressions.UnsafeRow diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala index 0cf091888d76c..76367cbbe5342 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWideTable.scala @@ -17,6 +17,8 @@ package org.apache.spark.sql.execution.benchmark +import org.apache.spark.benchmark.Benchmark + /** * Benchmark to measure performance for wide table. * To run this: diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWithCodegen.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWithCodegen.scala index 372e97aa6eace..51331500479a3 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWithCodegen.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/BenchmarkWithCodegen.scala @@ -18,6 +18,7 @@ package org.apache.spark.sql.execution.benchmark import org.apache.spark.SparkFunSuite +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.SparkSession /** diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala index 3cec68fb658d8..cf9bda2fb1ff1 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceReadBenchmark.scala @@ -22,6 +22,7 @@ import scala.collection.JavaConverters._ import scala.util.{Random, Try} import org.apache.spark.SparkConf +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.{DataFrame, DataFrameWriter, Row, SparkSession} import org.apache.spark.sql.catalyst.InternalRow import org.apache.spark.sql.execution.datasources.parquet.{SpecificParquetRecordReaderBase, VectorizedParquetRecordReader} diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala index 478a8f816e282..994d6b5b7d334 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DataSourceWriteBenchmark.scala @@ -17,6 +17,7 @@ package org.apache.spark.sql.execution.benchmark import org.apache.spark.SparkConf +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.SparkSession import org.apache.spark.sql.internal.SQLConf diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala index 214943076c040..3b7f10783b64c 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/FilterPushdownBenchmark.scala @@ -22,6 +22,7 @@ import java.io.File import scala.util.{Random, Try} import org.apache.spark.SparkConf +import org.apache.spark.benchmark.{Benchmark, BenchmarkBase} import org.apache.spark.sql.{DataFrame, SparkSession} import org.apache.spark.sql.functions.monotonically_increasing_id import org.apache.spark.sql.internal.SQLConf diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala index d2c1f2bf3b428..f44da242e62b9 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/MiscBenchmark.scala @@ -17,6 +17,8 @@ package org.apache.spark.sql.execution.benchmark +import org.apache.spark.benchmark.Benchmark + /** * Benchmark to measure whole stage codegen performance. * To run this: diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala index 303f1270054a0..8b275188f06d6 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/PrimitiveArrayBenchmark.scala @@ -17,6 +17,7 @@ package org.apache.spark.sql.execution.benchmark +import org.apache.spark.benchmark.{Benchmark, BenchmarkBase} import org.apache.spark.sql.SparkSession /** diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala index e4a717b2b9271..17619ec5fadc1 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/SortBenchmark.scala @@ -19,6 +19,7 @@ package org.apache.spark.sql.execution.benchmark import java.util.{Arrays, Comparator} +import org.apache.spark.benchmark.Benchmark import org.apache.spark.unsafe.array.LongArray import org.apache.spark.unsafe.memory.MemoryBlock import org.apache.spark.util.collection.Sorter diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala index edc37a2e9010c..2d72b1c14af7d 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala @@ -18,6 +18,7 @@ package org.apache.spark.sql.execution.benchmark import org.apache.spark.SparkConf +import org.apache.spark.benchmark.Benchmark import org.apache.spark.internal.Logging import org.apache.spark.sql.SparkSession import org.apache.spark.sql.catalyst.catalog.HiveTableRelation diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala index 922748c42f732..51ab0e13a98a8 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/UnsafeArrayDataBenchmark.scala @@ -19,6 +19,7 @@ package org.apache.spark.sql.execution.benchmark import scala.util.Random +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder import org.apache.spark.sql.catalyst.expressions.{UnsafeArrayData, UnsafeRow} import org.apache.spark.sql.catalyst.expressions.codegen.{BufferHolder, UnsafeArrayWriter} diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala index cea4e3623df88..81017a6d244f0 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/WideSchemaBenchmark.scala @@ -22,7 +22,7 @@ import java.io.{File, FileOutputStream, OutputStream} import org.scalatest.BeforeAndAfterEach import org.apache.spark.SparkFunSuite -import org.apache.spark.sql.execution.benchmark.Benchmark +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.functions._ import org.apache.spark.util.Utils diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala index 814918baed29f..9c26d67b62ccc 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/compression/CompressionSchemeBenchmark.scala @@ -23,8 +23,8 @@ import java.nio.charset.StandardCharsets import org.apache.commons.lang3.RandomStringUtils import org.apache.commons.math3.distribution.LogNormalDistribution +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.catalyst.expressions.GenericInternalRow -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.execution.columnar.{BOOLEAN, INT, LONG, NativeColumnType, SHORT, STRING} import org.apache.spark.sql.types.AtomicType import org.apache.spark.util.Utils._ diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala index a57e3b5c23a2f..6d319eb723d93 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVBenchmarks.scala @@ -19,8 +19,8 @@ package org.apache.spark.sql.execution.datasources.csv import java.io.File import org.apache.spark.SparkConf +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.{Column, Row, SparkSession} -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.functions.lit import org.apache.spark.sql.types._ import org.apache.spark.util.Utils diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala index 634c922a63693..e40cb9b50148b 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonBenchmarks.scala @@ -19,8 +19,8 @@ package org.apache.spark.sql.execution.datasources.json import java.io.File import org.apache.spark.SparkConf +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.{Row, SparkSession} -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.functions.lit import org.apache.spark.sql.types._ import org.apache.spark.util.Utils diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala index e5f03138ca6ea..d69cf1126868e 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala @@ -21,9 +21,9 @@ import java.nio.charset.StandardCharsets import scala.util.Random +import org.apache.spark.benchmark.Benchmark import org.apache.spark.memory.MemoryMode import org.apache.spark.sql.catalyst.expressions.UnsafeRow -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.types.{ArrayType, BinaryType, IntegerType} import org.apache.spark.unsafe.Platform import org.apache.spark.util.collection.BitSet diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala b/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala index 7d4aaeaf57370..3b33785cdfbb2 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/execution/benchmark/ObjectHashAggregateExecBenchmark.scala @@ -21,6 +21,7 @@ import scala.concurrent.duration._ import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFPercentileApprox +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.Column import org.apache.spark.sql.catalyst.FunctionIdentifier import org.apache.spark.sql.catalyst.catalog.CatalogFunction diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala index ddd3ebfa35d73..0eab7d1ea8e80 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcReadBenchmark.scala @@ -22,8 +22,8 @@ import java.io.File import scala.util.{Random, Try} import org.apache.spark.SparkConf +import org.apache.spark.benchmark.Benchmark import org.apache.spark.sql.{DataFrame, SparkSession} -import org.apache.spark.sql.execution.benchmark.Benchmark import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.types._ import org.apache.spark.util.Utils