You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/03/13 07:26:53 UTC

[GitHub] [spark] stczwd opened a new pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

stczwd opened a new pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900
 
 
   ## What changes were proposed in this pull request?
   Check the namespace existence while calling "use namespace", and throw NoSuchNamespaceException if namespace not exists.
   
   ### Why are the changes needed?
   Users need to know that the namespace does not exist when they try to set a wrong namespace.
   
   ### Does this PR introduce any user-facing change?
   No
   
   
   ### How was this patch tested?
   Run all suites and add a test for this
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#issuecomment-598588010
 
 
   Can one of the admins verify this patch?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] stczwd commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
stczwd commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#issuecomment-599846503
 
 
   cc @rxin @xuanyuanking 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] stczwd commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
stczwd commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#issuecomment-598588074
 
 
   cc @HyukjinKwon @cloud-fan @dongjoon-hyun 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#issuecomment-598587653
 
 
   Can one of the admins verify this patch?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] stczwd commented on a change in pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
stczwd commented on a change in pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#discussion_r393449523
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
 ##########
 @@ -106,13 +106,14 @@ class CatalogManager(
   }
 
   def setCurrentNamespace(namespace: Array[String]): Unit = synchronized {
-    if (currentCatalog.name() == SESSION_CATALOG_NAME) {
-      if (namespace.length != 1) {
+    currentCatalog match {
+      case _ if currentCatalog.name() == SESSION_CATALOG_NAME && namespace.length == 1 =>
+        v1SessionCatalog.setCurrentDatabase(namespace.head)
+      case catalog: SupportsNamespaces if catalog.namespaceExists(namespace) =>
+        logInfo(s"set current namespace to ${namespace.mkString(".")}")
+        _currentNamespace = Some(namespace)
+      case _ =>
         throw new NoSuchNamespaceException(namespace)
 
 Review comment:
   > It's very likely that the underlying catalog can't report namespace existence directly, but can throw namespace not found error when calling APIs like `loadTable(ident)`
   
   First, the user needs to sense whether the namespace exists.
   Secondly, Those who cannot obtain the namespace status can return true directly in namespaceExists.
   Finally, for those don't support namespaces, users should be allowed to set the defaultNamespace, I will add this.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#discussion_r393438037
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
 ##########
 @@ -106,13 +106,14 @@ class CatalogManager(
   }
 
   def setCurrentNamespace(namespace: Array[String]): Unit = synchronized {
-    if (currentCatalog.name() == SESSION_CATALOG_NAME) {
-      if (namespace.length != 1) {
+    currentCatalog match {
+      case _ if currentCatalog.name() == SESSION_CATALOG_NAME && namespace.length == 1 =>
+        v1SessionCatalog.setCurrentDatabase(namespace.head)
+      case catalog: SupportsNamespaces if catalog.namespaceExists(namespace) =>
+        logInfo(s"set current namespace to ${namespace.mkString(".")}")
+        _currentNamespace = Some(namespace)
+      case _ =>
         throw new NoSuchNamespaceException(namespace)
 
 Review comment:
   And we should allow users to set current namespace when working with these catalogs.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#issuecomment-598587653
 
 
   Can one of the admins verify this patch?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27900: [SPARK-31100][SQL] Check namespace existens when setting namespace
URL: https://github.com/apache/spark/pull/27900#discussion_r393437946
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
 ##########
 @@ -106,13 +106,14 @@ class CatalogManager(
   }
 
   def setCurrentNamespace(namespace: Array[String]): Unit = synchronized {
-    if (currentCatalog.name() == SESSION_CATALOG_NAME) {
-      if (namespace.length != 1) {
+    currentCatalog match {
+      case _ if currentCatalog.name() == SESSION_CATALOG_NAME && namespace.length == 1 =>
+        v1SessionCatalog.setCurrentDatabase(namespace.head)
+      case catalog: SupportsNamespaces if catalog.namespaceExists(namespace) =>
+        logInfo(s"set current namespace to ${namespace.mkString(".")}")
+        _currentNamespace = Some(namespace)
+      case _ =>
         throw new NoSuchNamespaceException(namespace)
 
 Review comment:
   It's very likely that the underlying catalog can't report namespace existence directly, but can throw namespace not found error when calling APIs like `loadTable(ident)`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org