dongjoon-hyun opened a new pull request, #599:
URL: https://github.com/apache/spark-connect-swift/pull/599
### What changes were proposed in this pull request?
This PR adds `spark.udf.registerJava` to register a Java UDF as a SQL
function, mirroring the Scala Spark Connect client. If no return type is given,
the server infers it. `registerJavaUDAF` is out of scope.
```swift
try await spark.addArtifact("/path/to/udf.jar")
try await spark.udf.registerJava("sconcat", "com.example.StringConcat",
.string)
try await spark.sql("SELECT sconcat('a', 'b')").show()
```
### Why are the changes needed?
The Scala Spark Connect client can register Java UDFs by class name, but the
Swift client cannot.
### Does this PR introduce _any_ user-facing change?
Yes, this adds new APIs: `SparkSession.udf` and
`UDFRegistration.registerJava`.
### How was this patch tested?
- Added `UDFRegistrationTests`, which checks that registering a nonexistent
class fails.
- Manually verified the positive path against `apache/spark:4.2.0`. I
uploaded a `UDF2` jar with `addArtifact`, registered it, and `SELECT
sconcat('a', 'b')` returned `ab`. This is not committed because it needs a jar
fixture.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Sonnet 5.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]