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/03/29 18:35:35 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #28066: [SPARK-31298][SQL] Create DataSource External Table path also need non-existent or empty

dongjoon-hyun commented on a change in pull request #28066: [SPARK-31298][SQL] Create DataSource External Table path also need non-existent or empty
URL: https://github.com/apache/spark/pull/28066#discussion_r399835785
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ##########
 @@ -328,15 +328,17 @@ class SessionCatalog(
 
   def validateTableLocation(table: CatalogTable): Unit = {
     // SPARK-19724: the default location of a managed table should be non-existent or empty.
-    if (table.tableType == CatalogTableType.MANAGED) {
-      val tableLocation =
-        new Path(table.storage.locationUri.getOrElse(defaultTablePath(table.identifier)))
-      val fs = tableLocation.getFileSystem(hadoopConf)
-
-      if (fs.exists(tableLocation) && fs.listStatus(tableLocation).nonEmpty) {
-        throw new AnalysisException(s"Can not create the managed table('${table.identifier}')" +
-          s". The associated location('${tableLocation.toString}') already exists.")
-      }
+    // SPARK-31298: when create external table also should be a non-existent or empty
 
 Review comment:
   This looks wrong, @AngersZhuuuu . `EXTERNAL TABLE` is used to mount an exiting table location.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org