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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to