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

Remove default null-count parameter from some libcudf factory functions #13258

Merged
merged 13 commits into from
May 5, 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
21 changes: 15 additions & 6 deletions cpp/benchmarks/join/join_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,24 @@ void BM_join(state_type& state, Join JoinFunc)
validity + size,
thrust::identity<bool>{},
cudf::get_default_stream(),
rmm::mr::get_current_device_resource())
.first;
rmm::mr::get_current_device_resource());
};

std::unique_ptr<cudf::column> build_key_column0 = [&]() {
auto [null_mask, null_count] = build_random_null_mask(build_table_size);
return Nullable ? cudf::make_numeric_column(cudf::data_type(cudf::type_to_id<key_type>()),
build_table_size,
build_random_null_mask(build_table_size))
std::move(null_mask),
null_count)
: cudf::make_numeric_column(cudf::data_type(cudf::type_to_id<key_type>()),
build_table_size);
}();
std::unique_ptr<cudf::column> probe_key_column0 = [&]() {
auto [null_mask, null_count] = build_random_null_mask(probe_table_size);
return Nullable ? cudf::make_numeric_column(cudf::data_type(cudf::type_to_id<key_type>()),
probe_table_size,
build_random_null_mask(probe_table_size))
std::move(null_mask),
null_count)
: cudf::make_numeric_column(cudf::data_type(cudf::type_to_id<key_type>()),
probe_table_size);
}();
Expand All @@ -139,12 +142,18 @@ void BM_join(state_type& state, Join JoinFunc)
// If Nullable, the new columns will be assigned new nullmasks.
auto const build_key_column1 = [&]() {
auto col = std::make_unique<cudf::column>(build_key_column0->view());
if (Nullable) { col->set_null_mask(build_random_null_mask(build_table_size)); }
if (Nullable) {
auto [null_mask, null_count] = build_random_null_mask(build_table_size);
col->set_null_mask(std::move(null_mask), null_count);
}
return col;
}();
auto const probe_key_column1 = [&]() {
auto col = std::make_unique<cudf::column>(probe_key_column0->view());
if (Nullable) { col->set_null_mask(build_random_null_mask(probe_table_size)); }
if (Nullable) {
auto [null_mask, null_count] = build_random_null_mask(probe_table_size);
col->set_null_mask(std::move(null_mask), null_count);
}
return col;
}();

Expand Down
10 changes: 5 additions & 5 deletions cpp/include/cudf/column/column_factories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ std::unique_ptr<column> make_numeric_column(
data_type type,
size_type size,
B&& null_mask,
size_type null_count = cudf::UNKNOWN_NULL_COUNT,
size_type null_count,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
{
Expand Down Expand Up @@ -158,7 +158,7 @@ std::unique_ptr<column> make_fixed_point_column(
data_type type,
size_type size,
B&& null_mask,
size_type null_count = cudf::UNKNOWN_NULL_COUNT,
size_type null_count,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
{
Expand Down Expand Up @@ -217,7 +217,7 @@ std::unique_ptr<column> make_timestamp_column(
data_type type,
size_type size,
B&& null_mask,
size_type null_count = cudf::UNKNOWN_NULL_COUNT,
size_type null_count,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
{
Expand Down Expand Up @@ -276,7 +276,7 @@ std::unique_ptr<column> make_duration_column(
data_type type,
size_type size,
B&& null_mask,
size_type null_count = cudf::UNKNOWN_NULL_COUNT,
size_type null_count,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
{
Expand Down Expand Up @@ -335,7 +335,7 @@ std::unique_ptr<column> make_fixed_width_column(
data_type type,
size_type size,
B&& null_mask,
size_type null_count = cudf::UNKNOWN_NULL_COUNT,
size_type null_count,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
{
Expand Down
9 changes: 6 additions & 3 deletions cpp/src/io/json/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ std::unique_ptr<table> create_json_keys_info_table(parse_options_view const& par
// Allocate columns to store hash value, length, and offset of each JSON object key in the input
auto const num_keys = key_counter.value(stream);
std::vector<std::unique_ptr<column>> info_columns;
info_columns.emplace_back(make_numeric_column(data_type(type_id::UINT64), num_keys));
info_columns.emplace_back(make_numeric_column(data_type(type_id::UINT16), num_keys));
info_columns.emplace_back(make_numeric_column(data_type(type_id::UINT32), num_keys));
info_columns.emplace_back(
make_numeric_column(data_type(type_id::UINT64), num_keys, mask_state::UNALLOCATED, stream));
info_columns.emplace_back(
make_numeric_column(data_type(type_id::UINT16), num_keys, mask_state::UNALLOCATED, stream));
info_columns.emplace_back(
make_numeric_column(data_type(type_id::UINT32), num_keys, mask_state::UNALLOCATED, stream));
// Create a table out of these columns to pass them around more easily
auto info_table = std::make_unique<table>(std::move(info_columns));
auto const info_table_mdv = mutable_table_device_view::create(info_table->mutable_view(), stream);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/quantiles/tdigest/tdigest_aggregation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ std::unique_ptr<column> merge_tdigests(tdigest_column_view const& tdv,
// generate cumulative weights
auto merged_weights = merged->get_column(1).view();
auto cumulative_weights = cudf::make_numeric_column(
data_type{type_id::FLOAT64}, merged_weights.size(), mask_state::UNALLOCATED);
data_type{type_id::FLOAT64}, merged_weights.size(), mask_state::UNALLOCATED, stream);
auto keys = cudf::detail::make_counting_transform_iterator(
0,
group_key_func<decltype(group_labels)>{
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/copying/utility_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ TYPED_TEST(EmptyLikeScalarTest, FixedWidth)
{
// make a column
auto input = make_fixed_width_column(
cudf::data_type{cudf::type_to_id<TypeParam>()}, 1, rmm::device_buffer{});
cudf::data_type{cudf::type_to_id<TypeParam>()}, 1, rmm::device_buffer{}, 0);
// get a scalar out of it
std::unique_ptr<cudf::scalar> sc = cudf::get_element(*input, 0);

Expand Down
7 changes: 2 additions & 5 deletions cpp/tests/fixed_point/fixed_point_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,8 @@ TYPED_TEST(FixedPointTestAllReps, FixedPointColumnWrapper)

TYPED_TEST(FixedPointTestAllReps, NoScaleOrWrongTypeID)
{
auto null_mask = cudf::create_null_mask(0, cudf::mask_state::ALL_NULL);

EXPECT_THROW(
cudf::make_fixed_point_column(cudf::data_type{cudf::type_id::INT32}, 0, std::move(null_mask)),
cudf::logic_error);
EXPECT_THROW(cudf::make_fixed_point_column(cudf::data_type{cudf::type_id::INT32}, 0),
cudf::logic_error);
}

TYPED_TEST(FixedPointTestAllReps, SimpleFixedPointColumnWrapper)
Expand Down
10 changes: 6 additions & 4 deletions java/src/main/native/src/aggregation128_utils.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -80,7 +80,8 @@ std::unique_ptr<cudf::column> extract_chunk32(cudf::column_view const &in_col, c
CUDF_EXPECTS(type.id() == cudf::type_id::INT32 || type.id() == cudf::type_id::UINT32,
"not a 32-bit integer type");
auto const num_rows = in_col.size();
auto out_col = cudf::make_fixed_width_column(type, num_rows, copy_bitmask(in_col));
auto out_col =
cudf::make_fixed_width_column(type, num_rows, copy_bitmask(in_col), in_col.null_count());
auto out_view = out_col->mutable_view();
auto const in_begin = in_col.begin<int32_t>();

Expand Down Expand Up @@ -111,8 +112,9 @@ std::unique_ptr<cudf::table> assemble128_from_sum(cudf::table_view const &chunks
"chunks type mismatch");
std::vector<std::unique_ptr<cudf::column>> columns;
columns.push_back(cudf::make_fixed_width_column(cudf::data_type{cudf::type_id::BOOL8}, num_rows,
copy_bitmask(chunks0)));
columns.push_back(cudf::make_fixed_width_column(output_type, num_rows, copy_bitmask(chunks0)));
copy_bitmask(chunks0), chunks0.null_count()));
columns.push_back(cudf::make_fixed_width_column(output_type, num_rows, copy_bitmask(chunks0),
chunks0.null_count()));
auto overflows_view = columns[0]->mutable_view();
auto assembled_view = columns[1]->mutable_view();
thrust::transform(rmm::exec_policy(stream), thrust::make_counting_iterator<cudf::size_type>(0),
Expand Down