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

Fix writing of ORC files with empty rowgroups #13466

Merged
merged 2 commits into from
May 30, 2023
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
5 changes: 2 additions & 3 deletions cpp/src/io/orc/stripe_enc.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1108,11 +1108,10 @@ __global__ void __launch_bounds__(compact_streams_block_size)
for (uint32_t i = t; i < len; i += blockDim.x) {
dst_ptr[i] = src_ptr[i];
}

__syncthreads();
if (t == 0) { streams[ss.column_id][group].data_ptrs[cid] = dst_ptr; }
dst_ptr += len;
}
if (t == 0) { streams[ss.column_id][group].data_ptrs[cid] = dst_ptr; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Outside the length check.

dst_ptr += len;
}
}

Expand Down
18 changes: 18 additions & 0 deletions cpp/tests/io/orc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,4 +1788,22 @@ TEST_F(OrcChunkedWriterTest, CompStatsEmptyTable)
expect_compression_stats_empty(stats);
}

TEST_F(OrcWriterTest, EmptyRowGroup)
{
std::vector<int> ints(10000 + 5, -1);
auto mask = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i >= 10000; });
int32_col col{ints.begin(), ints.end(), mask};
table_view expected({col});

auto filepath = temp_env->get_temp_filepath("OrcEmptyRowGroup.orc");
cudf::io::orc_writer_options out_opts =
cudf::io::orc_writer_options::builder(cudf::io::sink_info{filepath}, expected);
cudf::io::write_orc(out_opts);

cudf::io::orc_reader_options in_opts =
cudf::io::orc_reader_options::builder(cudf::io::source_info{filepath});
auto result = cudf::io::read_orc(in_opts);
CUDF_TEST_EXPECT_TABLES_EQUAL(expected, result.tbl->view());
}

CUDF_TEST_PROGRAM_MAIN()