Skip to content

Commit 88b8dc2

Browse files
cloud-fanyaooqinn
authored andcommitted
[SPARK-46937][SQL][FOLLOWUP] Properly check registered function replacement
### What changes were proposed in this pull request? A followup of #44976 . `ConcurrentHashMap#put` has a different semantic than the scala map, and it returns null if the key is new. We should update the checking code accordingly. ### Why are the changes needed? avoid wrong warning messages ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? manual ### Was this patch authored or co-authored using generative AI tooling? no Closes #46876 from cloud-fan/log. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Kent Yao <[email protected]>
1 parent c4f720d commit 88b8dc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ trait SimpleFunctionRegistryBase[T] extends FunctionRegistryBase[T] with Logging
222222
builder: FunctionBuilder): Unit = {
223223
val newFunction = (info, builder)
224224
functionBuilders.put(name, newFunction) match {
225-
case previousFunction if previousFunction != newFunction =>
225+
case previousFunction if previousFunction != null =>
226226
logWarning(log"The function ${MDC(FUNCTION_NAME, name)} replaced a " +
227227
log"previously registered function.")
228228
case _ =>

0 commit comments

Comments
 (0)