Skip to content

fix(bigquery): remove PendingDeprecationWarning from RowIterator.to_arrow - #18684

Open
ohmayr wants to merge 1 commit into
mainfrom
fix/bigquery-revert-to-arrow-deprecation
Open

ohmayr wants to merge 1 commit into
mainfrom
fix/bigquery-revert-to-arrow-deprecation

Conversation

@ohmayr

@ohmayr ohmayr commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Remove the PendingDeprecationWarning from RowIterator.to_arrow() and _EmptyRowIterator.to_arrow() that was added in #18021, while keeping the pandas-gbq deprecation warning on to_dataframe().

  • Remove _TO_ARROW_DEPRECATED and the PendingDeprecationWarning in RowIterator.to_arrow() and _EmptyRowIterator.to_arrow().
  • Remove the warning filter around self.to_arrow() in RowIterator.to_dataframe().
  • Update unit tests in tests/unit/test_table.py to assert to_arrow() does not emit deprecation warnings.

…rrow

Revert the PendingDeprecationWarning added to RowIterator.to_arrow()
and _EmptyRowIterator.to_arrow() in #18021 while keeping the warning on
to_dataframe(). Direct PyArrow table and record batch reads remain
supported on RowIterator.
@ohmayr
ohmayr requested review from a team as code owners October 13, 2026 19:51
@ohmayr
ohmayr requested review from sycai and removed request for a team October 13, 2026 19:51

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

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.

Code Review

This pull request removes the deprecation warning for retrieving PyArrow Tables via google-cloud-bigquery, updating both the implementation and unit tests accordingly. A critical issue was identified in the unit tests where str(warning) is used on WarningMessage objects instead of str(warning.message). This would cause the test assertion to fail, and a code suggestion has been provided to resolve this.

sport_warnings = [w for w in warned if "sport" in str(w.message)]
self.assertEqual(len(sport_warnings), 2)
self.assertEqual(len(warned), 2)
self.assertTrue(all("sport" in str(warning) for warning in warned))

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.

medium

In Python's warnings.catch_warnings(record=True), the elements of the recorded list are warnings.WarningMessage objects, which do not override __str__ to return the warning message. Using str(warning) will return a generic object representation string (e.g., '<warnings.WarningMessage object at ...>'), causing the 'sport' in str(warning) check to fail. Please use str(warning.message) instead.

Suggested change
self.assertTrue(all("sport" in str(warning) for warning in warned))
self.assertTrue(all('sport' in str(warning.message) for warning in warned))

@ohmayr
ohmayr requested review from tswast and removed request for sycai October 13, 2026 19:54

@tswast tswast left a comment

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.

Thanks

This branch has not been deployed

No deployments
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