[SPARK-55558][SQL] Add support for Tuple/Theta set operations#54338
Open
cboumalh wants to merge 8 commits intoapache:masterfrom
Open
[SPARK-55558][SQL] Add support for Tuple/Theta set operations#54338cboumalh wants to merge 8 commits intoapache:masterfrom
cboumalh wants to merge 8 commits intoapache:masterfrom
Conversation
Contributor
Author
Contributor
|
I asked a question offline, we can think about tradeoffs between adding new functionality from these functions versus increasing complexity in the API. |
Contributor
|
We talked offline, it looks like there is a valid use case for this. We can proceed with the review. |
Contributor
|
@cboumalh do you want to sync the latest master branch contents and push a commit to resolve the merge conflicts? |
dtenedor
reviewed
Feb 18, 2026
Contributor
dtenedor
left a comment
There was a problem hiding this comment.
Thanks for working on this! Generally looks OK. I tried to think of testing ideas.
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/tupleDifference.scala
Show resolved
Hide resolved
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
Show resolved
Hide resolved
Contributor
Author
|
@dtenedor Thanks for taking a look! I addressed your comments. Please let me know if there is anything I missed 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR adds support for set operations (union, intersection, difference) between Apache DataSketches TupleSketch and ThetaSketch objects. Specifically, it adds the following new SQL functions:
New Functions:
tuple_union_theta_double - Unions a TupleSketch (with double summaries) with a ThetaSketch
tuple_union_theta_integer - Unions a TupleSketch (with integer summaries) with a ThetaSketch
tuple_intersection_theta_double - Intersects a TupleSketch (with double summaries) with a ThetaSketch
tuple_intersection_theta_integer - Intersects a TupleSketch (with integer summaries) with a ThetaSketch
tuple_difference_theta_double - Subtracts a ThetaSketch from a TupleSketch (with double summaries)
tuple_difference_theta_integer - Subtracts a ThetaSketch from a TupleSketch (with integer summaries)
https://issues.apache.org/jira/browse/SPARK-55558
Why are the changes needed?
This PR extends the existing TupleSketch functionality to support interoperability with ThetaSketch objects. Previously, users could only perform set operations between two TupleSketches or two ThetaSketches, but not between different sketch types. This enhancement allows users to:
Does this PR introduce any user-facing change?
Yes. This PR adds six new SQL functions for performing set operations between TupleSketch and ThetaSketch objects:
How was this patch tested?
Comprehensive SQL tests were added in sql-tests/inputs/tuplesketch.sql.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Sonnet 4.5