Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/22466#discussion_r223570144 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala --- @@ -207,6 +207,16 @@ 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 (fs.exists(dbPath)) { + val fileStatus = fs.listStatus(dbPath) + if (fileStatus.nonEmpty) { --- End diff -- if (fs.exists(dbPath) && fs.listStatus(dbPath).nonEmpty) {
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org