You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2026/09/04 03:59:41 UTC

[PR] [SPARK-59241] Support Theta, KLL and Tuple sketch functions [spark-connect-swift]

dongjoon-hyun opened a new pull request, #537:
URL: https://github.com/apache/spark-connect-swift/pull/537

   ### What changes were proposed in this pull request?
   
   This PR aims to support 52 Datasketches sketch functions (86 declarations).
   
   The KLL functions have three element-type variants (`_bigint`, `_double`, `_float`) and the
   Tuple functions have two summary-type variants (`_double`, `_integer`).
   
   | Function | Since |
   | --- | --- |
   | `theta_sketch_agg`, `theta_union_agg`, `theta_intersection_agg` | 4.1.0 |
   | `theta_sketch_estimate`, `theta_union`, `theta_intersection`, `theta_difference` | 4.1.0 |
   | `kll_sketch_agg_<T>` | 4.1.0 |
   | `kll_merge_agg_<T>` | **4.1.2** |
   | `kll_sketch_get_n_<T>`, `kll_sketch_get_quantile_<T>`, `kll_sketch_get_rank_<T>` | 4.1.0 |
   | `kll_sketch_merge_<T>`, `kll_sketch_to_string_<T>` | 4.1.0 |
   | `tuple_sketch_agg_<T>`, `tuple_union_agg_<T>`, `tuple_intersection_agg_<T>` | 4.2.0 |
   | `tuple_sketch_estimate_<T>`, `tuple_sketch_summary_<T>`, `tuple_sketch_theta_<T>` | 4.2.0 |
   | `tuple_union_<T>`, `tuple_union_theta_<T>` | 4.2.0 |
   | `tuple_intersection_<T>`, `tuple_intersection_theta_<T>` | 4.2.0 |
   | `tuple_difference_<T>`, `tuple_difference_theta_<T>` | 4.2.0 |
   
   The 37 scalar functions live in three new files, `ThetaSketchFunctions.swift`,
   `KllSketchFunctions.swift` and `TupleSketchFunctions.swift`. The 15 aggregate functions go
   into `AggregateFunctions.swift`, following the existing `count_min_sketch`,
   `schema_of_variant_agg` and `vector_avg` precedents.
   
   Optional arguments follow the upstream PySpark implementations exactly. Most functions omit
   `lgNomEntries` / `k` / `mode` when they are not given, so the argument count varies and they
   are expressed as overloads, like the existing `hmac`. The exceptions are
   `tuple_sketch_agg_*`, `tuple_union_agg_*`, `tuple_union_*` and `tuple_union_theta_*`, which
   always send `lgNomEntries` and `mode` filled with `12` and `"sum"`; these use labeled Swift
   default argument values, like the existing `aes_encrypt`.
   
   An `Int32` overload is provided for `lgNomEntries` and `k` 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.
   
   ### 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, where `count_min_sketch` was the only
   supported sketch function.
   
   ### 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(theta_sketch_estimate(theta_sketch_agg(col("v")))).show()
   ```
   
   ```
   +--------------------------------------------------+
   |theta_sketch_estimate(theta_sketch_agg(v))        |
   +--------------------------------------------------+
   |3                                                 |
   +--------------------------------------------------+
   ```
   
   ### How was this patch tested?
   
   Pass the CIs with three new test suites, `ThetaSketchFunctionsTests`,
   `KllSketchFunctionsTests` and `TupleSketchFunctionsTests` (18 tests).
   
   ### 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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-59241] Support Theta, KLL and Tuple sketch functions [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #537:
URL: https://github.com/apache/spark-connect-swift/pull/537#issuecomment-5537040198

   Merged to main


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-59241] Support Theta, KLL and Tuple sketch functions [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #537: [SPARK-59241] Support Theta, KLL and Tuple sketch functions
URL: https://github.com/apache/spark-connect-swift/pull/537


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-59241] Support Theta, KLL and Tuple sketch functions [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #537:
URL: https://github.com/apache/spark-connect-swift/pull/537#issuecomment-5537036440

   Thank you always, Liang-Chi!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org