vladimirg-db commented on code in PR #53570:
URL: https://github.com/apache/spark/pull/53570#discussion_r2685544675
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala:
##########
@@ -78,10 +79,17 @@ trait FunctionRegistryBase[T] {
/* Create or replace a temporary function. */
final def createOrReplaceTempFunction(
name: String, builder: FunctionBuilder, source: String): Unit = {
- registerFunction(
- FunctionIdentifier(name),
- builder,
- source)
+ // Internal functions (source="internal") are NOT qualified with
+ // CatalogManager.SESSION_NAMESPACE database because they use a separate
+ // internal registry and are resolved differently
+ val identifier = if (source == "internal") {
+ FunctionIdentifier(name)
+ } else {
+ // Regular temporary functions are qualified with
CatalogManager.SESSION_NAMESPACE
+ // to enable coexistence with builtin functions of the same name
+ FunctionIdentifier(name, Some(CatalogManager.SESSION_NAMESPACE))
Review Comment:
There is a number of places where the Analyzer has special logic for
specific functions. These places expect that `UnresolvedFunction` to have a
single-part name. Here's one example:
<img width="748" height="207" alt="image"
src="https://github.com/user-attachments/assets/9eb57bb3-45fe-4e67-bb32-c5a1d9cef363"
/>
We need to find all those places and update them to handle cases when
customers reference functions by fully-qualified names.
--
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]