Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22466#discussion_r226536735
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -207,6 +207,14 @@ class SessionCatalog(
               "you cannot create a database with this name.")
         }
         validateName(dbName)
    +    // SPARK-25464 fail if DB location exists and is not empty
    +    val dbPath = new Path(dbDefinition.locationUri)
    +    val fs = dbPath.getFileSystem(hadoopConf)
    +    if (!externalCatalog.databaseExists(dbName) && fs.exists(dbPath)
    +      && fs.listStatus(dbPath).nonEmpty) {
    --- End diff --
    
    Should we necessarily list up files? it's potentially expensive. 


---

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

Reply via email to