Skip to content

Commit

Permalink
Merge pull request #13471 from rapidsai/branch-23.06
Browse files Browse the repository at this point in the history
Forward-merge branch-23.06 to branch-23.08
  • Loading branch information
GPUtester authored May 30, 2023
2 parents 4384c3b + 5541e64 commit 5e12c25
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cpp/src/filling/repeat.cu
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ std::unique_ptr<table> repeat(table_view const& input_table,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
if ((input_table.num_rows() == 0) || (count == 0)) { return cudf::empty_like(input_table); }

CUDF_EXPECTS(count >= 0, "count value should be non-negative");
CUDF_EXPECTS(input_table.num_rows() <= std::numeric_limits<size_type>::max() / count,
"The resulting table exceeds the column size limit",
std::overflow_error);

if ((input_table.num_rows() == 0) || (count == 0)) { return cudf::empty_like(input_table); }

auto output_size = input_table.num_rows() * count;
auto map_begin = cudf::detail::make_counting_transform_iterator(
0, [count] __device__(auto i) { return i / count; });
Expand Down
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; }
dst_ptr += len;
}
}

Expand Down
15 changes: 15 additions & 0 deletions cpp/tests/filling/repeat_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ TYPED_TEST(RepeatTypedTestFixture, ZeroSizeInput)
CUDF_TEST_EXPECT_COLUMNS_EQUAL(p_ret->view().column(0), expected);
}

TYPED_TEST(RepeatTypedTestFixture, ZeroCount)
{
using T = TypeParam;
cudf::test::fixed_width_column_wrapper<T, int32_t> input(thrust::make_counting_iterator(0),
thrust::make_counting_iterator(10));

auto expected = cudf::make_empty_column(cudf::type_to_id<T>());

cudf::table_view input_table{{input}};
auto p_ret = cudf::repeat(input_table, 0);

EXPECT_EQ(p_ret->num_columns(), 1);
CUDF_TEST_EXPECT_COLUMNS_EQUAL(p_ret->view().column(0), expected->view());
}

class RepeatStringTestFixture : public cudf::test::BaseFixture,
cudf::test::UniformRandomGenerator<cudf::size_type> {
public:
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()

0 comments on commit 5e12c25

Please sign in to comment.