Skip to content
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

FIX-#6703: don't use set_index_name(None) #6698

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

anmyachev
Copy link
Collaborator

@anmyachev anmyachev commented Nov 3, 2023

What do these changes do?

This code was added quite a long time ago. I don’t know exactly which case this fixes, but all tests pass. I suggest deleting it, since it materializes the index (and it seems to be unnecessary).

  • first commit message and PR title follow format outlined here

    NOTE: If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.

  • passes flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
  • passes black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
  • signed commit with git commit -s
  • Resolves Executing _query_compiler.set_index_name(None) seems unnecessary. #6703
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

@anmyachev anmyachev changed the title FIX-#0000: don't use 'set_index_name(None)' FIX-#6703: don't use set_index_name(None) Nov 3, 2023
@anmyachev anmyachev marked this pull request as ready for review November 4, 2023 11:14
Copy link
Collaborator

@dchigarev dchigarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the history: the set_index_name(None) was needed in the past in order to avoid propagation of the __reduced__ name into the index:

>>> df = pd.DataFrame({"a": [2, 1, 3, 4], "b": [3, 4, 5, 6]})
>>> sr = pd.Series([1, 1, 2, 2])
>>> sr._query_compiler.columns
Index(['__reduced__'], dtype='object')
>>> df.groupby(sr).sum()
             a   b
__reduced__
1            3   7
2            7  11

The _check_index_name() logic was explicitly renaming index names to None. However, at some point in time, this logic was moved to the inside of groupby kernels [1] [2], and it seems that we forgot to remove the logic from front-end.

Q: maybe this logic was kept there for HDK?
A: no, HDK only supports grouping on columns of the frame, so the case of grouping on an unnamed Series will be defaulted to pandas and so be handled correctly

@dchigarev dchigarev merged commit fb75744 into modin-project:master Nov 7, 2023
37 checks passed
@anmyachev anmyachev deleted the graft-groupby branch November 7, 2023 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Executing _query_compiler.set_index_name(None) seems unnecessary.
2 participants