Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/12812#discussion_r61934454
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
---
@@ -81,14 +90,29 @@ class SessionCatalog(
if (conf.caseSensitiveAnalysis) name else name.toLowerCase
}
+ /**
+ * This method is used to make the given path qualified before we
+ * store this path in the underlying external catalog. So, when a path
+ * does not contain a scheme, this path will not be changed after the
default
+ * FileSystem is changed.
+ */
+ private def makeQualifiedPath(path: String): Path = {
+ val hadoopPath = new Path(path)
+ val fs = hadoopPath.getFileSystem(hadoopConf)
+ fs.makeQualified(hadoopPath)
+ }
+
//
----------------------------------------------------------------------------
// Databases
//
----------------------------------------------------------------------------
// All methods in this category interact directly with the underlying
catalog.
//
----------------------------------------------------------------------------
def createDatabase(dbDefinition: CatalogDatabase, ignoreIfExists:
Boolean): Unit = {
- externalCatalog.createDatabase(dbDefinition, ignoreIfExists)
+ val qualifiedPath =
makeQualifiedPath(dbDefinition.locationUri).toString
+ externalCatalog.createDatabase(
+ dbDefinition.copy(locationUri = qualifiedPath),
--- End diff --
Ideally we should have less dependency on Hadoop -- otherwise it is too
easy to break the API.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]