jamisonbennett commented on a change in pull request #23398: [SPARK-26493][SQL] 
Allow multiple spark.sql.extensions
URL: https://github.com/apache/spark/pull/23398#discussion_r244759859
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
 ##########
 @@ -103,7 +104,10 @@ class SimpleFunctionRegistry extends FunctionRegistry {
       name: FunctionIdentifier,
       info: ExpressionInfo,
       builder: FunctionBuilder): Unit = synchronized {
-    functionBuilders.put(normalizeFuncName(name), (info, builder))
+    val normalizedName = normalizeFuncName(name)
+    if (functionBuilders.put(normalizedName, (info, builder)).isDefined) {
 
 Review comment:
   I added a check which which will only log if different function objects are 
registered. The "allow an extension to be duplicated" unit tests that I 
previously added registers the same object twice. This test no longer prints 
the warning. The "use the last registered function name when there are 
duplicates" unit tests that I previously added registers different functions 
with the same name. This test prints the warning.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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