Classes | Public Member Functions | List of all members
cudf::column Class Reference

A container of nullable device data as a column of elements. More...

#include <column.hpp>

Classes

struct  contents
 Wrapper for the contents of a column. More...
 

Public Member Functions

columnoperator= (column const &other)=delete
 
columnoperator= (column &&other)=delete
 
 column (column const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a new column object by deep copying the contents of other. More...
 
 column (column &&other) noexcept
 Move the contents from other to create a new column. More...
 
template<typename T , CUDF_ENABLE_IF(cudf::is_numeric< T >() or cudf::is_chrono< T >()) >
 column (rmm::device_uvector< T > &&other, rmm::device_buffer &&null_mask, size_type null_count)
 Construct a new column by taking ownership of the contents of a device_uvector. More...
 
template<typename B1 , typename B2 = rmm::device_buffer>
 column (data_type dtype, size_type size, B1 &&data, B2 &&null_mask, size_type null_count, std::vector< std::unique_ptr< column >> &&children={})
 Construct a new column from existing device memory. More...
 
 column (column_view view, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a new column by deep copying the contents of a column_view. More...
 
data_type type () const noexcept
 Returns the column's logical element type. More...
 
size_type size () const noexcept
 Returns the number of elements. More...
 
size_type null_count () const
 Returns the count of null elements. More...
 
void set_null_mask (rmm::device_buffer &&new_null_mask, size_type new_null_count)
 Sets the column's null value indicator bitmask to new_null_mask. More...
 
void set_null_mask (rmm::device_buffer const &new_null_mask, size_type new_null_count, rmm::cuda_stream_view stream=cudf::get_default_stream())
 Sets the column's null value indicator bitmask to new_null_mask. More...
 
void set_null_count (size_type new_null_count)
 Updates the count of null elements. More...
 
bool nullable () const noexcept
 Indicates whether it is possible for the column to contain null values, i.e., it has an allocated null mask. More...
 
bool has_nulls () const noexcept
 Indicates whether the column contains null elements. More...
 
size_type num_children () const noexcept
 Returns the number of child columns. More...
 
columnchild (size_type child_index) noexcept
 Returns a reference to the specified child. More...
 
column const & child (size_type child_index) const noexcept
 Returns a const reference to the specified child. More...
 
contents release () noexcept
 Releases ownership of the column's contents. More...
 
column_view view () const
 Creates an immutable, non-owning view of the column's data and children. More...
 
 operator column_view () const
 Implicit conversion operator to a column_view. More...
 
mutable_column_view mutable_view ()
 Creates a mutable, non-owning view of the column's data, null mask, and children. More...
 
 operator mutable_column_view ()
 Implicit conversion operator to a mutable_column_view. More...
 

Detailed Description

A container of nullable device data as a column of elements.

Definition at line 48 of file column.hpp.

Constructor & Destructor Documentation

◆ column() [1/5]

Construct a new column object by deep copying the contents of other.

Uses the specified stream and device_memory_resource for all allocations and copies.

Parameters
otherThe column to copy
streamCUDA stream used for device memory operations.
mrDevice memory resource to use for all device memory allocations

◆ column() [2/5]

cudf::column::column ( column &&  other)
noexcept

Move the contents from other to create a new column.

After the move, other.size() == 0 and other.type() = {EMPTY}

Parameters
otherThe column whose contents will be moved into the new column

◆ column() [3/5]

template<typename T , CUDF_ENABLE_IF(cudf::is_numeric< T >() or cudf::is_chrono< T >()) >
cudf::column::column ( rmm::device_uvector< T > &&  other,
rmm::device_buffer &&  null_mask,
size_type  null_count 
)
inline

Construct a new column by taking ownership of the contents of a device_uvector.

Parameters
otherThe device_uvector whose contents will be moved into the new column.
null_maskColumn's null value indicator bitmask. May be empty if null_count is 0.
null_countThe count of null elements.

Definition at line 87 of file column.hpp.

◆ column() [4/5]

template<typename B1 , typename B2 = rmm::device_buffer>
cudf::column::column ( data_type  dtype,
size_type  size,
B1 &&  data,
B2 &&  null_mask,
size_type  null_count,
std::vector< std::unique_ptr< column >> &&  children = {} 
)
inline

Construct a new column from existing device memory.

Note
This constructor is primarily intended for use in column factory functions.
Exceptions
cudf::logic_errorif size < 0
Parameters
dtypeThe element type
sizeThe number of elements in the column
dataThe column's data
null_maskColumn's null value indicator bitmask. May be empty if null_count is 0.
null_countOptional, the count of null elements.
childrenOptional, vector of child columns

Definition at line 118 of file column.hpp.

◆ column() [5/5]

Construct a new column by deep copying the contents of a column_view.

This accounts for the column_view's offset.

Parameters
viewThe view to copy
streamCUDA stream used for device memory operations.
mrDevice memory resource to use for all device memory allocations

Member Function Documentation

◆ child() [1/2]

column const& cudf::column::child ( size_type  child_index) const
inlinenoexcept

Returns a const reference to the specified child.

Parameters
child_indexIndex of the desired child
Returns
Const reference to the desired child

Definition at line 250 of file column.hpp.

◆ child() [2/2]

column& cudf::column::child ( size_type  child_index)
inlinenoexcept

Returns a reference to the specified child.

Parameters
child_indexIndex of the desired child
Returns
Reference to the desired child

Definition at line 242 of file column.hpp.

◆ has_nulls()

bool cudf::column::has_nulls ( ) const
inlinenoexcept

Indicates whether the column contains null elements.

Returns
true One or more elements are null
false Zero elements are null

Definition at line 227 of file column.hpp.

◆ mutable_view()

mutable_column_view cudf::column::mutable_view ( )

Creates a mutable, non-owning view of the column's data, null mask, and children.

Returns
The mutable, non-owning view

◆ null_count()

size_type cudf::column::null_count ( ) const
inline

Returns the count of null elements.

Returns
The number of null elements

Definition at line 167 of file column.hpp.

◆ nullable()

bool cudf::column::nullable ( ) const
inlinenoexcept

Indicates whether it is possible for the column to contain null values, i.e., it has an allocated null mask.

This may return false iff null_count() == 0.

May return true even if null_count() == 0. This function simply indicates whether the column has an allocated null mask.

Returns
true The column can hold null values
false The column cannot hold null values

Definition at line 219 of file column.hpp.

◆ num_children()

size_type cudf::column::num_children ( ) const
inlinenoexcept

Returns the number of child columns.

Returns
The number of child columns

Definition at line 234 of file column.hpp.

◆ operator column_view()

cudf::column::operator column_view ( ) const
inline

Implicit conversion operator to a column_view.

This allows passing a column object directly into a function that requires a column_view. The conversion is automatic.

Returns
Immutable, non-owning column_view

Definition at line 299 of file column.hpp.

◆ operator mutable_column_view()

cudf::column::operator mutable_column_view ( )
inline

Implicit conversion operator to a mutable_column_view.

This allows passing a column object into a function that accepts a mutable_column_view. The conversion is automatic.

The caller is expected to update the null count appropriately if the null mask is modified.

Returns
Mutable, non-owning mutable_column_view

Definition at line 320 of file column.hpp.

◆ release()

contents cudf::column::release ( )
noexcept

Releases ownership of the column's contents.

It is the caller's responsibility to query the size(), null_count(), type() before invoking release().

After calling release() on a column it will be empty, i.e.:

Returns
A contents struct containing the data, null mask, and children of the column.

◆ set_null_count()

void cudf::column::set_null_count ( size_type  new_null_count)

Updates the count of null elements.

Exceptions
cudf::logic_errorif new_null_count > 0 and nullable() == false
Parameters
new_null_countThe new null count.

◆ set_null_mask() [1/2]

void cudf::column::set_null_mask ( rmm::device_buffer &&  new_null_mask,
size_type  new_null_count 
)

Sets the column's null value indicator bitmask to new_null_mask.

Exceptions
cudf::logic_errorif new_null_count is larger than 0 and the size of new_null_mask does not match the size of this column.
Parameters
new_null_maskNew null value indicator bitmask (rvalue overload & moved) to set the column's null value indicator mask. May be empty if new_null_count is 0.
new_null_countThe count of null elements.

◆ set_null_mask() [2/2]

void cudf::column::set_null_mask ( rmm::device_buffer const &  new_null_mask,
size_type  new_null_count,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

Sets the column's null value indicator bitmask to new_null_mask.

Exceptions
cudf::logic_errorif new_null_count is larger than 0 and the size of new_null_mask does not match the size of this column.
Parameters
new_null_maskNew null value indicator bitmask (lvalue overload & copied) to set the column's null value indicator mask. May be empty if new_null_count is 0.
new_null_countThe count of null elements
streamThe stream on which to perform the allocation and copy. Uses the default CUDF stream if none is specified.

◆ size()

size_type cudf::column::size ( ) const
inlinenoexcept

Returns the number of elements.

Returns
The number of elements

Definition at line 160 of file column.hpp.

◆ type()

data_type cudf::column::type ( ) const
inlinenoexcept

Returns the column's logical element type.

Returns
The column's logical element type

Definition at line 153 of file column.hpp.

◆ view()

column_view cudf::column::view ( ) const

Creates an immutable, non-owning view of the column's data and children.

Returns
The immutable, non-owning view

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