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

simplifying skiprows test in test_orc.py #10783

Merged
Merged
Changes from all 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
37 changes: 23 additions & 14 deletions python/cudf/cudf/tests/test_orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,27 +301,36 @@ def test_orc_read_rows(datadir, skiprows, num_rows):
assert_eq(pdf, gdf)


def test_orc_read_skiprows(tmpdir):
def test_orc_read_skiprows():
buff = BytesIO()
df = pd.DataFrame(
{"a": [1, 0, 1, 0, None, 1, 1, 1, 0, None, 0, 0, 1, 1, 1, 1]},
dtype=pd.BooleanDtype(),
)
data = [
True,
False,
True,
False,
None,
True,
True,
True,
False,
None,
False,
False,
True,
True,
True,
True,
]
writer = pyorc.Writer(buff, pyorc.Struct(a=pyorc.Boolean()))
tuples = list(
map(
lambda x: (None,) if x[0] is pd.NA else (bool(x[0]),),
list(df.itertuples(index=False, name=None)),
)
)
writer.writerows(tuples)
writer.writerows([(d,) for d in data])
writer.close()

# testing 10 skiprows due to a boolean specific bug fix that didn't
# repro for other sizes of data
skiprows = 10

expected = cudf.read_orc(buff)[skiprows::].reset_index(drop=True)
expected = cudf.read_orc(buff)[skiprows:].reset_index(drop=True)
got = cudf.read_orc(buff, skiprows=skiprows)

assert_eq(expected, got)


Expand Down