type_checks.hpp
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 
8 #include <cudf/scalar/scalar.hpp>
9 
10 #include <algorithm>
11 
12 namespace CUDF_EXPORT cudf {
13 
24 bool column_types_equivalent(column_view const& lhs, column_view const& rhs);
25 
41 bool have_same_types(column_view const& lhs, column_view const& rhs);
42 
58 bool have_same_types(column_view const& lhs, scalar const& rhs);
59 
75 bool have_same_types(scalar const& lhs, column_view const& rhs);
76 
90 bool have_same_types(scalar const& lhs, scalar const& rhs);
91 
99 bool have_same_types(table_view const& lhs, table_view const& rhs);
100 
112 template <typename ForwardIt>
113 inline bool all_have_same_types(ForwardIt first, ForwardIt last)
114 {
115  return first == last || std::all_of(std::next(first), last, [want = *first](auto const& c) {
116  return cudf::have_same_types(want, c);
117  });
118 }
119 
120 } // namespace CUDF_EXPORT cudf
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
An owning class to represent a singular value.
Definition: scalar.hpp:40
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:189
column view class definitions
cuDF interfaces
Definition: host_udf.hpp:26
bool column_types_equivalent(column_view const &lhs, column_view const &rhs)
Compare the type IDs of two column_views.
bool all_have_same_types(ForwardIt first, ForwardIt last)
Compare the types of a range of column_view or scalar objects.
bool have_same_types(column_view const &lhs, column_view const &rhs)
Compares the type of two column_views.
Class definitions for cudf::scalar.