imback82 commented on a change in pull request #34686: URL: https://github.com/apache/spark/pull/34686#discussion_r755719818
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/ExternalCatalogUtils.scala ########## @@ -258,6 +259,24 @@ object CatalogUtils { new Path(str).toUri } + def makeQualifiedNamespacePath( + locationUri: URI, + warehousePath: String, + hadoopConf: Configuration): URI = { + if (locationUri.isAbsolute) { + locationUri + } else { + val fullPath = new Path(warehousePath, CatalogUtils.URIToString(locationUri)) + makeQualifiedPath(fullPath.toUri, hadoopConf) + } + } + + def makeQualifiedPath(path: URI, hadoopConf: Configuration): URI = { + val hadoopPath = new Path(path) + val fs = hadoopPath.getFileSystem(hadoopConf) + fs.makeQualified(hadoopPath).toUri + } + Review comment: These are copied from `SessionCatalog.scala` ########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala ########## @@ -311,10 +313,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat AlterNamespaceSetPropertiesExec(catalog.asNamespaceCatalog, ns, properties) :: Nil case SetNamespaceLocation(ResolvedNamespace(catalog, ns), location) => + val nsPath = CatalogUtils.makeQualifiedNamespacePath( + CatalogUtils.stringToURI(location), conf.warehousePath, session.sharedState.hadoopConf) Review comment: `session.conf` will contain the qualified warehouse path, but using SQLConf is fine since it will be qualified anyway (same as v1): https://github.com/apache/spark/blob/c1029dcff103b1044a55b728c6c98113a255de1e/sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala#L89 ########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala ########## @@ -311,10 +313,12 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat AlterNamespaceSetPropertiesExec(catalog.asNamespaceCatalog, ns, properties) :: Nil case SetNamespaceLocation(ResolvedNamespace(catalog, ns), location) => + val nsPath = CatalogUtils.makeQualifiedNamespacePath( + CatalogUtils.stringToURI(location), conf.warehousePath, session.sharedState.hadoopConf) Review comment: This will now qualify the namespace location for v2 command. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org