libcudf  24.04.00
sorting.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2024, 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>
22 
23 #include <rmm/mr/device/per_device_resource.hpp>
24 
25 #include <memory>
26 #include <vector>
27 
28 namespace cudf {
29 
52 std::unique_ptr<column> sorted_order(
53  table_view const& input,
54  std::vector<order> const& column_order = {},
55  std::vector<null_order> const& null_precedence = {},
56  rmm::cuda_stream_view stream = cudf::get_default_stream(),
57  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
58 
67 std::unique_ptr<column> stable_sorted_order(
68  table_view const& input,
69  std::vector<order> const& column_order = {},
70  std::vector<null_order> const& null_precedence = {},
71  rmm::cuda_stream_view stream = cudf::get_default_stream(),
72  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
73 
92  std::vector<order> const& column_order,
93  std::vector<null_order> const& null_precedence,
94  rmm::cuda_stream_view stream = cudf::get_default_stream());
95 
111 std::unique_ptr<table> sort(
112  table_view const& input,
113  std::vector<order> const& column_order = {},
114  std::vector<null_order> const& null_precedence = {},
115  rmm::cuda_stream_view stream = cudf::get_default_stream(),
116  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
117 
123 std::unique_ptr<table> stable_sort(
124  table_view const& input,
125  std::vector<order> const& column_order = {},
126  std::vector<null_order> const& null_precedence = {},
127  rmm::cuda_stream_view stream = cudf::get_default_stream(),
128  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
129 
152 std::unique_ptr<table> sort_by_key(
153  table_view const& values,
154  table_view const& keys,
155  std::vector<order> const& column_order = {},
156  std::vector<null_order> const& null_precedence = {},
157  rmm::cuda_stream_view stream = cudf::get_default_stream(),
158  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
159 
165 std::unique_ptr<table> stable_sort_by_key(
166  table_view const& values,
167  table_view const& keys,
168  std::vector<order> const& column_order = {},
169  std::vector<null_order> const& null_precedence = {},
170  rmm::cuda_stream_view stream = cudf::get_default_stream(),
171  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
172 
203 std::unique_ptr<column> rank(
204  column_view const& input,
205  rank_method method,
206  order column_order,
207  null_policy null_handling,
208  null_order null_precedence,
209  bool percentage,
210  rmm::cuda_stream_view stream = cudf::get_default_stream(),
211  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
212 
256 std::unique_ptr<column> segmented_sorted_order(
257  table_view const& keys,
258  column_view const& segment_offsets,
259  std::vector<order> const& column_order = {},
260  std::vector<null_order> const& null_precedence = {},
261  rmm::cuda_stream_view stream = cudf::get_default_stream(),
262  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
263 
269 std::unique_ptr<column> stable_segmented_sorted_order(
270  table_view const& keys,
271  column_view const& segment_offsets,
272  std::vector<order> const& column_order = {},
273  std::vector<null_order> const& null_precedence = {},
274  rmm::cuda_stream_view stream = cudf::get_default_stream(),
275  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
276 
324 std::unique_ptr<table> segmented_sort_by_key(
325  table_view const& values,
326  table_view const& keys,
327  column_view const& segment_offsets,
328  std::vector<order> const& column_order = {},
329  std::vector<null_order> const& null_precedence = {},
330  rmm::cuda_stream_view stream = cudf::get_default_stream(),
331  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
332 
338 std::unique_ptr<table> stable_segmented_sort_by_key(
339  table_view const& values,
340  table_view const& keys,
341  column_view const& segment_offsets,
342  std::vector<order> const& column_order = {},
343  std::vector<null_order> const& null_precedence = {},
344  rmm::cuda_stream_view stream = cudf::get_default_stream(),
345  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
346  // end of group
348 } // namespace cudf
Representation for specifying desired aggregations from aggregation-based APIs, e....
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:187
A set of cudf::column's of the same size.
Definition: table.hpp:40
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Returns sorted order after stably sorting each segment in the table.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a stably lexicographic segmented sort of a table.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a key-value stable sort.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Returns sorted order after sorting each segment in the table.
std::unique_ptr< table > sort(table_view const &input, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a lexicographic sort of the rows of a table.
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::cuda_stream_view stream=cudf::get_default_stream(), 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.
bool is_sorted(cudf::table_view const &table, std::vector< order > const &column_order, std::vector< null_order > const &null_precedence, rmm::cuda_stream_view stream=cudf::get_default_stream())
Checks whether the rows of a table are sorted in a lexicographical 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::cuda_stream_view stream=cudf::get_default_stream(), 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.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a key-value sort.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a lexicographic segmented sort of a table.
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::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes the ranks of input column in sorted order.
std::unique_ptr< table > stable_sort(table_view const &input, std::vector< order > const &column_order={}, std::vector< null_order > const &null_precedence={}, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a stable lexicographic sort of the rows of a table.
rank_method
Tie-breaker method to use for ranking the column.
Definition: aggregation.hpp:53
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
null_order
Indicates how null values compare against all other values.
Definition: types.hpp:157
null_policy
Enum to specify whether to include nulls or exclude nulls.
Definition: types.hpp:124
order
Indicates the order in which elements should be sorted.
Definition: types.hpp:116
cuDF interfaces
Definition: aggregation.hpp:34
Type declarations for libcudf.