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

deps: expand pyarrow dependencies to include version 2 #368

Merged
merged 3 commits into from Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -46,12 +46,12 @@
# grpc.Channel.close() method isn't added until 1.32.0.
# https://github.com/grpc/grpc/pull/15254
"grpcio >= 1.32.0, < 2.0dev",
"pyarrow >= 1.0.0, < 2.0dev",
"pyarrow >= 1.0.0, < 3.0dev",
],
"pandas": [
"pandas>=0.23.0",
# pyarrow 1.0.0 is required for the use of timestamp_as_object keyword.
"pyarrow >= 1.0.0, < 2.0dev",
"pyarrow >= 1.0.0, < 3.0dev",
],
"tqdm": ["tqdm >= 4.7.4, <5.0.0dev"],
"opentelemetry": [
Expand Down
16 changes: 15 additions & 1 deletion tests/unit/test_table.py
Expand Up @@ -19,6 +19,7 @@
import warnings

import mock
import pkg_resources
import pytest
import six

Expand All @@ -41,8 +42,11 @@
try:
import pyarrow
import pyarrow.types

PYARROW_VERSION = pkg_resources.parse_version(pyarrow.__version__)
except ImportError: # pragma: NO COVER
pyarrow = None
PYARROW_VERSION = pkg_resources.parse_version("0.0.1")

try:
from tqdm import tqdm
Expand All @@ -52,6 +56,9 @@
from google.cloud.bigquery.dataset import DatasetReference


PYARROW_TIMESTAMP_VERSION = pkg_resources.parse_version("2.0.0")


def _mock_client():
from google.cloud.bigquery import client

Expand Down Expand Up @@ -2339,12 +2346,19 @@ def test_to_dataframe_timestamp_out_of_pyarrow_bounds(self):

df = row_iterator.to_dataframe(create_bqstorage_client=False)

tzinfo = None
if PYARROW_VERSION >= PYARROW_TIMESTAMP_VERSION:
tzinfo = dt.timezone.utc

self.assertIsInstance(df, pandas.DataFrame)
self.assertEqual(len(df), 2) # verify the number of rows
self.assertEqual(list(df.columns), ["some_timestamp"])
self.assertEqual(
list(df["some_timestamp"]),
[dt.datetime(4567, 1, 1), dt.datetime(9999, 12, 31)],
[
dt.datetime(4567, 1, 1, tzinfo=tzinfo),
dt.datetime(9999, 12, 31, tzinfo=tzinfo),
],
)

@pytest.mark.xfail(
Expand Down