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 @@ -880,6 +880,12 @@ object SQLConf {
.booleanConf
.createWithDefault(true)

val SUBQUERY_REUSE_ENABLED = buildConf("spark.sql.subquery.reuse")
.internal()
.doc("When true, the planner will try to find out duplicated subqueries and re-use them.")
.booleanConf
.createWithDefault(true)

val STATE_STORE_PROVIDER_CLASS =
buildConf("spark.sql.streaming.stateStore.providerClass")
.internal()
Expand Down Expand Up @@ -1866,6 +1872,8 @@ class SQLConf extends Serializable with Logging {

def exchangeReuseEnabled: Boolean = getConf(EXCHANGE_REUSE_ENABLED)

def subqueryReuseEnabled: Boolean = getConf(SUBQUERY_REUSE_ENABLED)

def caseSensitiveAnalysis: Boolean = getConf(SQLConf.CASE_SENSITIVE)

def constraintPropagationEnabled: Boolean = getConf(CONSTRAINT_PROPAGATION_ENABLED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ case class PlanSubqueries(sparkSession: SparkSession) extends Rule[SparkPlan] {
case class ReuseSubquery(conf: SQLConf) extends Rule[SparkPlan] {

def apply(plan: SparkPlan): SparkPlan = {
if (!conf.exchangeReuseEnabled) {
if (!conf.subqueryReuseEnabled) {
return plan
}
// Build a hash map using schema of subqueries to avoid O(N*N) sameResult calls.
Expand Down