Skip to content

feat(bigframes): Support unstable sort_values, sort_index#16665

Draft
TrevorBergeron wants to merge 12 commits intomainfrom
tbergeron_unstable_sort
Draft

feat(bigframes): Support unstable sort_values, sort_index#16665
TrevorBergeron wants to merge 12 commits intomainfrom
tbergeron_unstable_sort

Conversation

@TrevorBergeron
Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements stable sorting support by adding a kind parameter to sort_values and sort_index methods and updating the underlying core logic to handle sorting stability. The review feedback recommends centralizing the list of stable sort algorithms into a constant for better maintainability and suggests several refinements to type hints and default values in method overloads. Furthermore, the reviewer identified an opportunity to propagate the kind parameter when sorting DataFrames along the column axis to ensure consistent behavior.

Comment thread packages/bigframes/third_party/bigframes_vendored/constants.py
Comment thread packages/bigframes/bigframes/core/indexes/base.py Outdated
Comment thread packages/bigframes/bigframes/dataframe.py Outdated
Comment thread packages/bigframes/bigframes/dataframe.py Outdated
Comment thread packages/bigframes/bigframes/dataframe.py Outdated
Comment thread packages/bigframes/bigframes/dataframe.py Outdated
Comment thread packages/bigframes/bigframes/dataframe.py Outdated
Comment thread packages/bigframes/bigframes/dataframe.py Outdated
Comment thread packages/bigframes/bigframes/series.py Outdated
Comment thread packages/bigframes/bigframes/series.py Outdated
TrevorBergeron and others added 11 commits April 16, 2026 12:40
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
inplace: bool = False,
ascending: bool = True,
na_position: __builtins__.str = "last",
kind: str | None = None,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Neat use of an existing pandas parameter! (https://pandas.pydata.org/docs/reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values)

Interesting opportunity here too with regards to the default in pandas not being a stable sort.

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.

2 participants