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 @@ -42,8 +42,7 @@ class SparkOptimizer(
override def defaultBatches: Seq[Batch] = (preOptimizationBatches ++ super.defaultBatches :+
Batch("Optimize Metadata Only Query", Once, OptimizeMetadataOnlyQuery(catalog)) :+
Batch("PartitionPruning", Once,
PartitionPruning,
OptimizeSubqueries) :+
PartitionPruning) :+
Batch("Pushdown Filters from PartitionPruning", fixedPoint,
PushDownPredicates) :+
Batch("Cleanup filters that cannot be pushed down", Once,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,20 @@ abstract class DynamicPartitionPruningSuiteBase
)
}
}

test("SPARK-36444: Remove OptimizeSubqueries from batch of PartitionPruning") {
withSQLConf(SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key -> "true") {
val df = sql(
"""
|SELECT date_id, product_id FROM fact_sk f
|JOIN (select store_id + 3 as new_store_id from dim_store where country = 'US') s
|ON f.store_id = s.new_store_id
""".stripMargin)

checkPartitionPruningPredicate(df, false, true)
checkAnswer(df, Row(1150, 1) :: Row(1130, 4) :: Row(1140, 4) :: Nil)
}
}
}

class DynamicPartitionPruningSuiteAEOff extends DynamicPartitionPruningSuiteBase {
Expand Down