libcudf  23.12.00
Classes | Public Types | Public Member Functions | List of all members
cudf::list_device_view Class Reference

A non-owning, immutable view of device data that represents a list of elements of arbitrary type (including further nested lists). More...

Classes

struct  pair_accessor
 pair accessor for elements in a list_device_view More...
 
struct  pair_rep_accessor
 pair rep accessor for elements in a list_device_view More...
 

Public Types

template<typename T >
using const_pair_iterator = thrust::transform_iterator< pair_accessor< T >, thrust::counting_iterator< cudf::size_type > >
 const pair iterator for the list
 
template<typename T >
using const_pair_rep_iterator = thrust::transform_iterator< pair_rep_accessor< T >, thrust::counting_iterator< cudf::size_type > >
 const pair iterator type for the list
 

Public Member Functions

 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. More...
 
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 index. More...
 
template<typename T >
element (size_type idx) const
 Fetches the element at the specified index within the list row. More...
 
bool is_null (size_type idx) const
 Checks whether the element is null at the specified index in the list. More...
 
bool is_null () const
 Checks whether this list row is null. More...
 
size_type size () const
 Fetches the number of elements in this list row. More...
 
size_type row_index () const
 Returns the row index of this list in the original lists column. More...
 
lists_column_device_view const & get_column () const
 Fetches the lists_column_device_view that contains this list. More...
 
template<typename T >
const_pair_iterator< T > pair_begin () const
 Fetcher for a pair iterator to the first element in the list_device_view. More...
 
template<typename T >
const_pair_iterator< T > pair_end () const
 Fetcher for a pair iterator to one position past the last element in the list_device_view. More...
 
template<typename T >
const_pair_rep_iterator< T > pair_rep_begin () const
 Fetcher for a pair iterator to the first element in the list_device_view. More...
 
template<typename T >
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. More...
 

Detailed Description

A non-owning, immutable view of device data that represents a list of elements of arbitrary type (including further nested lists).

Definition at line 34 of file list_device_view.cuh.

Constructor & Destructor Documentation

◆ list_device_view()

cudf::list_device_view::list_device_view ( lists_column_device_view const &  lists_column,
size_type const &  row_index 
)
inline

Constructs a list_device_view from a list column and index.

Parameters
lists_columnlist column device view containing the list to view
row_indexindex of the list row to view

Definition at line 46 of file list_device_view.cuh.

Member Function Documentation

◆ element()

template<typename T >
T cudf::list_device_view::element ( size_type  idx) const
inline

Fetches the element at the specified index within the list row.

Template Parameters
TThe type of the list's element.
Parameters
idxThe index into the list row
Returns
The element at the specified index of the list row.

Definition at line 100 of file list_device_view.cuh.

◆ element_offset()

size_type cudf::list_device_view::element_offset ( size_type  idx) const
inline

Fetches the offset in the list column's child that corresponds to the element at the specified list index.

Consider the following lists column: [ [0,1,2], [3,4,5], [6,7,8] ]

The list's internals would look like: offsets: [0, 3, 6, 9] child : [0, 1, 2, 3, 4, 5, 6, 7, 8]

The second list row (i.e. row_index=1) is [3,4,5]. The third element (i.e. idx=2) of the second list row is 5.

The offset of this element as stored in the child column (i.e. 5) may be fetched using this method.

Parameters
idxThe list index of the element to fetch the offset for
Returns
The offset of the element at the specified list index

Definition at line 86 of file list_device_view.cuh.

◆ get_column()

lists_column_device_view const& cudf::list_device_view::get_column ( ) const
inline

Fetches the lists_column_device_view that contains this list.

Returns
The lists_column_device_view that contains this list

Definition at line 144 of file list_device_view.cuh.

◆ is_null() [1/2]

bool cudf::list_device_view::is_null ( ) const
inline

Checks whether this list row is null.

Returns
true if this list is null

Definition at line 123 of file list_device_view.cuh.

◆ is_null() [2/2]

bool cudf::list_device_view::is_null ( size_type  idx) const
inline

Checks whether the element is null at the specified index in the list.

Parameters
idxThe index into the list row
Returns
true if the element is null at the specified index in the list row

Definition at line 111 of file list_device_view.cuh.

◆ pair_begin()

template<typename T >
const_pair_iterator<T> cudf::list_device_view::pair_begin ( ) const
inline

Fetcher for a pair iterator to the first element in the list_device_view.

Dereferencing the returned iterator yields a thrust::pair<T, bool>.

If the element at index i is valid, then for p = iter[i],

  1. p.first is the value of the element at i
  2. p.second == true

If the element at index i is null,

  1. p.first is undefined
  2. p.second == false
Returns
A pair iterator to the first element in the list_device_view and whether or not the element is valid

Definition at line 182 of file list_device_view.cuh.

◆ pair_end()

template<typename T >
const_pair_iterator<T> cudf::list_device_view::pair_end ( ) const
inline

Fetcher for a pair iterator to one position past the last element in the list_device_view.

Returns
A pair iterator to one past the last element in the list_device_view and whether or not that element is valid

Definition at line 195 of file list_device_view.cuh.

◆ pair_rep_begin()

template<typename T >
const_pair_rep_iterator<T> cudf::list_device_view::pair_rep_begin ( ) const
inline

Fetcher for a pair iterator to the first element in the list_device_view.

Dereferencing the returned iterator yields a thrust::pair<rep_type, bool>, where rep_type is device_storage_type_t<T>, the type used to store the value on the device.

If the element at index i is valid, then for p = iter[i],

  1. p.first is the value of the element at i
  2. p.second == true

If the element at index i is null,

  1. p.first is undefined
  2. p.second == false
Returns
A pair iterator to the first element in the list_device_view and whether or not that element is valid

Definition at line 220 of file list_device_view.cuh.

◆ pair_rep_end()

template<typename T >
const_pair_rep_iterator<T> cudf::list_device_view::pair_rep_end ( ) const
inline

Fetcher for a pair iterator to one position past the last element in the list_device_view.

Returns
A pair iterator one past the last element in the list_device_view and whether or not that element is valid

Definition at line 234 of file list_device_view.cuh.

◆ row_index()

size_type cudf::list_device_view::row_index ( ) const
inline

Returns the row index of this list in the original lists column.

Returns
The row index of this list

Definition at line 137 of file list_device_view.cuh.

◆ size()

size_type cudf::list_device_view::size ( ) const
inline

Fetches the number of elements in this list row.

Returns
The number of elements in this list row

Definition at line 130 of file list_device_view.cuh.


The documentation for this class was generated from the following file: