Skip to content

Commit

Permalink
Catch EOFError along with StopIteration (apache#28896)
Browse files Browse the repository at this point in the history
* catch EOF instead of StopIteration

* add stop iteration to close

* catch both stop iteration and EOF
  • Loading branch information
riteshghorse committed Oct 9, 2023
1 parent 33b4168 commit e815ad2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/io/gcp/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ def __iter__(self):
def __next__(self):
try:
return fastavro.schemaless_reader(self.bytes_reader, self.avro_schema)
except StopIteration:
except (StopIteration, EOFError):
self.read_rows_response = next(self.read_rows_iterator, None)
if self.read_rows_response is not None:
self.bytes_reader = io.BytesIO(
Expand Down

0 comments on commit e815ad2

Please sign in to comment.