Skip to content

Commit

Permalink
Simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyum committed Nov 20, 2021
1 parent fa966bb commit 50484e2
Showing 1 changed file with 4 additions and 10 deletions.
Expand Up @@ -31,7 +31,6 @@ import org.apache.spark.sql.execution.joins.BroadcastHashJoinExec
import org.apache.spark.sql.execution.streaming.{MemoryStream, StreamingQueryWrapper}
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.internal.SQLConf.DYNAMIC_PARTITION_PRUNING_FILTERING_ROW_COUNT
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}

/**
Expand All @@ -50,8 +49,6 @@ abstract class DynamicPartitionPruningSuiteBase
protected def initState(): Unit = {}
protected def runAnalyzeColumnCommands: Boolean = true

var originalFilteringSideThreshold = 1000

override protected def beforeAll(): Unit = {
super.beforeAll()

Expand Down Expand Up @@ -160,9 +157,6 @@ abstract class DynamicPartitionPruningSuiteBase
sql("ANALYZE TABLE dim_store COMPUTE STATISTICS FOR COLUMNS store_id")
sql("ANALYZE TABLE code_stats COMPUTE STATISTICS FOR COLUMNS store_id")
}

originalFilteringSideThreshold = conf.getConf(DYNAMIC_PARTITION_PRUNING_FILTERING_ROW_COUNT)
conf.setConf(DYNAMIC_PARTITION_PRUNING_FILTERING_ROW_COUNT, 0)
}

override protected def afterAll(): Unit = {
Expand All @@ -173,8 +167,6 @@ abstract class DynamicPartitionPruningSuiteBase
sql("DROP TABLE IF EXISTS dim_store")
sql("DROP TABLE IF EXISTS fact_stats")
sql("DROP TABLE IF EXISTS dim_stats")

conf.setConf(DYNAMIC_PARTITION_PRUNING_FILTERING_ROW_COUNT, originalFilteringSideThreshold)
} finally {
spark.sessionState.conf.unsetConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED)
spark.sessionState.conf.unsetConf(SQLConf.ADAPTIVE_EXECUTION_FORCE_APPLY)
Expand Down Expand Up @@ -367,7 +359,8 @@ abstract class DynamicPartitionPruningSuiteBase
*/
test("DPP triggers only for certain types of query") {
withSQLConf(
SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "false") {
SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "false",
SQLConf.DYNAMIC_PARTITION_PRUNING_FILTERING_ROW_COUNT.key -> "0") {
Given("dynamic partition pruning disabled")
withSQLConf(SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key -> "false") {
val df = sql(
Expand Down Expand Up @@ -572,7 +565,8 @@ abstract class DynamicPartitionPruningSuiteBase
test("filtering ratio policy with stats when the broadcast pruning is disabled") {
withSQLConf(
SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "false",
SQLConf.EXCHANGE_REUSE_ENABLED.key -> "false") {
SQLConf.EXCHANGE_REUSE_ENABLED.key -> "false",
SQLConf.DYNAMIC_PARTITION_PRUNING_FILTERING_ROW_COUNT.key -> "0") {
Given("disabling the use of stats in the DPP heuristic")
withSQLConf(SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key -> "true",
SQLConf.DYNAMIC_PARTITION_PRUNING_USE_STATS.key -> "false") {
Expand Down

0 comments on commit 50484e2

Please sign in to comment.