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

A set of cudf::column's of the same size. More...

#include <cudf/table/table.hpp>

Public Member Functions

 table (table &&)=default
 Move constructor.
 
tableoperator= (table const &)=delete
 
tableoperator= (table &&)=delete
 
 table (table const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Construct a new table by copying the contents of another table. More...
 
 table (std::vector< std::unique_ptr< column >> &&columns)
 Moves the contents from a vector of unique_ptrs to columns to construct a new table. More...
 
 table (std::vector< std::unique_ptr< column >> &&columns, size_type num_rows)
 Moves the contents from a vector of unique_ptrs to columns to construct a new table with an explicit row count. More...
 
 table (table_view view, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Copy the contents of a table_view to construct a new table. More...
 
size_type num_columns () const noexcept
 Returns the number of columns in the table. More...
 
size_type num_rows () const noexcept
 Returns the number of rows. More...
 
std::size_t alloc_size () const
 Returns the total device allocation size of the table's columns in bytes. More...
 
table_view view () const
 Returns an immutable, non-owning table_view of the contents of this table. More...
 
 operator table_view () const
 Conversion operator to an immutable, non-owning table_view of the contents of this table.
 
mutable_table_view mutable_view ()
 Returns a mutable, non-owning mutable_table_view of the contents of this table. More...
 
 operator mutable_table_view ()
 Conversion operator to a mutable, non-owning mutable_table_view of the contents of this table.
 
std::vector< std::unique_ptr< column > > release ()
 Releases ownership of the columns by returning a vector of unique_ptrs to the constituent columns. More...
 
template<typename InputIterator >
table_view select (InputIterator begin, InputIterator end) const
 Returns a table_view built from a range of column indices. More...
 
table_view select (std::vector< cudf::size_type > const &column_indices) const
 Returns a table_view with set of specified columns. More...
 
columnget_column (cudf::size_type column_index)
 Returns a reference to the specified column. More...
 
column const & get_column (cudf::size_type i) const
 Returns a const reference to the specified column. More...
 

Detailed Description

A set of cudf::column's of the same size.

If the set of columns is empty, the table's row count may still be non-zero.

Definition at line 31 of file table.hpp.

Constructor & Destructor Documentation

◆ table() [1/4]

cudf::table::table ( table const &  other,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)
explicit

Construct a new table by copying the contents of another table.

Uses the specified stream and device memory resource for all allocations and copies.

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

◆ table() [2/4]

cudf::table::table ( std::vector< std::unique_ptr< column >> &&  columns)

Moves the contents from a vector of unique_ptrs to columns to construct a new table.

Parameters
columnsThe vector of unique_ptrs to columns whose contents will be moved into the new table.

◆ table() [3/4]

cudf::table::table ( std::vector< std::unique_ptr< column >> &&  columns,
size_type  num_rows 
)

Moves the contents from a vector of unique_ptrs to columns to construct a new table with an explicit row count.

This is primarily intended for zero-column tables, which cannot otherwise carry a non-zero row count (the row count is normally derived from the columns). It is used, for example, when converting a zero-column Arrow array that has a non-zero length. When columns is non-empty, num_rows must equal the size of every column.

Exceptions
std::invalid_argumentif columns is non-empty and num_rows does not match the size of every column.
Parameters
columnsThe vector of unique_ptrs to columns whose contents will be moved into the new table.
num_rowsThe number of rows in the table.

◆ table() [4/4]

Copy the contents of a table_view to construct a new table.

Parameters
viewThe view whose contents will be copied to create a new table
streamCUDA stream used for device memory operations.
mrDevice memory resource used for allocating the device memory for the new columns

Member Function Documentation

◆ alloc_size()

std::size_t cudf::table::alloc_size ( ) const

Returns the total device allocation size of the table's columns in bytes.

See also
cudf::column::alloc_size
Returns
The total allocation size in bytes

◆ get_column() [1/2]

column& cudf::table::get_column ( cudf::size_type  column_index)
inline

Returns a reference to the specified column.

Exceptions
std::out_of_rangeIf i is out of the range [0, num_columns)
Parameters
column_indexIndex of the desired column
Returns
A reference to the desired column

Definition at line 197 of file table.hpp.

◆ get_column() [2/2]

column const& cudf::table::get_column ( cudf::size_type  i) const
inline

Returns a const reference to the specified column.

Exceptions
std::out_of_rangeIf i is out of the range [0, num_columns)
Parameters
iIndex of the desired column
Returns
A const reference to the desired column

Definition at line 208 of file table.hpp.

◆ mutable_view()

mutable_table_view cudf::table::mutable_view ( )

Returns a mutable, non-owning mutable_table_view of the contents of this table.

Returns
A mutable, non-owning mutable_table_view of the contents of this table

◆ num_columns()

size_type cudf::table::num_columns ( ) const
inlinenoexcept

Returns the number of columns in the table.

Returns
The number of columns in the table

Definition at line 96 of file table.hpp.

◆ num_rows()

size_type cudf::table::num_rows ( ) const
inlinenoexcept

Returns the number of rows.

Returns
The number of rows

Definition at line 103 of file table.hpp.

◆ release()

std::vector<std::unique_ptr<column> > cudf::table::release ( )

Releases ownership of the columns by returning a vector of unique_ptrs to the constituent columns.

After release(), num_columns() == 0 and num_rows() == 0

Returns
A vector of unique_ptrs to the constituent columns

◆ select() [1/2]

template<typename InputIterator >
table_view cudf::table::select ( InputIterator  begin,
InputIterator  end 
) const
inline

Returns a table_view built from a range of column indices.

Exceptions
std::out_of_rangeIf any index is outside [0, num_columns())
Parameters
beginBeginning of the range
endEnding of the range
Returns
A table_view consisting of columns from the original table specified by the elements of column_indices

Definition at line 165 of file table.hpp.

◆ select() [2/2]

table_view cudf::table::select ( std::vector< cudf::size_type > const &  column_indices) const
inline

Returns a table_view with set of specified columns.

Exceptions
std::out_of_rangeIf any element in column_indices is outside [0, num_columns())
Parameters
column_indicesIndices of columns in the table
Returns
A table_view consisting of columns from the original table specified by the elements of column_indices

Definition at line 183 of file table.hpp.

◆ view()

table_view cudf::table::view ( ) const

Returns an immutable, non-owning table_view of the contents of this table.

Returns
An immutable, non-owning table_view of the contents of this table

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