Github user srowen commented on a diff in the pull request: https://github.com/apache/spark/pull/22466#discussion_r221307039 --- 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 (0 != fileStatus.length) { --- End diff -- `if (fileStatus.nonEmpty)`? at least, flip the comparison. You can add the location to the exception message, maybe.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org