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)
 Construct a new column by deep copying the contents of other. More...
 
 column (column const &other, rmm::cuda_stream_view 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 B1 , typename B2 = rmm::device_buffer>
 column (data_type dtype, size_type size, B1 &&data, B2 &&null_mask={}, size_type null_count=UNKNOWN_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=rmm::cuda_stream_default, 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.
 
size_type size () const noexcept
 Returns the number of elements.
 
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=UNKNOWN_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=UNKNOWN_NULL_COUNT)
 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.
 
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 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 45 of file column.hpp.

Constructor & Destructor Documentation

◆ column() [1/5]

cudf::column::column ( column const &  other)

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

Parameters
otherThe column to copy

◆ column() [2/5]

cudf::column::column ( column const &  other,
rmm::cuda_stream_view  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.

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() [3/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() [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 = UNKNOWN_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.
Parameters
[in]dtypeThe element type
[in]sizeThe number of elements in the column
[in]dataThe column's data
[in]null_maskOptional, column's null value indicator bitmask. May be empty if null_count is 0 or UNKNOWN_NULL_COUNT.
null_countOptional, the count of null elements. If unknown, specify UNKNOWN_NULL_COUNT to indicate that the null count should be computed on the first invocation of null_count().
childrenOptional, vector of child columns

Definition at line 100 of file column.hpp.

◆ column() [5/5]

cudf::column::column ( column_view  view,
rmm::cuda_stream_view  stream = rmm::cuda_stream_default,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)
explicit

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
column const& Const reference to the desired child

Definition at line 235 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
column& Reference to the desired child

Definition at line 227 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 214 of file column.hpp.

◆ mutable_view()

mutable_column_view cudf::column::mutable_view ( )

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

Note
Creating a mutable view of a column invalidates the column's null_count() by setting it to UNKNOWN_NULL_COUNT. The user can either explicitly update the null count with set_null_count(), or if not, the null count will be recomputed on the next invocation of null_count().
Returns
mutable_column_view The mutable, non-owning view

◆ null_count()

size_type cudf::column::null_count ( ) const

Returns the count of null elements.

Note
If the column was constructed with UNKNOWN_NULL_COUNT, or if at any point set_null_count(UNKNOWN_NULL_COUNT) was invoked, then the first invocation of null_count() will compute and store the count of null elements indicated by the null_mask (if it exists).

◆ 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 206 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
column_view Immutable, non-owning column_view

Definition at line 281 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 pasing a column object into a function that accepts a mutable_column_view. The conversion is automatic.

Note
Creating a mutable view of a column invalidates the column's null_count() by setting it to UNKNOWN_NULL_COUNT. For best performance, the user should explicitly update the null count with set_null_count(). Otherwise, the null count will be recomputed on the next invocation of null_count().
Returns
mutable_column_view Mutable, non-owning mutable_column_view

Definition at line 311 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.

Note
UNKNOWN_NULL_COUNT can be specified as new_null_count to force the next invocation of null_count() to recompute the null count from the null mask.
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 = UNKNOWN_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 or UNKOWN_NULL_COUNT.
new_null_countOptional, the count of null elements. If unknown, specify UNKNOWN_NULL_COUNT to indicate that the null count should be computed on the first invocation of null_count().

◆ set_null_mask() [2/2]

void cudf::column::set_null_mask ( rmm::device_buffer const &  new_null_mask,
size_type  new_null_count = UNKNOWN_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 (lvalue overload & copied) to set the column's null value indicator mask. May be empty if new_null_count is 0 or UNKOWN_NULL_COUNT.
new_null_countOptional, the count of null elements. If unknown, specify UNKNOWN_NULL_COUNT to indicate that the null count should be computed on the first invocation of null_count().

◆ view()

column_view cudf::column::view ( ) const

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

Returns
column_view The immutable, non-owning view

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