dongjoon-hyun opened a new pull request, #536:
URL: https://github.com/apache/spark-connect-swift/pull/536
### What changes were proposed in this pull request?
This PR aims to support `call_function` and `call_udf` functions in a new
`UDFFunctions.swift` file.
| Function | Since | Signature |
| --- | --- | --- |
| `call_function` | 3.5.0 | `(String, Column...)` |
| `call_udf` | 3.4.0 | `(String, Column...)` |
Both are backed by the `CallFunction` protobuf node rather than the existing
internal `fn` helper which builds an `UnresolvedFunction`. This is
intentional:
the server's `SparkConnectPlanner.transformUnresolvedFunction` treats the
function name of an `UnresolvedFunction` as a **single identifier** when
`is_user_defined_function` is `false`, which is what our `fn` helper
produces.
That would break qualified names such as `call_function("db.my_func", ...)`.
In contrast, `SparkConnectPlanner.transformCallFunction` runs the name
through
`parser.parseMultipartIdentifier`, so quoted and qualified names are resolved
correctly. This matches the documented Scala contract, "function name that
follows the SQL identifier syntax (can be quoted, can be qualified)", and
matches PySpark Connect, whose `call_function` also emits a `CallFunction`
node.
`call_udf` delegates to `call_function`, mirroring Scala's
`functions.scala`, where `call_udf(udfName, cols: _*) =
call_function(udfName, cols: _*)`.
### Why are the changes needed?
For feature parity with Apache Spark.
`call_function` is especially valuable in this client because it is a general
escape hatch: it lets users invoke any SQL function available on the server,
including the ones this library has not wrapped yet.
Although this repository does not provide a UDF registration API, `call_udf`
remains useful for invoking functions registered on the server through SQL
`CREATE FUNCTION`.
### Does this PR introduce _any_ user-facing change?
No, this simply adds two new functions.
### How was this patch tested?
Pass the CIs with the newly added test suite, `UDFFunctionsTests`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]