-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[Data] - Add shuffle aggregation type to JoinOperator #56945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import logging | ||
| import math | ||
| from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple | ||
| from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Type | ||
|
|
||
| from ray._private.arrow_utils import get_pyarrow_version | ||
| from ray.air.util.transform_pyarrow import _is_pa_extension_type | ||
|
|
@@ -345,7 +345,16 @@ def __init__( | |
| right_columns_suffix: Optional[str] = None, | ||
| partition_size_hint: Optional[int] = None, | ||
| aggregator_ray_remote_args_override: Optional[Dict[str, Any]] = None, | ||
| shuffle_aggregation_type: Optional[Type[StatefulShuffleAggregation]] = None, | ||
| ): | ||
| if shuffle_aggregation_type is not None: | ||
| if not issubclass(shuffle_aggregation_type, StatefulShuffleAggregation): | ||
| raise TypeError( | ||
| f"shuffle_aggregation_type must be a subclass of StatefulShuffleAggregation, " | ||
| f"got {shuffle_aggregation_type}" | ||
| ) | ||
|
|
||
| aggregation_class = shuffle_aggregation_type or JoiningShuffleAggregation | ||
| super().__init__( | ||
| name_factory=( | ||
| lambda num_partitions: f"Join(num_partitions={num_partitions})" | ||
|
|
@@ -356,7 +365,7 @@ def __init__( | |
| num_partitions=num_partitions, | ||
| partition_size_hint=partition_size_hint, | ||
| partition_aggregation_factory=( | ||
| lambda aggregator_id, target_partition_ids: JoiningShuffleAggregation( | ||
| lambda aggregator_id, target_partition_ids: aggregation_class( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Shuffle Aggregation Type Handling ErrorsThe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Join Operator Fails with Custom AggregationThe |
||
| aggregator_id=aggregator_id, | ||
| join_type=join_type, | ||
| left_key_col_names=left_key_columns, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
issubclass()built-in will raise aTypeErrorifshuffle_aggregation_typeis not a class (e.g., if an instance of a class is passed). While the default error message is acceptable, we can provide a more user-friendly and consistent error message by handling this case explicitly. This improves error handling and makes debugging easier for users of this operator.