You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/24 04:13:03 UTC
[GitHub] [spark] HyukjinKwon commented on a change in pull request #31218: [SPARK-34147][SQL][TEST] Keep table partitioning in TPCDSQueryBenchmak when CBO is enabled
HyukjinKwon commented on a change in pull request #31218:
URL: https://github.com/apache/spark/pull/31218#discussion_r563234527
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/TPCDSQueryBenchmark.scala
##########
@@ -70,11 +67,13 @@ object TPCDSQueryBenchmark extends SqlBasedBenchmark with Logging {
def setupTables(dataLocation: String, createTempView: Boolean): Map[String, Long] = {
tables.map { tableName =>
- val df = spark.read.parquet(s"$dataLocation/$tableName")
if (createTempView) {
- df.createOrReplaceTempView(tableName)
+ spark.read.parquet(s"$dataLocation/$tableName").createOrReplaceTempView(tableName)
} else {
- df.write.saveAsTable(tableName)
+ spark.sql(s"DROP TABLE IF EXISTS $tableName")
+ spark.catalog.createTable(tableName, s"$dataLocation/$tableName", "parquet")
+ // Recover partitions but don't fail if a table is not partitioned.
+ Try(spark.sql(s"ALTER TABLE $tableName RECOVER PARTITIONS"))
Review comment:
Should we add a debug or info log when it fails to recover partitions?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org