sort_merge_join.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/join/join.hpp>
10 #include <cudf/types.hpp>
11 #include <cudf/utilities/export.hpp>
13 
14 #include <rmm/cuda_stream_view.hpp>
15 #include <rmm/device_uvector.hpp>
16 
17 #include <memory>
18 
24 namespace CUDF_EXPORT cudf {
25 
31 // Forward declaration
32 namespace detail {
33 class sort_merge_join;
34 }
35 
45  public:
46  sort_merge_join() = delete;
47  ~sort_merge_join();
48  sort_merge_join(sort_merge_join const&) = delete;
49  sort_merge_join(sort_merge_join&&) = delete;
50  sort_merge_join& operator=(sort_merge_join const&) = delete;
51  sort_merge_join& operator=(sort_merge_join&&) = delete;
52 
67  sorted is_right_sorted,
68  null_equality compare_nulls = null_equality::EQUAL,
70 
87  std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
88  std::unique_ptr<rmm::device_uvector<size_type>>>
89  inner_join(table_view const& left,
92 
109  [[deprecated(
110  "The is_left_sorted parameter is ignored; use inner_join(left, stream, mr) "
111  "instead.")]] std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
112  std::unique_ptr<rmm::device_uvector<size_type>>>
113  inner_join(table_view const& left,
114  sorted is_left_sorted,
117 
133  std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
134  std::unique_ptr<rmm::device_uvector<size_type>>>
135  left_join(table_view const& left,
138 
155  [[deprecated(
156  "The is_left_sorted parameter is ignored; use left_join(left, stream, mr) "
157  "instead.")]] std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
158  std::unique_ptr<rmm::device_uvector<size_type>>>
159  left_join(table_view const& left,
160  sorted is_left_sorted,
163 
188  std::unique_ptr<join_match_context> inner_join_match_context(
189  table_view const& left,
192 
206  [[deprecated(
207  "The is_left_sorted parameter is ignored; use inner_join_match_context(left, "
208  "stream, mr) instead.")]] std::unique_ptr<join_match_context>
210  table_view const& left,
211  sorted is_left_sorted,
214 
267  std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
268  std::unique_ptr<rmm::device_uvector<size_type>>>
270  cudf::join_partition_context const& context,
273 
274  private:
275  using impl_type = cudf::detail::sort_merge_join;
276  std::unique_ptr<impl_type const> _impl;
277 };
278  // end of group
280 } // namespace CUDF_EXPORT cudf
Class that implements sort-merge algorithm for table joins.
std::pair< std::unique_ptr< rmm::device_uvector< size_type > >, std::unique_ptr< rmm::device_uvector< size_type > > > left_join(table_view const &left, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Returns the row indices that can be used to construct the result of performing a left join between th...
std::pair< std::unique_ptr< rmm::device_uvector< size_type > >, std::unique_ptr< rmm::device_uvector< size_type > > > inner_join(table_view const &left, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Returns the row indices that can be used to construct the result of performing an inner join between ...
std::pair< std::unique_ptr< rmm::device_uvector< size_type > >, std::unique_ptr< rmm::device_uvector< size_type > > > inner_join(table_view const &left, sorted is_left_sorted, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Returns the row indices that can be used to construct the result of performing an inner join between ...
std::unique_ptr< join_match_context > inner_join_match_context(table_view const &left, sorted is_left_sorted, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Returns context information about matches between the left and right tables.
std::pair< std::unique_ptr< rmm::device_uvector< size_type > >, std::unique_ptr< rmm::device_uvector< size_type > > > partitioned_inner_join(cudf::join_partition_context const &context, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Performs an inner join between a partition of the left table and the right table.
std::pair< std::unique_ptr< rmm::device_uvector< size_type > >, std::unique_ptr< rmm::device_uvector< size_type > > > left_join(table_view const &left, sorted is_left_sorted, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Returns the row indices that can be used to construct the result of performing a left join between th...
std::unique_ptr< join_match_context > inner_join_match_context(table_view const &left, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Returns context information about matches between the left and right tables.
sort_merge_join(table_view const &right, sorted is_right_sorted, null_equality compare_nulls=null_equality::EQUAL, rmm::cuda_stream_view stream=cudf::get_default_stream())
Construct a sort-merge join object that pre-processes the right table on creation,...
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:206
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::resource_ref< cuda::mr::device_accessible > device_async_resource_ref
null_equality
Enum to consider two nulls as equal or unequal.
Definition: types.hpp:132
sorted
Indicates whether a collection of values is known to be sorted.
Definition: types.hpp:148
Common types and utilities shared by cuDF's join APIs.
APIs for getting and setting the current device memory resource.
cuDF interfaces
Definition: host_udf.hpp:26
Stores context information for partitioned join operations.
Definition: join.hpp:120
Class definitions for (mutable)_table_view
Type declarations for libcudf.