spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [spark] planga82 commented on a change in pull request #26890: [SPARK-30039][SQL] CREATE FUNCTION should do multi-catalog resolution
Date Sun, 15 Dec 2019 21:16:36 GMT
planga82 commented on a change in pull request #26890: [SPARK-30039][SQL] CREATE FUNCTION should
do multi-catalog resolution

 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 @@ -475,47 +475,45 @@ class ResolveSessionCatalog(
     case DescribeFunctionStatement(CatalogAndIdentifier(catalog, functionIdent), extended)
-      val functionIdentifier = if (isSessionCatalog(catalog)) {
-        functionIdent.asMultipartIdentifier match {
-          case Seq(db, fn) => FunctionIdentifier(fn, Some(db))
-          case Seq(fn) => FunctionIdentifier(fn, None)
-          case _ =>
-            throw new AnalysisException(s"Unsupported function name '${functionIdent.quoted}'")
-        }
-      } else {
-        throw new AnalysisException ("DESCRIBE FUNCTION is only supported in v1 catalog")
-      }
-      DescribeFunctionCommand(functionIdentifier, extended)
+      val (database, function) =
+        parseSessionCatalogFunctionIdentifier("DESCRIBE FUNCTION", catalog, functionIdent)
 Review comment:
   I'm not sure what are you proposing exactly. We could have something like that:
   case DescribeFunctionStatement(SessionCatalogAndFunction(catalog, functionIdent), extended)
   case DropFunctionStatement(SessionCatalogAndFunction(catalog, functionIdent), ifExists,
isTemp) =>
   case CreateFunctionStatement(SessionCatalogAndFunction(catalog, functionIdent),
         className, resources, isTemp, ignoreIfExists, replace) =>
   where SessionCatalogAndFunction is an extractor that tests if isSessionCatalog, something
like SessionCatalogAndTable do.
   In the case that !isSessionCatalog it implies that any of this cases match and the result
   `unresolved operator 'CreateFunctionStatement [testcat, ns1, ns2, fun]` for Create function

   How could we catch this case generically and throw a generic exception like you propose?

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:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message