Repository navigation
Conversation
…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.
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
| self.assertTrue(all("sport" in str(warning) for warning in warned)) | |
| self.assertTrue(all('sport' in str(warning.message) for warning in warned)) |
Remove the
PendingDeprecationWarningfromRowIterator.to_arrow()and_EmptyRowIterator.to_arrow()that was added in #18021, while keeping thepandas-gbqdeprecation warning onto_dataframe()._TO_ARROW_DEPRECATEDand thePendingDeprecationWarninginRowIterator.to_arrow()and_EmptyRowIterator.to_arrow().self.to_arrow()inRowIterator.to_dataframe().tests/unit/test_table.pyto assertto_arrow()does not emit deprecation warnings.