Thanks to visit codestin.com
Credit goes to github.com

Skip to content

perf: Fold row count ops when known #1656

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

Merged
merged 10 commits into from
Apr 29, 2025
Merged

perf: Fold row count ops when known #1656

merged 10 commits into from
Apr 29, 2025

Conversation

TrevorBergeron
Copy link
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> 🦕

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Apr 24, 2025
@TrevorBergeron TrevorBergeron marked this pull request as ready for review April 24, 2025 23:47
@TrevorBergeron TrevorBergeron requested review from a team as code owners April 24, 2025 23:47
@TrevorBergeron TrevorBergeron requested a review from sycai April 24, 2025 23:47
from bigframes.operations import aggregations


def fold_row_counts(node: nodes.BigFrameNode) -> nodes.BigFrameNode:
Copy link
Contributor

Choose a reason for hiding this comment

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

A naming suggestion for this module: I think we can name the file as "row_counts"

The good thing is that if you want to add more re-write functions for row_counts in the future, they will all look like this row_counts.expand(..), row_counts.reverse(...), which keeps the code organized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fold_row_count isn't the module though, core.compile.rewrite is. For now this file just defines a single symbol, so figure best to be as precise as possible? Easy enough to change later if add more to this file.

.to_pydict()
.values()
)
)[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to check and fail fast if the number of values is not equal to 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually pulled this in to the execute result object itself, and add asserts

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Apr 28, 2025
@TrevorBergeron TrevorBergeron requested a review from sycai April 29, 2025 16:35
@TrevorBergeron TrevorBergeron merged commit c958dbe into main Apr 29, 2025
20 of 24 checks passed
@TrevorBergeron TrevorBergeron deleted the fold_len branch April 29, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants