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 2020/05/23 05:58:40 UTC

[GitHub] [spark] viirya commented on a change in pull request #26422: [SPARK-29786][SQL] Fix MetaException when dropping a partition not exists on HDFS

viirya commented on a change in pull request #26422:
URL: https://github.com/apache/spark/pull/26422#discussion_r429517900



##########
File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -638,6 +644,17 @@ private[hive] class HiveClientImpl(
             s"No partition is dropped. One partition spec '$s' does not exist in table '$table' " +
             s"database '$db'")
         }
+        // Check whether the partition we are going to drop is empty.
+        // We make a dummy one for the empty partition. See [SPARK-29786] for more details.
+        parts.foreach { partition =>
+          val partPath = partition.getPath.head
+          if (isExistPath(partPath)) {
+            val fs = partPath.getFileSystem(conf)
+            fs.mkdirs(partPath)
+            fs.deleteOnExit(partPath)
+          }

Review comment:
       I'm confused. When the partition exists (`isExistPath` returns true), why you need to mkdir it again?




----------------------------------------------------------------
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