structs_column_device_view.cuh
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 
8 #include <cudf/types.hpp>
9 
10 namespace CUDF_EXPORT cudf {
11 
12 namespace detail {
13 
20  public:
21  structs_column_device_view() = delete;
22  ~structs_column_device_view() = default;
31 
38 
45  : column_device_view(underlying_)
46  {
47 #ifdef __CUDA_ARCH__
48  cudf_assert(underlying_.type().id() == type_id::STRUCT and
49  "structs_column_device_view only supports structs");
50 #else
51  CUDF_EXPECTS(underlying_.type().id() == type_id::STRUCT,
52  "structs_column_device_view only supports structs");
53 #endif
54  }
55 
56  using column_device_view::child;
59  using column_device_view::offset;
60  using column_device_view::size;
61 
68  [[nodiscard]] __device__ inline column_device_view get_sliced_child(size_type idx) const
69  {
70  return child(idx).slice(offset(), size());
71  }
72 };
73 
74 } // namespace detail
75 
76 } // namespace CUDF_EXPORT cudf
An immutable, non-owning view of device data as a column of elements that is trivially copyable and u...
CUDF_HOST_DEVICE column_device_view slice(size_type offset, size_type size) const noexcept
Get a new column_device_view which is a slice of this column.
constexpr CUDF_HOST_DEVICE type_id id() const noexcept
Returns the type identifier.
Definition: types.hpp:313
CUDF_HOST_DEVICE data_type type() const noexcept
Returns the element type.
Given a column_device_view, an instance of this class provides a wrapper on this compound column for ...
column_device_view get_sliced_child(size_type idx) const
Fetches the child column of the underlying struct column.
structs_column_device_view & operator=(structs_column_device_view const &)=default
Copy assignment operator.
structs_column_device_view(structs_column_device_view const &)=default
Copy constructor.
structs_column_device_view & operator=(structs_column_device_view &&)=default
Move assignment operator.
CUDF_HOST_DEVICE structs_column_device_view(column_device_view const &underlying_)
Construct a new structs column device view object from a column device view.
structs_column_device_view(structs_column_device_view &&)=default
Move constructor.
Column device view class definitions.
std::unique_ptr< cudf::column > is_null(cudf::column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a column of type_id::BOOL8 elements where for every element in input true indicates the value...
#define CUDF_EXPECTS(...)
Macro for checking (pre-)conditions that throws an exception when a condition is violated.
Definition: error.hpp:143
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:84
cuDF interfaces
Definition: host_udf.hpp:26
bool nullable(table_view const &view)
Returns True if any of the columns in the table is nullable. (not entire hierarchy)
Type declarations for libcudf.
#define CUDF_HOST_DEVICE
Indicates that the function or method is usable on host and device.
Definition: types.hpp:21