cloud-fan commented on a change in pull request #34121:
URL: https://github.com/apache/spark/pull/34121#discussion_r717187979
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -451,7 +451,7 @@ class ResolveSessionCatalog(val catalogManager:
CatalogManager)
val funcIdentifier = identifier.asFunctionIdentifier
DropFunctionCommand(funcIdentifier.database, funcIdentifier.funcName,
ifExists, isTemp)
- case CreateFunctionStatement(nameParts,
+ case CreateFunction(UnresolvedDBObjectName(nameParts, _),
Review comment:
I think we should follow `CreateNamespace` and match
`ResolvedDBObjectName(catalog, name)` with `if isSessionCatalog(catalog)`
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -451,7 +451,7 @@ class ResolveSessionCatalog(val catalogManager:
CatalogManager)
val funcIdentifier = identifier.asFunctionIdentifier
DropFunctionCommand(funcIdentifier.database, funcIdentifier.funcName,
ifExists, isTemp)
- case CreateFunctionStatement(nameParts,
+ case CreateFunction(UnresolvedDBObjectName(nameParts, _),
Review comment:
let's also add a test that for `CREATE FUNCTION a.b.c`, we should throw
a proper error saying that creating function is not supported in v2 catalog.
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -451,31 +451,34 @@ class ResolveSessionCatalog(val catalogManager:
CatalogManager)
val funcIdentifier = identifier.asFunctionIdentifier
DropFunctionCommand(funcIdentifier.database, funcIdentifier.funcName,
ifExists, isTemp)
- case CreateFunctionStatement(nameParts,
- className, resources, isTemp, ignoreIfExists, replace) =>
- if (isTemp) {
- // temp func doesn't belong to any catalog and we shouldn't resolve
catalog in the name.
- val database = if (nameParts.length > 2) {
- throw
QueryCompilationErrors.unsupportedFunctionNameError(nameParts.quoted)
- } else if (nameParts.length == 2) {
- Some(nameParts.head)
- } else {
- None
- }
- CreateFunctionCommand(
- database,
- nameParts.last,
- className,
- resources,
- isTemp,
- ignoreIfExists,
- replace)
+ case CreateTempFunction(nameParts, className, resources, ignoreIfExists,
replace) =>
+ // temp func doesn't belong to any catalog and we shouldn't resolve
catalog in the name.
+ val database = if (nameParts.length > 2) {
+ throw
QueryCompilationErrors.unsupportedFunctionNameError(nameParts.quoted)
+ } else if (nameParts.length == 2) {
+ Some(nameParts.head)
} else {
- val FunctionIdentifier(function, database) =
- parseSessionCatalogFunctionIdentifier(nameParts)
- CreateFunctionCommand(database, function, className, resources,
isTemp, ignoreIfExists,
- replace)
+ None
}
+ CreateFunctionCommand(
+ database,
+ nameParts.last,
+ className,
+ resources,
+ true,
+ ignoreIfExists,
+ replace)
+
+ case CreateFunction(ResolvedDBObjectName(catalog, name),
+ className, resources, ignoreIfExists, replace) if
isSessionCatalog(catalog) =>
+ CreateFunctionCommand(
+ Some(catalog.name),
Review comment:
this is catalog name, not database name
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]