Skip to content

Commit

Permalink
Merge pull request #12194 from vuule/bug-write_orc-compressission
Browse files Browse the repository at this point in the history
Fix compression in ORC writer
  • Loading branch information
jolorunyomi authored Nov 21, 2022
2 parents 21ba312 + 08c0c5a commit 769dfbb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cpp/src/io/orc/stripe_enc.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,9 @@ __global__ void __launch_bounds__(256)
num_blocks = (ss.stream_size > 0) ? (ss.stream_size - 1) / comp_blk_size + 1 : 1;
for (uint32_t b = t; b < num_blocks; b += 256) {
uint32_t blk_size = min(comp_blk_size, ss.stream_size - min(b * comp_blk_size, ss.stream_size));
inputs[ss.first_block + b] = {src + b * comp_blk_size, blk_size};
auto const dst_offset = b * (padded_block_header_size + padded_comp_block_size);
inputs[ss.first_block + b] = {src + b * comp_blk_size, blk_size};
auto const dst_offset =
padded_block_header_size + b * (padded_block_header_size + padded_comp_block_size);
outputs[ss.first_block + b] = {dst + dst_offset, max_comp_blk_size};
results[ss.first_block + b] = {0, compression_status::FAILURE};
}
Expand Down Expand Up @@ -1234,7 +1235,9 @@ __global__ void __launch_bounds__(1024)
? results[ss.first_block + b].bytes_written
: src_len;
uint32_t blk_size24{};
if (results[ss.first_block + b].status == compression_status::SUCCESS) {
// Only use the compressed block if it's smaller than the uncompressed
// If compression failed, dst_len == src_len, so the uncompressed block will be used
if (src_len < dst_len) {
// Copy from uncompressed source
src = inputs[ss.first_block + b].data();
results[ss.first_block + b].bytes_written = src_len;
Expand Down

0 comments on commit 769dfbb

Please sign in to comment.