Skip to content

Commit 1df855b

Browse files
maropudongjoon-hyun
authored andcommitted
[SPARK-32564][SQL][TEST][FOLLOWUP] Re-enable TPCDSQuerySuite with empty tables
### What changes were proposed in this pull request? This is the follow-up PR of #29384 to address the cloud-fan comment: #29384 (comment) This PR re-enables `TPCDSQuerySuite` with empty tables for better test coverages. ### Why are the changes needed? For better test coverage. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests. Closes #29391 from maropu/SPARK-32564-FOLLOWUP. Authored-by: Takeshi Yamamuro <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 8062c1f commit 1df855b

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

sql/core/src/test/scala/org/apache/spark/sql/TPCDSQuerySuite.scala

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.spark.sql
1919

20+
import org.apache.spark.sql.catalyst.TableIdentifier
2021
import org.apache.spark.sql.catalyst.util.resourceToString
2122
import org.apache.spark.sql.internal.SQLConf
2223

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

49-
val sqlConfgs = Seq(
50-
SQLConf.CBO_ENABLED.key -> "true",
51-
SQLConf.PLAN_STATS_ENABLED.key -> "true",
52-
SQLConf.JOIN_REORDER_ENABLED.key -> "true"
53-
)
50+
val sqlConfgs: Seq[(String, String)] = Nil
5451

5552
tpcdsQueries.foreach { name =>
5653
val queryString = resourceToString(s"tpcds/$name.sql",
@@ -104,3 +101,23 @@ class TPCDSQuerySuite extends BenchmarkQueryTest with TPCDSSchema {
104101
}
105102
}
106103
}
104+
105+
class TPCDSQueryWithStatsSuite extends TPCDSQuerySuite {
106+
107+
override def beforeAll(): Unit = {
108+
super.beforeAll()
109+
for (tableName <- tableNames) {
110+
// To simulate plan generation on actual TPCDS data, injects data stats here
111+
spark.sessionState.catalog.alterTableStats(
112+
TableIdentifier(tableName), Some(TPCDSTableStats.sf100TableStats(tableName)))
113+
}
114+
}
115+
116+
// Sets configurations for enabling the optimization rules that
117+
// exploit data statistics.
118+
override val sqlConfgs = Seq(
119+
SQLConf.CBO_ENABLED.key -> "true",
120+
SQLConf.PLAN_STATS_ENABLED.key -> "true",
121+
SQLConf.JOIN_REORDER_ENABLED.key -> "true"
122+
)
123+
}

sql/core/src/test/scala/org/apache/spark/sql/TPCDSSchema.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.spark.sql
1919

20-
import org.apache.spark.sql.catalyst.TableIdentifier
21-
2220
trait TPCDSSchema {
2321

2422
private val tableColumns = Map(
@@ -257,9 +255,5 @@ trait TPCDSSchema {
257255
|USING $format
258256
|${options.mkString("\n")}
259257
""".stripMargin)
260-
261-
// To simulate plan generation on actual TPCDS data, injects data stats here
262-
spark.sessionState.catalog.alterTableStats(
263-
TableIdentifier(tableName), Some(TPCDSTableStats.sf100TableStats(tableName)))
264258
}
265259
}

0 commit comments

Comments
 (0)