Github user ueshin commented on a diff in the pull request: https://github.com/apache/spark/pull/22466#discussion_r226624218 --- 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 -- Oh, btw, I noticed that @gatorsmile is asking for doing the file existence check in the external catalog, not in the session catalog. Could you move this there?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org