-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-37202][SQL] Treat injectedFunctions
as custom built-in functions
#34528
Conversation
builder: FunctionBuilder): Unit = { | ||
// We didn't do any check when replacing a function even if it's a builtin one. | ||
// So no need to do any extra check here. | ||
if (name.database.isEmpty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we actually shouldn't allow function with a database here. Not sure if it's necessary to add a check here because it may break existing use cases.
@@ -171,6 +171,9 @@ case class DropFunctionCommand( | |||
if (FunctionRegistry.builtin.functionExists(FunctionIdentifier(functionName))) { | |||
throw QueryCompilationErrors.cannotDropNativeFuncError(functionName) | |||
} | |||
if (catalog.isCustomBuiltinFunction(FunctionIdentifier(functionName))) { | |||
throw QueryCompilationErrors.cannotDropCustomBuiltInFuncError(functionName) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropping a custom built-in function is fine. but it's weird if we can drop a built-in function.
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #145017 has finished for PR 34528 at commit
|
Test build #145019 has finished for PR 34528 at commit
|
typo? but fix -> bug fix? |
518d5e8
to
5547056
Compare
Kubernetes integration test unable to build dist. exiting with code: 1 |
Kubernetes integration test unable to build dist. exiting with code: 1 |
Test build #145048 has finished for PR 34528 at commit
|
close as I made another PR #34546 to fix this |
Test build #145050 has finished for PR 34528 at commit
|
What changes were proposed in this pull request?
This PR fixes an issue that the
injectedFunctions
inSparkSessionExtensions
can't beresolved correctly if it's referred by a temporary view. This is because the injected functions
are not
UserDefinedExpression
. So they will be treated as temporary functions but couldn'tbe captured as temporary functions during view creation. As a result, the function resolution
will fail if it's reffered by a temp view.
This PR adds a new concept
customBuiltinFunction
, so that the injected functions will betreated as builtin functions intead of tempoary ones. With with way, it's not needed to be
captured by temp view anymore.
Why are the changes needed?
bug fix
Does this PR introduce any user-facing change?
After this PR, the
SparkSessionExtensions.injectedFunctions
are not temporary functions anymore.How was this patch tested?
newly added test