dongjoon-hyun opened a new pull request, #450: URL: https://github.com/apache/spark-connect-swift/pull/450
### What changes were proposed in this pull request? This PR aims to support `DataFrame.randomSplit` API. - `randomSplit(_ weights: [Double], _ seed: Int64) throws -> [DataFrame]` - `randomSplit(_ weights: [Double]) throws -> [DataFrame]` (with a random seed) Like the other Spark Connect clients (PySpark and Scala), it is implemented on the client side by normalizing the weights into cumulative ranges and creating one `Sample` relation per weight with the same seed, `deterministic_order = true`, and `[lowerBound, upperBound)` ranges. `SparkConnectClient.getSample` is extended to accept `lowerBound` and `deterministicOrder`. ### Why are the changes needed? To improve the API coverage by providing feature parity with the other Spark clients. ### Does this PR introduce _any_ user-facing change? No, this is a new API addition. ### How was this patch tested? Pass the CIs with a newly added test case, `DataFrameTests/randomSplit`, which verifies that the sum of the split counts equals the original count (no overlap or missing rows thanks to `deterministic_order`), that the same seed reproduces the same splits, and that empty or non-positive weights throw `SparkConnectError.InvalidArgument`. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Fable 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]
