Skip to content

Commit ac1f175

Browse files
authored
fix: update pyarrow references that are warning (#31)
pyarrow as of 0.17 started indicating some future warnings for functionality that has been changed and/or relocated. As we already bumped the min version when fixing some of the testing here to get around breakages related to the transitions of 0.15, it seems reasonable to update references as well.
1 parent b15e564 commit ac1f175

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1/reader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def to_dataframe(self, message, dtypes=None):
649649
def _parse_arrow_message(self, message):
650650
self._parse_arrow_schema()
651651

652-
return pyarrow.read_record_batch(
652+
return pyarrow.ipc.read_record_batch(
653653
pyarrow.py_buffer(message.arrow_record_batch.serialized_record_batch),
654654
self._schema,
655655
)
@@ -658,7 +658,7 @@ def _parse_arrow_schema(self):
658658
if self._schema:
659659
return
660660

661-
self._schema = pyarrow.read_schema(
661+
self._schema = pyarrow.ipc.read_schema(
662662
pyarrow.py_buffer(self._read_session.arrow_schema.serialized_schema)
663663
)
664664
self._column_names = [field.name for field in self._schema]

packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1beta1/reader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ def to_dataframe(self, message, dtypes=None):
607607
def _parse_arrow_message(self, message):
608608
self._parse_arrow_schema()
609609

610-
return pyarrow.read_record_batch(
610+
return pyarrow.ipc.read_record_batch(
611611
pyarrow.py_buffer(message.arrow_record_batch.serialized_record_batch),
612612
self._schema,
613613
)
@@ -616,7 +616,7 @@ def _parse_arrow_schema(self):
616616
if self._schema:
617617
return
618618

619-
self._schema = pyarrow.read_schema(
619+
self._schema = pyarrow.ipc.read_schema(
620620
pyarrow.py_buffer(self._read_session.arrow_schema.serialized_schema)
621621
)
622622
self._column_names = [field.name for field in self._schema]

packages/google-cloud-bigquery-storage/tests/system/v1/test_reader_dataframe_v1.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ def test_read_v1(client, project_id):
4646

4747
assert tbl.num_columns == 4
4848
schema = tbl.schema
49-
# Use field_by_name because the order doesn't currently match that of
50-
# selected_fields.
51-
assert pyarrow.types.is_int64(schema.field_by_name("station_id").type)
52-
assert pyarrow.types.is_float64(schema.field_by_name("latitude").type)
53-
assert pyarrow.types.is_float64(schema.field_by_name("longitude").type)
54-
assert pyarrow.types.is_string(schema.field_by_name("name").type)
49+
# Use field with a name specifier as there may be ordering differences
50+
# when selected_fields is used
51+
assert pyarrow.types.is_int64(schema.field("station_id").type)
52+
assert pyarrow.types.is_float64(schema.field("latitude").type)
53+
assert pyarrow.types.is_float64(schema.field("longitude").type)
54+
assert pyarrow.types.is_string(schema.field("name").type)
5555

5656

5757
@pytest.mark.parametrize(

packages/google-cloud-bigquery-storage/tests/system/v1beta1/test_reader_dataframe_v1beta1.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ def test_read_rows_to_arrow(client, project_id):
4848

4949
assert tbl.num_columns == 4
5050
schema = tbl.schema
51-
# Use field_by_name because the order doesn't currently match that of
52-
# selected_fields.
53-
assert pyarrow.types.is_int64(schema.field_by_name("station_id").type)
54-
assert pyarrow.types.is_float64(schema.field_by_name("latitude").type)
55-
assert pyarrow.types.is_float64(schema.field_by_name("longitude").type)
56-
assert pyarrow.types.is_string(schema.field_by_name("name").type)
51+
# Use field with a name specifier as there may be ordering differences
52+
# when selected_fields is used
53+
assert pyarrow.types.is_int64(schema.field("station_id").type)
54+
assert pyarrow.types.is_float64(schema.field("latitude").type)
55+
assert pyarrow.types.is_float64(schema.field("longitude").type)
56+
assert pyarrow.types.is_string(schema.field("name").type)
5757

5858

5959
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)