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
27 changes: 22 additions & 5 deletions sql/core/src/test/scala/org/apache/spark/sql/TPCDSQuerySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.spark.sql

import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.catalyst.util.resourceToString
import org.apache.spark.sql.internal.SQLConf

Expand Down Expand Up @@ -46,11 +47,7 @@ class TPCDSQuerySuite extends BenchmarkQueryTest with TPCDSSchema {
"q81", "q82", "q83", "q84", "q85", "q86", "q87", "q88", "q89", "q90",
"q91", "q92", "q93", "q94", "q95", "q96", "q97", "q98", "q99")

val sqlConfgs = Seq(
SQLConf.CBO_ENABLED.key -> "true",
SQLConf.PLAN_STATS_ENABLED.key -> "true",
SQLConf.JOIN_REORDER_ENABLED.key -> "true"
)
val sqlConfgs: Seq[(String, String)] = Nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, this is not identical with the original status. I'm wondering if we don't need SQLConf.CROSS_JOINS_ENABLED.key -> "true" ? Previously, we had it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, since it is enabled by default in 3.0+, I dropped it in the previous PR.


tpcdsQueries.foreach { name =>
val queryString = resourceToString(s"tpcds/$name.sql",
Expand Down Expand Up @@ -104,3 +101,23 @@ class TPCDSQuerySuite extends BenchmarkQueryTest with TPCDSSchema {
}
}
}

class TPCDSQueryWithStatsSuite extends TPCDSQuerySuite {

override def beforeAll(): Unit = {
super.beforeAll()
for (tableName <- tableNames) {
// To simulate plan generation on actual TPCDS data, injects data stats here
spark.sessionState.catalog.alterTableStats(
TableIdentifier(tableName), Some(TPCDSTableStats.sf100TableStats(tableName)))
}
}

// Sets configurations for enabling the optimization rules that
// exploit data statistics.
override val sqlConfgs = Seq(
SQLConf.CBO_ENABLED.key -> "true",
SQLConf.PLAN_STATS_ENABLED.key -> "true",
SQLConf.JOIN_REORDER_ENABLED.key -> "true"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.apache.spark.sql

import org.apache.spark.sql.catalyst.TableIdentifier

trait TPCDSSchema {

private val tableColumns = Map(
Expand Down Expand Up @@ -257,9 +255,5 @@ trait TPCDSSchema {
|USING $format
|${options.mkString("\n")}
""".stripMargin)

// To simulate plan generation on actual TPCDS data, injects data stats here
spark.sessionState.catalog.alterTableStats(
TableIdentifier(tableName), Some(TPCDSTableStats.sf100TableStats(tableName)))
}
}