Repository navigation
[data] move _munge_conflict to parent class - #46668
Merged
Merged
Conversation
Signed-off-by: Kevin <[email protected]>
KPostOffice
requested review from
amogkam,
bveeramani,
c21,
ericl,
omatthew98,
raulchen,
scottjlee,
scv119 and
stephanie-wang
as code owners
July 16, 2024 20:35
richardliaw
approved these changes
Dec 5, 2024
ujjawal-khare
pushed a commit
to ujjawal-khare-27/ray
that referenced
this pull request
Dec 17, 2024
## Why are these changes needed? PandaDataAccessor does not have function _munge_conflict ## Related issue number closes: ray-project#46275 ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [x] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [x] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Kevin <[email protected]> Co-authored-by: Cheng Su <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
goutamvenkat-anyscale
pushed a commit
that referenced
this pull request
Sep 18, 2026
…names (#66218) ## Why Two bugs in `TableBlockAccessor`'s aggregation path, both visible from the public API. **A global aggregation over an empty dataset returns `None`.** ```python ray.data.range(10).filter(lambda row: False).aggregate(Count()) # before: None # after: {'count()': 0} ``` #66194 added an early return for zero-row blocks. That is right for a keyed aggregation — no rows means no groups — but a global aggregation always has exactly one group, and still owes its identity row. Counting an empty dataset is `0`, not "no answer". **Repeated aggregations overwrite each other's results.** ```python ray.data.range(4).aggregate(Sum("id"), Sum("id"), Sum("id")) # before: {'sum(id)': 6, 'sum(id)_2': 6} # after: {'sum(id)': 6, 'sum(id)_2': 6, 'sum(id)_3': 6} ``` `_resolve_aggregated_column_names` suffixes duplicate names, but incremented the counter for the *suffixed* name rather than the original. The original's count never advanced past one, so every duplicate after the first resolved to `_2` again. Because `_aggregate` builds rows with `row[name] = accumulator`, two aggregations sharing a name means one result is silently dropped. ## What changes - The empty-block early return in `_aggregate` is gated on there being group keys, and the `num_rows() > 0` check around `accumulate_block` is restored, so an empty group leaves the accumulators at their identity values. - `_resolve_aggregated_column_names` counts the original name and suffixes until the name is free. Looping rather than suffixing once also covers a generated suffix colliding with an aggregation explicitly named that, as in `["a", "a_2", "a"]`. It now takes the names rather than the aggregations, since that is all it reads. - `GPUAggregationPlan` carried its own copy of that loop, which resolved names differently from the CPU path — the same query returned different column names depending on the shuffle strategy. It now calls the shared helper. - Tests for both bugs in `test_dataset_aggregrations.py`. The name-collision bug predates #66194 — it dates to #20044 and survived #46668 and #50498; #66194 only lifted the loop into a helper, which is why `git blame` points there. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Aarrya <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…names (ray-project#66218) ## Why Two bugs in `TableBlockAccessor`'s aggregation path, both visible from the public API. **A global aggregation over an empty dataset returns `None`.** ```python ray.data.range(10).filter(lambda row: False).aggregate(Count()) # before: None # after: {'count()': 0} ``` ray-project#66194 added an early return for zero-row blocks. That is right for a keyed aggregation — no rows means no groups — but a global aggregation always has exactly one group, and still owes its identity row. Counting an empty dataset is `0`, not "no answer". **Repeated aggregations overwrite each other's results.** ```python ray.data.range(4).aggregate(Sum("id"), Sum("id"), Sum("id")) # before: {'sum(id)': 6, 'sum(id)_2': 6} # after: {'sum(id)': 6, 'sum(id)_2': 6, 'sum(id)_3': 6} ``` `_resolve_aggregated_column_names` suffixes duplicate names, but incremented the counter for the *suffixed* name rather than the original. The original's count never advanced past one, so every duplicate after the first resolved to `_2` again. Because `_aggregate` builds rows with `row[name] = accumulator`, two aggregations sharing a name means one result is silently dropped. ## What changes - The empty-block early return in `_aggregate` is gated on there being group keys, and the `num_rows() > 0` check around `accumulate_block` is restored, so an empty group leaves the accumulators at their identity values. - `_resolve_aggregated_column_names` counts the original name and suffixes until the name is free. Looping rather than suffixing once also covers a generated suffix colliding with an aggregation explicitly named that, as in `["a", "a_2", "a"]`. It now takes the names rather than the aggregations, since that is all it reads. - `GPUAggregationPlan` carried its own copy of that loop, which resolved names differently from the CPU path — the same query returned different column names depending on the shuffle strategy. It now calls the shared helper. - Tests for both bugs in `test_dataset_aggregrations.py`. The name-collision bug predates ray-project#66194 — it dates to ray-project#20044 and survived ray-project#46668 and ray-project#50498; ray-project#66194 only lifted the loop into a helper, which is why `git blame` points there. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Aarrya <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Why are these changes needed?
PandaDataAccessor does not have function _munge_conflict
Related issue number
closes: #46275
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.