-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(table): implement list_unique and Set aggregation (#3710)
Implements `agg_set` aggregation expression requested in #3661. This aggregation is similar to `agg_list` but only keeps distinct elements in the resulting list. Key features: 1. `agg_set()`: Creates a list of distinct elements in a group - Similar interface to existing `agg_list()` - Automatically deduplicates non-null elements - Preserves null lists (when entire list is null) 2. Implementation details: - Built on top of `agg_list()` and new `list_unique()` operation - Handles both regular and fixed-size lists - Maintains order of first occurrence for each unique element Example usage: ```python # Similar to agg_list() but with distinct elements df.groupby("key").agg([ df["values"].agg_set() # Creates list of unique elements per group ]) # Before: agg_list() df.agg([col("values").agg_list()]) # {"values": [[1, None, 2, 2, 1]]} # After: agg_set() df.agg([col("values").agg_set()]) # {"values": [[1, 2]]} # Nulls within lists are excluded ```
- Loading branch information
Showing
29 changed files
with
1,019 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.