sorting.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2022, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/aggregation.hpp>
20 #include <cudf/types.hpp>
21 
22 #include <memory>
23 #include <vector>
24 
25 namespace cudf {
26 
48 std::unique_ptr<column> sorted_order(
49  table_view const& input,
50  std::vector<order> const& column_order = {},
51  std::vector<null_order> const& null_precedence = {},
52  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
53 
62 std::unique_ptr<column> stable_sorted_order(
63  table_view const& input,
64  std::vector<order> const& column_order = {},
65  std::vector<null_order> const& null_precedence = {},
66  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
67 
85  std::vector<order> const& column_order,
86  std::vector<null_order> const& null_precedence);
87 
102 std::unique_ptr<table> sort(
103  table_view const& input,
104  std::vector<order> const& column_order = {},
105  std::vector<null_order> const& null_precedence = {},
106  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
107 
129 std::unique_ptr<table> sort_by_key(
130  table_view const& values,
131  table_view const& keys,
132  std::vector<order> const& column_order = {},
133  std::vector<null_order> const& null_precedence = {},
134  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
135 
159 std::unique_ptr<table> stable_sort_by_key(
160  table_view const& values,
161  table_view const& keys,
162  std::vector<order> const& column_order = {},
163  std::vector<null_order> const& null_precedence = {},
164  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
165 
196 std::unique_ptr<column> rank(
197  column_view const& input,
198  rank_method method,
199  order column_order,
200  null_policy null_handling,
201  null_order null_precedence,
202  bool percentage,
203  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
204 
225 std::unique_ptr<column> segmented_sorted_order(
226  table_view const& keys,
227  column_view const& segment_offsets,
228  std::vector<order> const& column_order = {},
229  std::vector<null_order> const& null_precedence = {},
230  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
231 
237 std::unique_ptr<column> stable_segmented_sorted_order(
238  table_view const& keys,
239  column_view const& segment_offsets,
240  std::vector<order> const& column_order = {},
241  std::vector<null_order> const& null_precedence = {},
242  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
243 
266 std::unique_ptr<table> segmented_sort_by_key(
267  table_view const& values,
268  table_view const& keys,
269  column_view const& segment_offsets,
270  std::vector<order> const& column_order = {},
271  std::vector<null_order> const& null_precedence = {},
272  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
273 
279 std::unique_ptr<table> stable_segmented_sort_by_key(
280  table_view const& values,
281  table_view const& keys,
282  column_view const& segment_offsets,
283  std::vector<order> const& column_order = {},
284  std::vector<null_order> const& null_precedence = {},
285  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
286  // end of group
288 } // namespace cudf
cudf::rank_method
rank_method
Tie-breaker method to use for ranking the column.
Definition: aggregation.hpp:53
cudf::null_policy
null_policy
Enum to specify whether to include nulls or exclude nulls.
Definition: types.hpp:123
cudf::sort_by_key
std::unique_ptr< table > sort_by_key(table_view const &values, table_view const &keys, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a key-value sort.
cudf::column_view
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Definition: column_view.hpp:300
types.hpp
Type declarations for libcudf.
cudf::table
A set of cudf::column's of the same size.
Definition: table.hpp:38
cudf::rank
std::unique_ptr< column > rank(column_view const &input, rank_method method, order column_order, null_policy null_handling, null_order null_precedence, bool percentage, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes the ranks of input column in sorted order.
cudf::stable_sorted_order
std::unique_ptr< column > stable_sorted_order(table_view const &input, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes the row indices that would produce input in a stable lexicographical sorted order.
cudf::segmented_sort_by_key
std::unique_ptr< table > segmented_sort_by_key(table_view const &values, table_view const &keys, column_view const &segment_offsets, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a lexicographic segmented sort of a table.
cudf::stable_sort_by_key
std::unique_ptr< table > stable_sort_by_key(table_view const &values, table_view const &keys, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a key-value stable sort.
cudf::null_order
null_order
Indicates how null values compare against all other values.
Definition: types.hpp:156
cudf::is_sorted
bool is_sorted(cudf::table_view const &table, std::vector< order > const &column_order, std::vector< null_order > const &null_precedence)
Checks whether the rows of a table are sorted in a lexicographical order.
cudf::stable_segmented_sorted_order
std::unique_ptr< column > stable_segmented_sorted_order(table_view const &keys, column_view const &segment_offsets, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Returns sorted order after stably sorting each segment in the table.
cudf::table_view
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:154
cudf::segmented_sorted_order
std::unique_ptr< column > segmented_sorted_order(table_view const &keys, column_view const &segment_offsets, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Returns sorted order after sorting each segment in the table.
cudf
cuDF interfaces
Definition: aggregation.hpp:34
cudf::sorted_order
std::unique_ptr< column > sorted_order(table_view const &input, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes the row indices that would produce input in a lexicographical sorted order.
cudf::stable_segmented_sort_by_key
std::unique_ptr< table > stable_segmented_sort_by_key(table_view const &values, table_view const &keys, column_view const &segment_offsets, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a stably lexicographic segmented sort of a table.
aggregation.hpp
Representation for specifying desired aggregations from aggregation-based APIs, e....
rmm::mr::device_memory_resource
cudf::sort
std::unique_ptr< table > sort(table_view const &input, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a lexicographic sort of the rows of a table.
cudf::order
order
Indicates the order in which elements should be sorted.
Definition: types.hpp:115