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

[REVIEW] Fix some warnings in test_parquet.py #10416

Merged
merged 5 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/cudf/cudf/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def read_parquet(
# (There is a good chance this was not the intention)
if engine != "cudf":
warnings.warn(
"Using CPU via PyArrow to read Parquet dataset."
"Using CPU via PyArrow to read Parquet dataset. "
"This option is both inefficient and unstable!"
)
if filters is not None:
Expand Down
31 changes: 25 additions & 6 deletions python/cudf/cudf/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ def test_parquet_reader_list_table(tmpdir):
expect.to_parquet(fname)
assert os.path.exists(fname)
got = cudf.read_parquet(fname)
assert_eq(expect, got, check_dtype=False)
assert pa.Table.from_pandas(expect).equals(got.to_arrow())


def int_gen(first_val, i):
Expand Down Expand Up @@ -1051,7 +1051,7 @@ def test_parquet_reader_list_large_mixed(tmpdir):
expect.to_parquet(fname)
assert os.path.exists(fname)
got = cudf.read_parquet(fname)
assert_eq(expect, got, check_dtype=False)
assert pa.Table.from_pandas(expect).equals(got.to_arrow())


def test_parquet_reader_list_large_multi_rowgroup(tmpdir):
Expand Down Expand Up @@ -1121,7 +1121,10 @@ def test_parquet_reader_list_skiprows(skip, tmpdir):

expect = src.iloc[skip:]
got = cudf.read_parquet(fname, skiprows=skip)
assert_eq(expect, got, check_dtype=False)
if expect.empty:
assert_eq(expect, got)
else:
assert pa.Table.from_pandas(expect).equals(got.to_arrow())


@pytest.mark.parametrize("skip", [0, 1, 5, 10])
Expand All @@ -1145,7 +1148,7 @@ def test_parquet_reader_list_num_rows(skip, tmpdir):
rows_to_read = min(3, (num_rows - skip) - 5)
expect = src.iloc[skip:].head(rows_to_read)
got = cudf.read_parquet(fname, skiprows=skip, num_rows=rows_to_read)
assert_eq(expect, got, check_dtype=False)
assert pa.Table.from_pandas(expect).equals(got.to_arrow())


def struct_gen(gen, skip_rows, num_rows, include_validity=False):
Expand Down Expand Up @@ -2005,7 +2008,15 @@ def test_parquet_nullable_boolean(tmpdir, engine):
expected_gdf = cudf.DataFrame({"a": [True, False, None, True, False]})

pdf.to_parquet(pandas_path)
actual_gdf = cudf.read_parquet(pandas_path, engine=engine)
if engine == "pyarrow":
with pytest.warns(
UserWarning,
match="Using CPU via PyArrow to read Parquet dataset. This option "
"is both inefficient and unstable!",
):
actual_gdf = cudf.read_parquet(pandas_path, engine=engine)
else:
actual_gdf = cudf.read_parquet(pandas_path, engine=engine)
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

assert_eq(actual_gdf, expected_gdf)

Expand Down Expand Up @@ -2079,7 +2090,15 @@ def test_parquet_allnull_str(tmpdir, engine):
)

pdf.to_parquet(pandas_path)
actual_gdf = cudf.read_parquet(pandas_path, engine=engine)
if engine == "pyarrow":
with pytest.warns(
UserWarning,
match="Using CPU via PyArrow to read Parquet dataset. This option "
"is both inefficient and unstable!",
):
actual_gdf = cudf.read_parquet(pandas_path, engine=engine)
else:
actual_gdf = cudf.read_parquet(pandas_path, engine=engine)
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved

assert_eq(actual_gdf, expected_gdf)

Expand Down