This is an automated email from the ASF dual-hosted git repository.
maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 11cebdbdd0e [SPARK-41390][SQL] Update the script used to generate
`register` function in `UDFRegistration`
11cebdbdd0e is described below
commit 11cebdbdd0e6d83cbde5f1cb5e4802a7dd5ada48
Author: yangjie01 <[email protected]>
AuthorDate: Mon Dec 5 23:11:23 2022 +0300
[SPARK-41390][SQL] Update the script used to generate `register` function
in `UDFRegistration`
### What changes were proposed in this pull request?
SPARK-35065 use `QueryCompilationErrors.invalidFunctionArgumentsError`
instead of `throw new AnalysisException(...)` for `register` function in
`UDFRegistration`, but the script used to generate `register` function has not
been updated, so this pr update the script.
### Why are the changes needed?
Update the script used to generate `register` function in `UDFRegistration`
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Manually checked the results of the script.
Closes #38916 from LuciferYang/register-func-script.
Authored-by: yangjie01 <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
---
sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala
b/sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala
index 99820336477..80550dc21d2 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala
@@ -145,8 +145,7 @@ class UDFRegistration private[sql] (functionRegistry:
FunctionRegistry) extends
| def builder(e: Seq[Expression]) = if (e.length == $x) {
| finalUdf.createScalaUDF(e)
| } else {
- | throw new AnalysisException("Invalid number of arguments for
function " + name +
- | ". Expected: $x; Found: " + e.length)
+ | throw QueryCompilationErrors.invalidFunctionArgumentsError(name,
"$x", e.length)
| }
| functionRegistry.createOrReplaceTempFunction(name, builder,
"scala_udf")
| finalUdf
@@ -171,8 +170,7 @@ class UDFRegistration private[sql] (functionRegistry:
FunctionRegistry) extends
| def builder(e: Seq[Expression]) = if (e.length == $i) {
| ScalaUDF(func, replaced, e, Nil, udfName = Some(name))
| } else {
- | throw new AnalysisException("Invalid number of arguments for
function " + name +
- | ". Expected: $i; Found: " + e.length)
+ | throw QueryCompilationErrors.invalidFunctionArgumentsError(name,
"$i", e.length)
| }
| functionRegistry.createOrReplaceTempFunction(name, builder,
"java_udf")
|}""".stripMargin)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]