fix: use qualified function identifiers for temp functions - #900
Merged
SemyonSinchenko merged 1 commit intoSep 8, 2026
Merged
SemyonSinchenko merged 1 commit into
SemyonSinchenko merged 1 commit into
Conversation
Contributor
Author
|
First time contributing.. Used GraphFrames for a couple years now and it's been great!! Thank you for keeping up with it and happy to make any changes. |
Collaborator
|
Thanks for this. We used registry incorrectly, but only 4.2 explicitly forbid this, so I realized it only after the 4.2 release 😅 |
ledanieln
force-pushed
the
fix-qualified-function-identifier
branch
from
September 5, 2026 13:01
8f0f5b1 to
9676a30
Compare
Contributor
Author
|
Realized I targeted |
SemyonSinchenko
approved these changes
Sep 8, 2026
SemyonSinchenko
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
RandomizedContractionandKCorealgorithms register temporary functions_axpband_kcoreMergeby callingfunctionRegistry.registerFunctionwithFunctionIdentifierobjects with a function name string. This PR switches registration tofunctionRegistry.createOrReplaceTempFunctionwhich takes a plain name and applies the correct temporary qualifications (database and catalog) and de-registration toSessionCatalog.unregisterFunctionwhich resolves the unqualified identifier the same way.Why are the changes needed?
We hit this running
connectedComponentsusing theRandomizedContractionalgorithm on Spark 4.2:This can be reproduced by running the test suites using 4.2.0:
./build/sbt -Dspark.version=4.2.0 "testOnly *RandomizedContractionSuite *KCoreSuite". NOTE: I had to remove the legacylog4j.logger.*entries fromcore/src/test/resources/log4j2.propertiesin order to test on 4.2.0.This assert statement was introduced in apache/spark#54765 to prevent unqualified functions shadowing and colliding with builtin or session functions. The change requires all function identifiers to be fully qualified with the three keys: name, database, and catalog: https://github.com/apache/spark/blob/2a7cfea06ba135cf0ddc62902eb0daf5a835c672/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L225
CI doesn't catch this yet because the matrix covers 3.5, 4.0, and 4.1. The fix works on all currently supported versions.
createOrReplaceTempFunctionregisters under a plain string on 3.5/4.0/4.1 and under the qualified one on 4.2.unregisterFunctionmatches directly on the older versions, and on 4.2 re-qualifies viatempFunctionIdentifierwhen the database is empty.I verified with
testOnly *RandomizedContractionSuite *KCoreSuiteagainst the Spark versions 3.5.8, 4.0.3, 4.1.2 and 4.2.0 andtestagainst the versions only in the CI test matrix.