planga82 commented on a change in pull request #26890: [SPARK-30039][SQL] 
CREATE FUNCTION should do multi-catalog resolution
URL: https://github.com/apache/spark/pull/26890#discussion_r357964533
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -475,47 +475,45 @@ class ResolveSessionCatalog(
         propertyKey)
 
     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:
   It would be possible in the case that we would have v2 catalog functions to 
resolve it. But for now we need to handle an specific error for this case
   
   `throw new AnalysisException(s"$sql is only supported in v1 catalog")`
   
   If we don't handle it here, we find and unresolved exception that is not 
clear.
   It is the same situation that we have with the commands that use 
parseV1Table function.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to