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/device_uvector.hpp>
15 
16 #include <cuda/stream>
17 
18 #include <memory>
19 
25 namespace CUDF_EXPORT cudf {
26 
32 // Forward declaration
33 namespace detail {
34 class sort_merge_join;
35 }
36 
46  public:
47  sort_merge_join() = delete;
48  ~sort_merge_join();
49  sort_merge_join(sort_merge_join const&) = delete;
50  sort_merge_join(sort_merge_join&&) = delete;
51  sort_merge_join& operator=(sort_merge_join const&) = delete;
52  sort_merge_join& operator=(sort_merge_join&&) = delete;
53 
68  sorted is_right_sorted,
69  null_equality compare_nulls = null_equality::EQUAL,
70  cuda::stream_ref stream = cudf::get_default_stream());
71 
88  std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
89  std::unique_ptr<rmm::device_uvector<size_type>>>
90  inner_join(table_view const& left,
91  cuda::stream_ref stream = cudf::get_default_stream(),
93 
110  [[deprecated(
111  "The is_left_sorted parameter is ignored; use inner_join(left, stream, mr) "
112  "instead.")]] std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
113  std::unique_ptr<rmm::device_uvector<size_type>>>
114  inner_join(table_view const& left,
115  sorted is_left_sorted,
116  cuda::stream_ref stream = cudf::get_default_stream(),
118 
134  std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
135  std::unique_ptr<rmm::device_uvector<size_type>>>
136  left_join(table_view const& left,
137  cuda::stream_ref stream = cudf::get_default_stream(),
139 
156  [[deprecated(
157  "The is_left_sorted parameter is ignored; use left_join(left, stream, mr) "
158  "instead.")]] std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
159  std::unique_ptr<rmm::device_uvector<size_type>>>
160  left_join(table_view const& left,
161  sorted is_left_sorted,
162  cuda::stream_ref stream = cudf::get_default_stream(),
164 
189  std::unique_ptr<join_match_context> inner_join_match_context(
190  table_view const& left,
191  cuda::stream_ref stream = cudf::get_default_stream(),
193 
207  [[deprecated(
208  "The is_left_sorted parameter is ignored; use inner_join_match_context(left, "
209  "stream, mr) instead.")]] std::unique_ptr<join_match_context>
211  table_view const& left,
212  sorted is_left_sorted,
213  cuda::stream_ref stream = cudf::get_default_stream(),
215 
268  std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
269  std::unique_ptr<rmm::device_uvector<size_type>>>
271  cudf::join_partition_context const& context,
272  cuda::stream_ref stream = cudf::get_default_stream(),
274 
275  private:
276  using impl_type = cudf::detail::sort_merge_join;
277  std::unique_ptr<impl_type const> _impl;
278 };
279  // end of group
281 } // namespace CUDF_EXPORT cudf
Class that implements sort-merge algorithm for table joins.
sort_merge_join(table_view const &right, sorted is_right_sorted, null_equality compare_nulls=null_equality::EQUAL, cuda::stream_ref stream=cudf::get_default_stream())
Construct a sort-merge join object that pre-processes the right table on creation,...
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, cuda::stream_ref 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::unique_ptr< join_match_context > inner_join_match_context(table_view const &left, sorted is_left_sorted, cuda::stream_ref 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 > > > inner_join(table_view const &left, cuda::stream_ref 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, cuda::stream_ref 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 > > > left_join(table_view const &left, sorted is_left_sorted, cuda::stream_ref 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 > > > left_join(table_view const &left, cuda::stream_ref 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, sorted is_left_sorted, cuda::stream_ref 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 ...
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:206
cuda::stream_ref 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:27
Stores context information for partitioned join operations.
Definition: join.hpp:128
Class definitions for (mutable)_table_view
Type declarations for libcudf.