dongjoon-hyun opened a new pull request, #538:
URL: https://github.com/apache/spark-connect-swift/pull/538
### What changes were proposed in this pull request?
This PR aims to support 7 HLL sketch and bitmap aggregate functions (12
declarations), which
completes the sketch function coverage of this client.
| Function | Since |
| --- | --- |
| `hll_sketch_agg`, `hll_union_agg` | 3.5.0 |
| `hll_sketch_estimate`, `hll_union` | 3.5.0 |
| `bitmap_construct_agg`, `bitmap_or_agg` | 3.5.0 |
| `bitmap_and_agg` | **4.1.0** |
The 5 aggregate functions go into `AggregateFunctions.swift`, following the
`theta_sketch_agg`,
`kll_sketch_agg_*` and `tuple_sketch_agg_*` precedents. The 2 scalar
functions live in a new
`HllSketchFunctions.swift`, mirroring `ThetaSketchFunctions.swift`.
Optional arguments follow the upstream implementations exactly and are
expressed as overloads.
`lgConfigK` gets an `Int32` overload alongside the `Column` one, since the
server requires the
`INT` type there and the existing `lit(_ value: Int)` produces a `BIGINT`
literal that would be
rejected. `allowDifferentLgConfigK` is `Union[bool, Column]` in
`hll_union_agg` and gets both a
`Bool` and a `Column` overload, while `hll_union` accepts a `Bool` only,
matching
`def hll_union(c1: Column, c2: Column, allowDifferentLgConfigK: Boolean)` in
the Scala API.
### Why are the changes needed?
To improve API coverage. These functions are available in PySpark and the
Spark SQL Scala API,
but were missing from this Swift client. The scalar `bitmap_bit_position`,
`bitmap_bucket_number` and `bitmap_count` functions are already supported,
and these three
aggregate functions complete that family.
### Does this PR introduce _any_ user-facing change?
No, this is a new addition to the API.
```swift
let df = try await spark.sql("SELECT * FROM VALUES (1), (2), (2), (3) AS
T(v)")
try await df.select(hll_sketch_estimate(hll_sketch_agg(col("v")))).show()
```
```
+----------------------------------------------+
|hll_sketch_estimate(hll_sketch_agg(v, 12)) |
+----------------------------------------------+
|3 |
+----------------------------------------------+
```
```swift
try await
df.select(bitmap_count(bitmap_construct_agg(bitmap_bit_position(col("v"))))).show()
```
```
+-------------------------------------------------------+
|bitmap_count(bitmap_construct_agg(bitmap_bit_position(v)))|
+-------------------------------------------------------+
|3 |
+-------------------------------------------------------+
```
### How was this patch tested?
Pass the CIs with a new test suite.
### 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]