Skip to content
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 @@ -23,10 +23,10 @@ import scala.jdk.CollectionConverters._

import com.google.protobuf.DescriptorProtos.FileDescriptorSet

import org.apache.spark.sql.test.SQLTestUtils
import org.apache.spark.sql.QueryTest
import org.apache.spark.sql.types.{DataType, StructType}

trait ProtobufTestBase extends SQLTestUtils {
trait ProtobufTestBase extends QueryTest {

private val descriptorDir = getWorkspaceFilePath(
"connector", "protobuf", "target", "generated-test-sources")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ private[spark] class AppStatusListener(
}

// Force an update on both live and history applications when the number of active tasks
// reaches 0. This is checked in some tests (e.g. SQLTestUtilsBase) so it needs to be
// reaches 0. This is checked in some tests (e.g. QueryTestBase) so it needs to be
// reliably up to date.
if (exec.activeTasks == 0) {
update(exec, now)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ import org.apache.spark.{SparkConf, SparkIllegalArgumentException}
import org.apache.spark.serializer.KryoSerializer
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.execution.columnar.{DefaultCachedBatch, DefaultCachedBatchKryoSerializer}
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.storage.StorageLevel

class CacheTableInKryoSuite extends QueryTest
with SQLTestUtils
with SharedSparkSession {

override def sparkConf: SparkConf = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import org.apache.spark.sql.execution.datasources.LogicalRelation
import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.sources.SimpleInsertSource
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types._

// The base trait for char/varchar tests that need to be run with different table implementations.
trait CharVarcharTestSuite extends QueryTest with SQLTestUtils {
trait CharVarcharTestSuite extends QueryTest {

def format: String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ import org.apache.spark.sql.execution.joins.BroadcastHashJoinExec
import org.apache.spark.sql.execution.streaming.runtime.{MemoryStream, StreamingQueryWrapper}
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession

/**
* Test suite for the filtering ratio policy used to trigger dynamic partition pruning (DPP).
*/
abstract class DynamicPartitionPruningSuiteBase
extends QueryTest
with SQLTestUtils
with GivenWhenThen
with AdaptiveSparkPlanHelper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ package org.apache.spark.sql
import org.apache.spark.{MapOutputTrackerMaster, SparkFunSuite}
import org.apache.spark.sql.classic.SparkSession
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SQLTestUtils

class MapStatusEndToEndSuite extends SparkFunSuite with SQLTestUtils {
class MapStatusEndToEndSuite extends SparkFunSuite with QueryTest {
override def spark: SparkSession = SparkSession.builder()
.master("local")
.config(SQLConf.LEAF_NODE_DEFAULT_PARALLELISM.key, value = 5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import org.apache.spark.sql.execution.CommandResultExec
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
import org.apache.spark.sql.execution.exchange.ReusedExchangeExec
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types.{DataType, IntegerType, SQLUserDefinedType, UserDefinedType}
import org.apache.spark.unsafe.types.UTF8String

/**
* The base trait for SQL INSERT.
*/
trait SQLInsertTestSuite extends QueryTest with SQLTestUtils with AdaptiveSparkPlanHelper {
trait SQLInsertTestSuite extends QueryTest with AdaptiveSparkPlanHelper {

import testImplicits._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ import org.apache.spark.sql.catalyst.util.DateTimeUtils
import org.apache.spark.sql.connector.catalog.CatalogManager
import org.apache.spark.sql.execution.datasources.LogicalRelation
import org.apache.spark.sql.internal.{SQLConf, StaticSQLConf}
import org.apache.spark.sql.test.SQLTestUtils

/**
* The base for statistics test cases that we want to include in both the hive module (for
* verifying behavior when using the Hive external catalog) as well as in the sql/core module.
*/
abstract class StatisticsCollectionTestBase extends QueryTest with SQLTestUtils {
abstract class StatisticsCollectionTestBase extends QueryTest {
import testImplicits._

private val dec1 = new java.math.BigDecimal("-1.756893400357024346")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ import org.scalatest.exceptions.TestFailedException

import org.apache.spark.{SparkException, TaskContext, TestUtils}
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.Row
import org.apache.spark.sql.{QueryTest, Row}
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference, GenericInternalRow}
import org.apache.spark.sql.catalyst.plans.physical.Partitioning
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SQLTestUtils
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.CalendarInterval
import org.apache.spark.util.ArrayImplicits._

abstract class BaseScriptTransformationSuite extends SparkPlanTest with SQLTestUtils {
abstract class BaseScriptTransformationSuite extends SparkPlanTest with QueryTest {
import testImplicits._
import ScriptTransformationIOSchema._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ package org.apache.spark.sql.execution

import org.apache.spark.sql.{AnalysisException, QueryTest}
import org.apache.spark.sql.metricview.serde.{AssetSource, Column, DimensionExpression, MeasureExpression, MetricView, MetricViewFactory, SQLSource}
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession

class SimpleMetricViewSuite extends MetricViewSuite with SharedSparkSession

/**
* A suite for testing metric view related functionality.
*/
abstract class MetricViewSuite extends QueryTest with SQLTestUtils {
abstract class MetricViewSuite extends QueryTest {
import testImplicits._

protected val testMetricViewName = "test_metric_view"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import org.apache.spark.sql.catalyst.plans.logical.Project
import org.apache.spark.sql.catalyst.trees.Origin
import org.apache.spark.sql.connector.catalog.CatalogManager.SESSION_CATALOG_NAME
import org.apache.spark.sql.internal.SQLConf._
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession

class SimpleSQLViewSuite extends SQLViewSuite with SharedSparkSession

/**
* A suite for testing view related functionality.
*/
abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
abstract class SQLViewSuite extends QueryTest {
import testImplicits._

protected override def beforeAll(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import org.apache.spark.sql.connector.catalog._
import org.apache.spark.sql.connector.catalog.CatalogManager.SESSION_CATALOG_NAME
import org.apache.spark.sql.errors.DataTypeErrors.toSQLId
import org.apache.spark.sql.internal.SQLConf._
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types.{IntegerType, StringType, StructField, StructType}
import org.apache.spark.util.ArrayImplicits._

Expand All @@ -41,7 +41,7 @@ import org.apache.spark.util.ArrayImplicits._
* Currently, the test cases in this suite should have same behavior across all kind of views
* TODO: Combine this with [[SQLViewSuite]]
*/
abstract class SQLViewTestSuite extends QueryTest with SQLTestUtils {
abstract class SQLViewTestSuite extends QueryTest {
import testImplicits._

protected def viewTypeString: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ package org.apache.spark.sql.execution
import scala.util.control.NonFatal

import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.{DataFrame, Row, SparkSessionProvider, SQLContext}
import org.apache.spark.sql.{DataFrame, QueryTest, Row, SparkSessionProvider, SQLContext}
import org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute
import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
import org.apache.spark.sql.classic.ClassicConversions._
import org.apache.spark.sql.test.SQLTestUtils

/**
* Base class for writing tests for individual physical operators. For an example of how this
Expand Down Expand Up @@ -177,7 +176,7 @@ object SparkPlanTest {
return Some(errorMessage)
}

SQLTestUtils.compareAnswers(actualAnswer, expectedAnswer, sortAnswers).map { errorMessage =>
QueryTest.compareAnswers(actualAnswer, expectedAnswer, sortAnswers).map { errorMessage =>
s"""
| Results do not match.
| Actual result Spark plan:
Expand Down Expand Up @@ -222,7 +221,7 @@ object SparkPlanTest {
return Some(errorMessage)
}

SQLTestUtils.compareAnswers(sparkAnswer, expectedAnswer, sortAnswers).map { errorMessage =>
QueryTest.compareAnswers(sparkAnswer, expectedAnswer, sortAnswers).map { errorMessage =>
s"""
| Results do not match for Spark plan:
| $outputPlan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package org.apache.spark.sql.execution.adaptive
import org.scalactic.source.Position
import org.scalatest.Tag

import org.apache.spark.sql.QueryTest
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SQLTestUtils

/**
* Test with this tag will be ignored if the test suite extends `EnableAdaptiveExecutionSuite`.
Expand All @@ -33,7 +33,7 @@ case class DisableAdaptiveExecution(reason: String) extends Tag("DisableAdaptive
* Helper trait that enables AQE for all tests regardless of default config values, except that
* tests tagged with [[DisableAdaptiveExecution]] will be skipped.
*/
trait EnableAdaptiveExecutionSuite extends SQLTestUtils {
trait EnableAdaptiveExecutionSuite extends QueryTest {
protected val forceApply = true

override protected def test(testName: String, testTags: Tag*)(testFun: => Any)
Expand All @@ -57,7 +57,7 @@ trait EnableAdaptiveExecutionSuite extends SQLTestUtils {
/**
* Helper trait that disables AQE for all tests regardless of default config values.
*/
trait DisableAdaptiveExecutionSuite extends SQLTestUtils {
trait DisableAdaptiveExecutionSuite extends QueryTest {
override protected def test(testName: String, testTags: Tag*)(testFun: => Any)
(implicit pos: Position): Unit = {
super.test(testName, testTags: _*) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
import org.apache.spark.sql.catalyst.util.CharVarcharUtils
import org.apache.spark.sql.connector.catalog.InMemoryPartitionTableCatalog
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types._

trait CharVarcharDDLTestBase extends QueryTest with SQLTestUtils {
trait CharVarcharDDLTestBase extends QueryTest {

def format: String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import org.apache.spark.sql.{QueryTest, Row}
import org.apache.spark.sql.catalyst.catalog.CatalogTypes.TablePartitionSpec
import org.apache.spark.sql.connector.catalog.{CatalogV2Util, TableCatalog}
import org.apache.spark.sql.execution.datasources.PartitioningUtils
import org.apache.spark.sql.test.SQLTestUtils
import org.apache.spark.util.Utils

/**
Expand All @@ -38,7 +37,7 @@ import org.apache.spark.util.Utils
* - V1 Hive External catalog: `org.apache.spark.sql.hive.execution.command.CommandSuiteBase`
* - V2 In-Memory catalog: `org.apache.spark.sql.execution.command.v2.CommandSuiteBase`
*/
trait DDLCommandTestUtils extends SQLTestUtils {
trait DDLCommandTestUtils extends QueryTest {
// The version of the catalog under testing such as "V1", "V2", "Hive V1".
protected def catalogVersion: String
// The version of the SQL command under testing such as "V1", "V2".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import org.apache.spark.sql.connector.catalog.SupportsNamespaces.PROP_OWNER
import org.apache.spark.sql.execution.datasources._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.internal.StaticSQLConf.CATALOG_IMPLEMENTATION
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types._
import org.apache.spark.util.Utils

Expand Down Expand Up @@ -251,7 +251,7 @@ class InMemoryCatalogedDDLSuite extends DDLSuite with SharedSparkSession {
}
}

trait DDLSuiteBase extends SQLTestUtils {
trait DDLSuiteBase extends QueryTest {

protected def isUsingHiveMetastore: Boolean = {
spark.sparkContext.conf.get(CATALOG_IMPLEMENTATION) == "hive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ import java.io.File
import scala.reflect.ClassTag
import scala.reflect.runtime.universe.TypeTag

import org.apache.spark.sql.{DataFrame, Row, SaveMode}
import org.apache.spark.sql.{DataFrame, QueryTest, Row, SaveMode}
import org.apache.spark.sql.functions.struct
import org.apache.spark.sql.test.SQLTestUtils
import org.apache.spark.sql.types.StructType

/**
* A helper trait that provides convenient facilities for file-based data source testing.
* Specifically, it is used for Parquet and Orc testing. It can be used to write tests
* that are shared between Parquet and Orc.
*/
private[sql] trait FileBasedDataSourceTest extends SQLTestUtils {
private[sql] trait FileBasedDataSourceTest extends QueryTest {

// Defines the data source name to run the test.
protected val dataSourceName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import org.apache.spark.sql.execution.{QueryExecution, SortExec}
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types.{IntegerType, StringType}
import org.apache.spark.sql.util.QueryExecutionListener
import org.apache.spark.tags.SlowSQLTest

trait V1WriteCommandSuiteBase extends SQLTestUtils with AdaptiveSparkPlanHelper {
trait V1WriteCommandSuiteBase extends QueryTest with AdaptiveSparkPlanHelper {

import testImplicits._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ import org.apache.orc.OrcProto.Stream.Kind
import org.apache.orc.impl.RecordReaderImpl

import org.apache.spark.{SPARK_VERSION_SHORT, SparkConf, SparkException}
import org.apache.spark.sql.{Row, SPARK_VERSION_METADATA_KEY}
import org.apache.spark.sql.{QueryTestBase, Row, SPARK_VERSION_METADATA_KEY}
import org.apache.spark.sql.execution.datasources.{CommonFileDataSourceSuite, SchemaMergeUtils}
import org.apache.spark.sql.execution.datasources.orc.OrcCompressionCodec._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtilsBase}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types._
import org.apache.spark.util.Utils

case class OrcData(intField: Int, stringField: String)

abstract class OrcSuite
extends OrcTest with CommonFileDataSourceSuite with SQLTestUtilsBase {
extends OrcTest with CommonFileDataSourceSuite with QueryTestBase {
import testImplicits._

override protected def dataSourceFormat = "orc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ import org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
import org.apache.parquet.hadoop.{ParquetOutputCommitter, ParquetOutputFormat}

import org.apache.spark.{LocalSparkContext, SparkFunSuite}
import org.apache.spark.sql.QueryTest
import org.apache.spark.sql.classic.SparkSession
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SQLTestUtils
import org.apache.spark.tags.ExtendedSQLTest

/**
* Test logic related to choice of output committers.
*/
@ExtendedSQLTest
class ParquetCommitterSuite extends SparkFunSuite with SQLTestUtils
class ParquetCommitterSuite extends SparkFunSuite with QueryTest
with LocalSparkContext {

private val PARQUET_COMMITTER = classOf[ParquetOutputCommitter].getCanonicalName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import org.apache.spark.sql.execution.columnar.InMemoryTableScanExec
import org.apache.spark.sql.execution.exchange.{EnsureRequirements, ShuffleExchangeExec}
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SQLTestUtils
import org.apache.spark.sql.types.{LongType, ShortType}
import org.apache.spark.tags.ExtendedSQLTest

Expand All @@ -45,7 +44,7 @@ import org.apache.spark.tags.ExtendedSQLTest
* unsafe map in [[org.apache.spark.sql.execution.joins.UnsafeHashedRelation]] is not triggered
* without serializing the hashed relation, which does not happen in local mode.
*/
abstract class BroadcastJoinSuiteBase extends QueryTest with SQLTestUtils
abstract class BroadcastJoinSuiteBase extends QueryTest
with AdaptiveSparkPlanHelper {
import testImplicits._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import scala.collection.mutable.HashMap

import org.apache.spark.TestUtils
import org.apache.spark.scheduler.{SparkListener, SparkListenerTaskEnd}
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.{DataFrame, QueryTest}
import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.execution.{SparkPlan, SparkPlanInfo}
import org.apache.spark.sql.execution.ui.{SparkPlanGraph, SQLAppStatusStore}
import org.apache.spark.sql.internal.SQLConf.WHOLESTAGE_CODEGEN_ENABLED
import org.apache.spark.sql.test.SQLTestUtils


trait SQLMetricsTestUtils extends SQLTestUtils {
trait SQLMetricsTestUtils extends QueryTest {
import testImplicits._

protected def currentExecutionIds(): Set[Long] = {
Expand Down
Loading