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: Ensure no double execution for to_pandas #1032

Merged
merged 2 commits into from
Oct 1, 2024
Merged

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> 🦕

Page not found · GitHub · GitHub
Skip to content
404 “This is not the web page you are looking for”
@TrevorBergeron TrevorBergeron requested review from a team as code owners October 1, 2024 00:45
@TrevorBergeron TrevorBergeron requested a review from sycai October 1, 2024 00:45
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Oct 1, 2024
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. label Oct 1, 2024
pd.testing.assert_frame_equal(
df.explode(col_names, ignore_index=ignore_index).to_pandas(),
pd_df.explode(col_names, ignore_index=ignore_index),
check_index_type=False,
check_dtype=False,
)
execs_post = metrics.execution_count
# we test this property on this method in particular as compilation
# is non-deterministic and won't use the query cache as implemented
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would also document that this is to check that the execution was performed only once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reorganized a bit to make clear that only care about executions from the to_pandas() invocation.

pd_df = df.to_pandas()
execs_pre = metrics.execution_count
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: put this line right below line 4831 or move line 4831 above this line, just to keep together statements that are related

@TrevorBergeron TrevorBergeron enabled auto-merge (squash) October 1, 2024 16:19
@TrevorBergeron TrevorBergeron merged commit 4992cc2 into main Oct 1, 2024
20 of 23 checks passed
@TrevorBergeron TrevorBergeron deleted the double_exec_fix branch October 1, 2024 17:12
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: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants