18 #include <cuda_runtime.h>
19 #include <cudf/detail/iterator.cuh>
20 #include <cudf/lists/lists_column_device_view.cuh>
24 #include <thrust/iterator/counting_iterator.h>
25 #include <thrust/iterator/transform_iterator.h>
26 #include <thrust/pair.h>
48 : lists_column(lists_column), _row_index(
row_index)
52 "row_index out of bounds");
55 cudf_assert(begin_offset >= 0 && begin_offset <= lists_column.
child().
size() &&
56 "begin_offset out of bounds.");
88 cudf_assert(idx >= 0 && idx <
size() &&
"idx out of bounds");
89 return begin_offset + idx;
113 cudf_assert(idx >= 0 && idx <
size() &&
"Index out of bounds.");
123 [[nodiscard]] __device__
inline bool is_null()
const {
return lists_column.is_null(_row_index); }
149 template <
typename T>
150 struct pair_accessor;
152 template <
typename T>
153 struct pair_rep_accessor;
156 template <
typename T>
158 thrust::transform_iterator<pair_accessor<T>, thrust::counting_iterator<cudf::size_type>>;
161 template <
typename T>
163 thrust::transform_iterator<pair_rep_accessor<T>, thrust::counting_iterator<cudf::size_type>>;
181 template <
typename T>
194 template <
typename T>
219 template <
typename T>
233 template <
typename T>
241 lists_column_device_view
const& lists_column;
256 template <
typename T>
291 template <
typename T>
318 template <
typename R, std::enable_if_t<std::is_same_v<R, rep_type>,
void>* =
nullptr>
324 template <
typename R, std::enable_if_t<not std::is_same_v<R, rep_type>,
void>* =
nullptr>
An immutable, non-owning view of device data as a column of elements that is trivially copyable and u...
T element(size_type element_index) const noexcept
Returns reference to element at the specified index.
CUDF_HOST_DEVICE size_type size() const noexcept
Returns the number of elements in the column.
bool is_null(size_type element_index) const noexcept
Returns whether the specified element is null.
Given a column_device_view, an instance of this class provides a wrapper on this compound column for ...
column_device_view offsets() const
Fetches the offsets column of the underlying list column.
size_type offset_at(size_type idx) const
Fetches the list offset value at a given row index while taking column offset into account.
column_device_view child() const
Fetches the child column of the underlying list column.
A non-owning, immutable view of device data that represents a list of elements of arbitrary type (inc...
const_pair_rep_iterator< T > pair_rep_end() const
Fetcher for a pair iterator to one position past the last element in the list_device_view.
T element(size_type idx) const
Fetches the element at the specified index within the list row.
size_type element_offset(size_type idx) const
Fetches the offset in the list column's child that corresponds to the element at the specified list i...
bool is_null() const
Checks whether this list row is null.
const_pair_iterator< T > pair_end() const
Fetcher for a pair iterator to one position past the last element in the list_device_view.
size_type row_index() const
Returns the row index of this list in the original lists column.
bool is_null(size_type idx) const
Checks whether the element is null at the specified index in the list.
const_pair_rep_iterator< T > pair_rep_begin() const
Fetcher for a pair iterator to the first element in the list_device_view.
thrust::transform_iterator< pair_accessor< T >, thrust::counting_iterator< cudf::size_type > > const_pair_iterator
const pair iterator for the list
thrust::transform_iterator< pair_rep_accessor< T >, thrust::counting_iterator< cudf::size_type > > const_pair_rep_iterator
const pair iterator type for the list
list_device_view(lists_column_device_view const &lists_column, size_type const &row_index)
Constructs a list_device_view from a list column and index.
const_pair_iterator< T > pair_begin() const
Fetcher for a pair iterator to the first element in the list_device_view.
lists_column_device_view const & get_column() const
Fetches the lists_column_device_view that contains this list.
size_type size() const
Fetches the number of elements in this list row.
std::conditional_t< std::is_same_v< numeric::decimal32, T >, int32_t, std::conditional_t< std::is_same_v< numeric::decimal64, T >, int64_t, std::conditional_t< std::is_same_v< numeric::decimal128, T >, __int128_t, T > >> device_storage_type_t
"Returns" the corresponding type that is stored on the device when using cudf::column
int32_t size_type
Row index type for columns and tables.
CUDF_HOST_DEVICE auto make_list_size_iterator(detail::lists_column_device_view const &c)
Makes an iterator that returns size of the list by row index.
pair accessor for elements in a list_device_view
CUDF_HOST_DEVICE pair_accessor(list_device_view const &_list)
constructor
list_device_view const & list
The list_device_view to access.
thrust::pair< T, bool > operator()(cudf::size_type i) const
Accessor for the {data, validity} pair at the specified index.
pair rep accessor for elements in a list_device_view
list_device_view const & list
The list_device_view whose rows are being accessed.
device_storage_type_t< T > rep_type
The type used to store the value on the device.
CUDF_HOST_DEVICE pair_rep_accessor(list_device_view const &_list)
constructor
thrust::pair< rep_type, bool > operator()(cudf::size_type i) const
Accessor for the {rep_data, validity} pair at the specified index.
Returns the size of the list by row index.
detail::lists_column_device_view const d_column
The list column to access.
CUDF_HOST_DEVICE list_size_functor(detail::lists_column_device_view const &d_col)
Constructor.
size_type operator()(size_type idx)
Returns size of the list by row index.
Defines the mapping between cudf::type_id runtime type information and concrete C++ types.
Type declarations for libcudf.
#define CUDF_HOST_DEVICE
Indicates that the function or method is usable on host and device.