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

Rename get_sliced_child to sliced_child. #10881

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions cpp/include/cudf/detail/gather.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ struct column_gatherer_impl<list_view> {
// the nesting case.
if (list.child().type() == cudf::data_type{type_id::LIST}) {
// gather children
auto child = lists::detail::gather_list_nested(list.get_sliced_child(stream), gd, stream, mr);
auto child = lists::detail::gather_list_nested(list.sliced_child(stream), gd, stream, mr);

// return the final column
return make_lists_column(gather_map_size,
Expand All @@ -363,7 +363,7 @@ struct column_gatherer_impl<list_view> {
}

// it's a leaf. do a regular gather
auto child = lists::detail::gather_list_leaf(list.get_sliced_child(stream), gd, stream, mr);
auto child = lists::detail::gather_list_leaf(list.sliced_child(stream), gd, stream, mr);

// assemble final column
return make_lists_column(gather_map_size,
Expand Down Expand Up @@ -461,7 +461,7 @@ struct column_gatherer_impl<struct_view> {
thrust::make_counting_iterator(column.num_children()),
std::back_inserter(sliced_children),
[structs_view = structs_column_view{column}](auto const idx) {
return structs_view.get_sliced_child(idx);
return structs_view.sliced_child(idx);
});

std::vector<std::unique_ptr<cudf::column>> output_struct_members;
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/cudf/lists/lists_column_view.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2022, 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 @@ -85,11 +85,11 @@ class lists_column_view : private column_view {
* Slice/split offset values are only stored at the root level of a list column.
* So when doing computations on them, we need to apply that offset to
* the child columns when recursing. Most functions operating in a recursive manner
* on lists columns should be using `get_sliced_child()` instead of `child()`.
* on lists columns should be using `sliced_child()` instead of `child()`.
*
* @throw cudf::logic error if this is an empty column
*/
[[nodiscard]] column_view get_sliced_child(rmm::cuda_stream_view stream) const;
[[nodiscard]] column_view sliced_child(rmm::cuda_stream_view stream) const;

/**
* @brief Return first offset (accounting for column offset)
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cudf/structs/structs_column_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ class structs_column_view : public column_view {
* Slice/split offset values are only stored at the root level of a struct column.
* So when doing computations on them, we need to apply that offset to
* the child columns when recursing. Most functions operating in a recursive manner
* on struct columns should be using `get_sliced_child()` instead of `child()`.
* on struct columns should be using `sliced_child()` instead of `child()`.
*
* @throw cudf::logic error if this is an empty column
*/
[[nodiscard]] column_view get_sliced_child(int index) const;
[[nodiscard]] column_view sliced_child(int index) const;
}; // class structs_column_view;
/** @} */ // end of group
} // namespace cudf
4 changes: 2 additions & 2 deletions cpp/src/copying/concatenate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void traverse_children::operator()<cudf::struct_view>(host_span<column_view cons
std::back_inserter(nth_children),
[child_index, stream](column_view const& col) {
structs_column_view scv(col);
return scv.get_sliced_child(child_index);
return scv.sliced_child(child_index);
});

bounds_and_type_check(nth_children, stream);
Expand All @@ -434,7 +434,7 @@ void traverse_children::operator()<cudf::list_view>(host_span<column_view const>
std::transform(
cols.begin(), cols.end(), std::back_inserter(nth_children), [stream](column_view const& col) {
lists_column_view lcv(col);
return lcv.get_sliced_child(stream);
return lcv.sliced_child(stream);
});
bounds_and_type_check(nth_children, stream);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/copying/contiguous_split.cu
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ std::pair<src_buf_info*, size_type> buf_info_functor::operator()<cudf::struct_vi
std::transform(thrust::make_counting_iterator(0),
thrust::make_counting_iterator(scv.num_children()),
std::back_inserter(sliced_children),
[&scv](size_type child_index) { return scv.get_sliced_child(child_index); });
[&scv](size_type child_index) { return scv.sliced_child(child_index); });
return setup_source_buf_info(sliced_children.begin(),
sliced_children.end(),
head,
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/groupby/sort/group_merge_lists.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, 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 @@ -58,7 +58,7 @@ std::unique_ptr<column> group_merge_lists(column_view const& values,

// The child column of the output lists column is just copied from the input column.
auto child_column =
std::make_unique<column>(lists_column_view(values).get_sliced_child(stream), stream, mr);
std::make_unique<column>(lists_column_view(values).sliced_child(stream), stream, mr);

return make_lists_column(num_groups,
std::move(offsets_column),
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/groupby/sort/group_scan_util.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ struct group_scan_functor<K,
//
// Gather the children elements of the prefix min/max struct elements first.
//
// Typically, we should use `get_sliced_child` for each child column to properly handle the
// Typically, we should use `sliced_child` for each child column to properly handle the
// input if it is a sliced view. However, since the input to this function is just generated
// from groupby internal APIs which is never a sliced view, we just use `child_begin` and
// `child_end` iterators for simplicity.
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/lists/apply_boolean_mask.cu
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ std::unique_ptr<column> apply_boolean_mask(lists_column_view const& input,

auto constexpr offset_data_type = data_type{type_id::INT32};

auto const boolean_mask_sliced_child = boolean_mask.get_sliced_child(stream);
auto const boolean_mask_sliced_child = boolean_mask.sliced_child(stream);

auto const make_filtered_child = [&] {
auto filtered =
cudf::detail::apply_boolean_mask(
cudf::table_view{{input.get_sliced_child(stream)}}, boolean_mask_sliced_child, stream, mr)
cudf::table_view{{input.sliced_child(stream)}}, boolean_mask_sliced_child, stream, mr)
->release();
return std::move(filtered.front());
};
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/lists/combine/concatenate_list_elements.cu
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::unique_ptr<column> concatenate_lists_ignore_null(column_view const& input,

// The child column of the output lists column is just copied from the input column.
auto out_entries = std::make_unique<column>(
lists_column_view(lists_column_view(input).get_sliced_child(stream)).get_sliced_child(stream),
lists_column_view(lists_column_view(input).sliced_child(stream)).sliced_child(stream),
stream,
mr);

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/lists/copying/concatenate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ std::unique_ptr<column> merge_offsets(host_span<lists_column_view const> columns
d_merged_offsets.begin<size_type>() + count,
[local_shift] __device__(size_type offset) { return offset + local_shift; });

shift += c.get_sliced_child(stream).size();
shift += c.sliced_child(stream).size();
count += c.size();
}
});
Expand Down Expand Up @@ -112,7 +112,7 @@ std::unique_ptr<column> concatenate(
[&total_list_count, &children, stream](lists_column_view const& l) {
// count total # of lists
total_list_count += l.size();
children.push_back(l.get_sliced_child(stream));
children.push_back(l.sliced_child(stream));
});
auto data = cudf::detail::concatenate(children, stream, mr);

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/lists/copying/gather.cu
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ std::unique_ptr<column> gather_list_nested(cudf::lists_column_view const& list,
// the nesting case.
if (list.child().type() == cudf::data_type{type_id::LIST}) {
// gather children.
auto child = gather_list_nested(list.get_sliced_child(stream), child_gd, stream, mr);
auto child = gather_list_nested(list.sliced_child(stream), child_gd, stream, mr);

// return the nested column
return make_lists_column(gather_map_size,
Expand All @@ -186,7 +186,7 @@ std::unique_ptr<column> gather_list_nested(cudf::lists_column_view const& list,
}

// it's a leaf. do a regular gather
auto child = gather_list_leaf(list.get_sliced_child(stream), child_gd, stream, mr);
auto child = gather_list_leaf(list.sliced_child(stream), child_gd, stream, mr);

// assemble final column
return make_lists_column(gather_map_size,
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/lists/copying/segmented_gather.cu
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ std::unique_ptr<column> segmented_gather(lists_column_view const& value_column,
CUDF_EXPECTS(value_column.size() == gather_map.size(),
"Gather map and list column should be same size");

auto const gather_map_sliced_child = gather_map.get_sliced_child(stream);
auto const gather_map_sliced_child = gather_map.sliced_child(stream);
auto const gather_map_size = gather_map_sliced_child.size();
auto const gather_index_begin = gather_map.offsets_begin() + 1;
auto const gather_index_end = gather_map.offsets_end();
Expand Down Expand Up @@ -80,7 +80,7 @@ std::unique_ptr<column> segmented_gather(lists_column_view const& value_column,
auto child_gather_index_begin = cudf::detail::make_counting_transform_iterator(0, transformer);

// Call gather on child of value_column
auto child_table = cudf::detail::gather(table_view({value_column.get_sliced_child(stream)}),
auto child_table = cudf::detail::gather(table_view({value_column.sliced_child(stream)}),
child_gather_index_begin,
child_gather_index_begin + gather_map_size,
bounds_policy,
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/lists/drop_list_duplicates.cu
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct has_negative_nans_dispatch {
return std::any_of(thrust::make_counting_iterator(0),
thrust::make_counting_iterator(input.num_children()),
[structs_view = structs_column_view{input}, stream](auto const child_idx) {
auto const col = structs_view.get_sliced_child(child_idx);
auto const col = structs_view.sliced_child(child_idx);
return type_dispatcher(
col.type(), has_negative_nans_dispatch{}, col, stream);
});
Expand Down Expand Up @@ -139,7 +139,7 @@ struct replace_negative_nans_dispatch {
thrust::make_counting_iterator(input.num_children()),
std::back_inserter(output_struct_members),
[structs_view = structs_column_view{input}, stream](auto const child_idx) {
auto const col = structs_view.get_sliced_child(child_idx);
auto const col = structs_view.sliced_child(child_idx);
return type_dispatcher(
col.type(), replace_negative_nans_dispatch{}, col, stream);
});
Expand Down Expand Up @@ -568,7 +568,7 @@ std::pair<std::unique_ptr<column>, std::unique_ptr<column>> drop_list_duplicates
}

// The child column containing list entries.
auto const keys_child = keys.get_sliced_child(stream);
auto const keys_child = keys.sliced_child(stream);

// Generate a mapping from list entries to their 1-based list indices for the keys column.
auto const entries_list_indices =
Expand Down Expand Up @@ -603,9 +603,8 @@ std::pair<std::unique_ptr<column>, std::unique_ptr<column>> drop_list_duplicates
}
}();

auto const sorting_table = values
? table_view{{keys_child, values.value().get_sliced_child(stream)}}
: table_view{{keys_child}};
auto const sorting_table = values ? table_view{{keys_child, values.value().sliced_child(stream)}}
: table_view{{keys_child}};
auto const sorted_table = cudf::detail::gather(sorting_table,
sorted_order->view(),
out_of_bounds_policy::DONT_CHECK,
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/lists/explode.cu
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ std::unique_ptr<table> explode(table_view const& input_table,
rmm::mr::device_memory_resource* mr)
{
lists_column_view explode_col{input_table.column(explode_column_idx)};
auto sliced_child = explode_col.get_sliced_child(stream);
auto sliced_child = explode_col.sliced_child(stream);
rmm::device_uvector<size_type> gather_map(sliced_child.size(), stream);

// Sliced columns may require rebasing of the offsets.
Expand Down Expand Up @@ -150,7 +150,7 @@ std::unique_ptr<table> explode_position(table_view const& input_table,
rmm::mr::device_memory_resource* mr)
{
lists_column_view explode_col{input_table.column(explode_column_idx)};
auto sliced_child = explode_col.get_sliced_child(stream);
auto sliced_child = explode_col.sliced_child(stream);
rmm::device_uvector<size_type> gather_map(sliced_child.size(), stream);

// Sliced columns may require rebasing of the offsets.
Expand Down Expand Up @@ -198,7 +198,7 @@ std::unique_ptr<table> explode_outer(table_view const& input_table,
rmm::mr::device_memory_resource* mr)
{
lists_column_view explode_col{input_table.column(explode_column_idx)};
auto sliced_child = explode_col.get_sliced_child(stream);
auto sliced_child = explode_col.sliced_child(stream);
auto counting_iter = thrust::make_counting_iterator(0);
auto offsets = explode_col.offsets_begin();

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/lists/lists_column_view.cu
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ column_view lists_column_view::child() const
return column_view::child(child_column_index);
}

column_view lists_column_view::get_sliced_child(rmm::cuda_stream_view stream) const
column_view lists_column_view::sliced_child(rmm::cuda_stream_view stream) const
{
// if I have a positive offset, I need to slice my child
if (offset() > 0) {
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/lists/segmented_sort.cu
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ std::unique_ptr<column> sort_lists(lists_column_view const& input,
// for non-numeric columns, calls segmented_sort_by_key.
auto output_child = type_dispatcher(input.child().type(),
SegmentedSortColumn{},
input.get_sliced_child(stream),
input.sliced_child(stream),
output_offset->view(),
column_order,
null_precedence,
Expand Down Expand Up @@ -291,7 +291,7 @@ std::unique_ptr<column> stable_sort_lists(lists_column_view const& input,
return offset_index - *first;
});

auto const child = input.get_sliced_child(stream);
auto const child = input.sliced_child(stream);
auto const sorted_child_table = stable_segmented_sort_by_key(table_view{{child}},
table_view{{child}},
output_offset->view(),
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/merge/merge.cu
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ std::unique_ptr<column> column_merger::operator()<cudf::struct_view>(
auto it = cudf::detail::make_counting_transform_iterator(
0, [&, merger = column_merger{row_order_}](size_type i) {
return cudf::type_dispatcher<dispatch_storage_type>(
lhs.child(i).type(), merger, lhs.get_sliced_child(i), rhs.get_sliced_child(i), stream, mr);
lhs.child(i).type(), merger, lhs.sliced_child(i), rhs.sliced_child(i), stream, mr);
});

auto merged_children = std::vector<std::unique_ptr<column>>(it, it + lhs.num_children());
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/reductions/collect_ops.cu
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ std::unique_ptr<scalar> drop_duplicates(list_scalar const& scalar,
auto list_wrapper = lists::detail::make_lists_column_from_scalar(scalar, 1, stream, mr);
auto lcw = lists_column_view(list_wrapper->view());
auto no_dup_wrapper = lists::drop_list_duplicates(lcw, nulls_equal, nans_equal, mr);
auto no_dup = lists_column_view(no_dup_wrapper->view()).get_sliced_child(stream);
auto no_dup = lists_column_view(no_dup_wrapper->view()).sliced_child(stream);
return make_list_scalar(no_dup, stream, mr);
}

Expand All @@ -61,7 +61,7 @@ std::unique_ptr<scalar> merge_lists(lists_column_view const& col,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
auto flatten_col = col.get_sliced_child(stream);
auto flatten_col = col.sliced_child(stream);
return make_list_scalar(flatten_col, stream, mr);
}

Expand All @@ -83,7 +83,7 @@ std::unique_ptr<scalar> merge_sets(lists_column_view const& col,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
auto flatten_col = col.get_sliced_child(stream);
auto flatten_col = col.sliced_child(stream);
auto scalar = std::make_unique<list_scalar>(flatten_col, true, stream, mr);
return drop_duplicates(*scalar, nulls_equal, nans_equal, stream, mr);
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/reductions/scan/scan_inclusive.cu
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ struct scan_functor<Op, cudf::struct_view> {
gather_map.begin(),
binop_generator.binop());

// Gather the children columns of the input column. Must use `get_sliced_child` to properly
// Gather the children columns of the input column. Must use `sliced_child` to properly
// handle input in case it is a sliced view.
auto const input_children = [&] {
auto const it = cudf::detail::make_counting_transform_iterator(
0, [structs_view = structs_column_view{input}, stream](auto const child_idx) {
return structs_view.get_sliced_child(child_idx);
return structs_view.sliced_child(child_idx);
});
return std::vector<column_view>(it, it + input.num_children());
}();
Expand Down
7 changes: 3 additions & 4 deletions cpp/src/reshape/interleave_columns.cu
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ struct interleave_columns_impl<T, std::enable_if_t<std::is_same_v<T, cudf::struc
std::vector<std::unique_ptr<cudf::column>> output_struct_members;
for (size_type child_idx = 0; child_idx < num_children; ++child_idx) {
// Collect children columns from the input structs columns at index `child_idx`.
auto const child_iter =
thrust::make_transform_iterator(structs_columns.begin(), [child_idx](auto const& col) {
return structs_column_view(col).get_sliced_child(child_idx);
});
auto const child_iter = thrust::make_transform_iterator(
structs_columns.begin(),
[child_idx](auto const& col) { return structs_column_view(col).sliced_child(child_idx); });
auto children = std::vector<column_view>(child_iter, child_iter + num_columns);

auto const child_type = children.front().type();
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/strings/combine/join_list_elements.cu
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ std::unique_ptr<column> join_list_elements(lists_column_view const& lists_string
if (num_rows == 0) { return make_empty_column(type_id::STRING); }

// Accessing the child strings column of the lists column must be done by calling `child()` on the
// lists column, not `get_sliced_child()`. This is because calling to `offsets_begin()` on the
// lists column, not `sliced_child()`. This is because calling to `offsets_begin()` on the
// lists column returns a pointer to the offsets of the original lists column, which may not start
// from `0`.
auto const strings_col = strings_column_view(lists_strings_column.child());
Expand Down Expand Up @@ -260,7 +260,7 @@ std::unique_ptr<column> join_list_elements(lists_column_view const& lists_string
if (num_rows == 0) { return make_empty_column(type_id::STRING); }

// Accessing the child strings column of the lists column must be done by calling `child()` on the
// lists column, not `get_sliced_child()`. This is because calling to `offsets_begin()` on the
// lists column, not `sliced_child()`. This is because calling to `offsets_begin()` on the
// lists column returns a pointer to the offsets of the original lists column, which may not start
// from `0`.
auto const strings_col = strings_column_view(lists_strings_column.child());
Expand Down
Loading