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

Forward-merge branch-24.06 into branch-24.08 #15811

Merged
merged 1 commit into from
May 22, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cpp/src/io/orc/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,16 @@ std::vector<std::vector<rowgroup_rows>> calculate_aligned_rowgroup_bounds(
} else {
// pushdown mask present; null mask bits w/ set pushdown mask bits will be encoded
// Use the number of set bits in pushdown mask as size
auto bits_to_borrow =
8 - (d_pd_set_counts[rg_idx][parent_col_idx] - previously_borrowed) % 8;
auto bits_to_borrow = [&]() {
auto const parent_valid_count = d_pd_set_counts[rg_idx][parent_col_idx];
if (parent_valid_count < previously_borrowed) {
// Borrow to make an empty rowgroup
return previously_borrowed - parent_valid_count;
}
auto const misalignment = (parent_valid_count - previously_borrowed) % 8;
return (8 - misalignment) % 8;
}();

if (bits_to_borrow == 0) {
// Didn't borrow any bits for this rowgroup
previously_borrowed = 0;
Expand Down
Binary file not shown.
13 changes: 13 additions & 0 deletions python/cudf/cudf/tests/test_orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1954,3 +1954,16 @@ def test_writer_lz4():

got = pd.read_orc(buffer)
assert_eq(gdf, got)


def test_row_group_alignment(datadir):
path = datadir / "TestOrcFile.MapManyNulls.parquet"

expected = cudf.read_parquet(path)

buffer = BytesIO()
expected.to_orc(buffer)

got = cudf.read_orc(buffer)

assert_eq(expected, got)
Loading