A non-owning, immutable view of device data as a column of elements, some of which may be null as indicated by a bitmask. More...
#include <column_view.hpp>
Public Member Functions | |
template<typename T = void, CUDF_ENABLE_IF(std::is_same_v< T, void > or is_rep_layout_compatible< T >()) > | |
T const * | head () const noexcept |
Returns pointer to the base device memory allocation casted to the specified type. More... | |
template<typename T , CUDF_ENABLE_IF(is_rep_layout_compatible< T >()) > | |
T const * | data () const noexcept |
Returns the underlying data casted to the specified type, plus the offset. More... | |
template<typename T , CUDF_ENABLE_IF(is_rep_layout_compatible< T >()) > | |
T const * | begin () const noexcept |
Return first element (accounting for offset) after underlying data is casted to the specified type. More... | |
template<typename T , CUDF_ENABLE_IF(is_rep_layout_compatible< T >()) > | |
T const * | end () const noexcept |
Return one past the last element after underlying data is casted to the specified type. More... | |
size_type | size () const noexcept |
Returns the number of elements in the column. More... | |
bool | is_empty () const noexcept |
Returns true if size() returns zero, or false otherwise. More... | |
data_type | type () const noexcept |
Returns the element data_type More... | |
bool | nullable () const noexcept |
Indicates if the column can contain null elements, i.e., if it has an allocated bitmask. More... | |
size_type | null_count () const |
Returns the count of null elements. More... | |
size_type | null_count (size_type begin, size_type end) const |
Returns the count of null elements in the range [begin, end) More... | |
bool | has_nulls () const |
Indicates if the column contains null elements, i.e., null_count() > 0 More... | |
bool | has_nulls (size_type begin, size_type end) const |
Indicates if the column contains null elements in the range [begin, end), i.e., null_count(begin, end) > 0 More... | |
bitmask_type const * | null_mask () const noexcept |
Returns raw pointer to the underlying bitmask allocation. More... | |
size_type | offset () const noexcept |
Returns the index of the first element relative to the base memory allocation, i.e., what is returned from head<T>() . More... | |
Protected Member Functions | |
virtual void const * | get_data () const noexcept |
Returns pointer to the base device memory allocation. More... | |
column_view_base (column_view_base const &)=default | |
Copy constructor. | |
column_view_base (column_view_base &&)=default | |
Move constructor. | |
column_view_base & | operator= (column_view_base const &)=default |
Copy assignment operator. More... | |
column_view_base & | operator= (column_view_base &&)=default |
Move assignment operator. More... | |
column_view_base (data_type type, size_type size, void const *data, bitmask_type const *null_mask, size_type null_count, size_type offset=0) | |
Construct a column_view_base from pointers to device memory for the elements and bitmask of the column. More... | |
Protected Attributes | |
data_type | _type {type_id::EMPTY} |
Element type. | |
size_type | _size {} |
Number of elements. | |
void const * | _data {} |
Pointer to device memory containing elements. | |
bitmask_type const * | _null_mask {} |
size_type | _null_count {} |
The number of null elements. | |
size_type | _offset {} |
A non-owning, immutable view of device data as a column of elements, some of which may be null as indicated by a bitmask.
A column_view_base
can be constructed implicitly from a cudf::column
, or may be constructed explicitly from a pointer to pre-existing device memory.
Unless otherwise noted, the memory layout of the column_view_base
's data and bitmask is expected to adhere to the Arrow Physical Memory Layout Specification: https://arrow.apache.org/docs/memory_layout.html
Because column_view_base
is non-owning, no device memory is allocated nor freed when column_view_base
objects are created or destroyed.
To enable zero-copy slicing, a column_view_base
has an offset
that indicates the index of the first element in the column relative to the base device memory allocation. By default, offset()
is zero.
Definition at line 54 of file column_view.hpp.
|
protected |
Construct a column_view_base
from pointers to device memory for the elements and bitmask of the column.
If null_count()
is zero, null_mask
is optional.
If type
is EMPTY
, the specified null_count
will be ignored and null_count()
will always return the same value as size()
cudf::logic_error | if size < 0 |
cudf::logic_error | if size > 0 but data == nullptr |
cudf::logic_error | if type.id() == EMPTY but data != nullptr or null_mask != nullptr |
cudf::logic_error | if null_count > 0 , but null_mask == nullptr |
cudf::logic_error | if offset < 0 |
type | The element type |
size | The number of elements |
data | Pointer to device memory containing the column elements |
null_mask | Pointer to device memory containing the null indicator bitmask |
null_count | The number of null elements. |
offset | Optional, index of the first element |
|
inlinenoexcept |
Return first element (accounting for offset) after underlying data is casted to the specified type.
This function does not participate in overload resolution if is_rep_layout_compatible<T>
is false.
T | The desired type |
Definition at line 108 of file column_view.hpp.
|
inlinenoexcept |
Returns the underlying data casted to the specified type, plus the offset.
offset() == 0
, then head<T>() == data<T>()
This function does not participate in overload resolution if is_rep_layout_compatible<T>
is false.
T | The type to cast to |
Definition at line 92 of file column_view.hpp.
|
inlinenoexcept |
Return one past the last element after underlying data is casted to the specified type.
This function does not participate in overload resolution if is_rep_layout_compatible<T>
is false.
T | The desired type |
Definition at line 124 of file column_view.hpp.
|
inlineprotectedvirtualnoexcept |
Returns pointer to the base device memory allocation.
The primary purpose of this function is to allow derived classes to override the fundamental properties of memory accesses without needing to change all of the different accessors for the underlying pointer.
Reimplemented in cudf::mutable_column_view, and cudf::column_view.
Definition at line 238 of file column_view.hpp.
|
inline |
Indicates if the column contains null elements, i.e., null_count() > 0
Definition at line 191 of file column_view.hpp.
Indicates if the column contains null elements in the range [begin, end), i.e., null_count(begin, end) > 0
cudf::logic_error | for invalid range (if begin < 0 , begin > end , begin >= size() , or end > size() ). |
begin | The starting index of the range (inclusive). |
end | The index of the last element in the range (exclusive). |
Definition at line 205 of file column_view.hpp.
|
inlinenoexcept |
Returns pointer to the base device memory allocation casted to the specified type.
offset() == 0
, then head<T>() == data<T>()
head<T>()
allocation of a column, and instead, accessing the elements should be done via data<T>()
.This function will only participate in overload resolution if is_rep_layout_compatible<T>()
or std::is_same_v<T,void>
are true.
The | type to cast to |
Definition at line 74 of file column_view.hpp.
|
inlinenoexcept |
Returns true if size()
returns zero, or false otherwise.
size()
returns zero, or false otherwise Definition at line 141 of file column_view.hpp.
|
inline |
Returns the count of null elements.
Definition at line 166 of file column_view.hpp.
Returns the count of null elements in the range [begin, end)
null_count() != 0
, every invocation of null_count(begin, end)
will recompute the count of null elements indicated by the null_mask
in the range [begin, end).cudf::logic_error | for invalid range (if begin < 0 , begin > end , begin >= size() , or end > size() ). |
[in] | begin | The starting index of the range (inclusive). |
[in] | end | The index of the last element in the range (exclusive). |
|
inlinenoexcept |
Returns raw pointer to the underlying bitmask allocation.
offset()
.null_count() == 0
, this may return nullptr
. Definition at line 218 of file column_view.hpp.
|
inlinenoexcept |
Indicates if the column can contain null elements, i.e., if it has an allocated bitmask.
null_count() > 0
, this function must always return true
.Definition at line 159 of file column_view.hpp.
|
inlinenoexcept |
Returns the index of the first element relative to the base memory allocation, i.e., what is returned from head<T>()
.
head<T>()
Definition at line 226 of file column_view.hpp.
|
protecteddefault |
Move assignment operator.
|
protecteddefault |
Copy assignment operator.
|
inlinenoexcept |
Returns the number of elements in the column.
Definition at line 134 of file column_view.hpp.
|
inlinenoexcept |
Returns the element data_type
data_type
of the elements in the column Definition at line 148 of file column_view.hpp.
|
protected |
Pointer to device memory containing bitmask representing null elements. Optional if null_count() == 0
Definition at line 243 of file column_view.hpp.
|
protected |
Index position of the first element. Enables zero-copy slicing
Definition at line 247 of file column_view.hpp.