Table Classes#

group Table

Functions

bool tables_equal(table_view const &left, table_view const &right, null_equality nulls_equal = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream())#

Check if two tables are equal.

Returns true if the input tables have the same number of rows, the same number of columns, matching column types, and every row in left compares equal to the row at the same index in right. Null equality is controlled by nulls_equal. Floating point NaN values compare equal.

Throws:

cudf::logic_error – if the tables contain EMPTY types.

Parameters:
  • left – The first table to compare

  • right – The second table to compare

  • nulls_equal – Flag to denote if null elements should be considered equal

  • stream – CUDA stream used for device memory operations and kernel launches

Returns:

true if the tables are equal, false otherwise

class table#
#include <table.hpp>

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

Public Functions

table(table&&) = default#

Move constructor.

explicit 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.

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

Parameters:
  • other – The table to copy

  • stream – CUDA stream used for device memory operations.

  • mr – Device memory resource to use for all device memory allocations

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:

columns – The vector of unique_ptrs to columns whose contents will be moved into the new table.

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.

Parameters:
  • view – The view whose contents will be copied to create a new table

  • stream – CUDA stream used for device memory operations.

  • mr – Device memory resource used for allocating the device memory for the new columns

inline size_type num_columns() const noexcept#

Returns the number of columns in the table.

Returns:

The number of columns in the table

inline size_type num_rows() const noexcept#

Returns the number of rows.

Returns:

The number of rows

std::size_t alloc_size() const#

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

Returns:

The total allocation size in bytes

table_view 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

inline 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.

Returns:

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

inline 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.

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

Returns:

A vector of unique_ptrs to the constituent columns

template<typename InputIterator>
inline table_view select(InputIterator begin, InputIterator end) const#

Returns a table_view built from a range of column indices.

Throws:

std::out_of_range – If any index is outside [0, num_columns())

Parameters:
  • begin – Beginning of the range

  • end – Ending of the range

Returns:

A table_view consisting of columns from the original table specified by the elements of column_indices

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

Returns a table_view with set of specified columns.

Throws:

std::out_of_range – If any element in column_indices is outside [0, num_columns())

Parameters:

column_indices – Indices of columns in the table

Returns:

A table_view consisting of columns from the original table specified by the elements of column_indices

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

Returns a reference to the specified column.

Throws:

std::out_of_range – If i is out of the range [0, num_columns)

Parameters:

column_index – Index of the desired column

Returns:

A reference to the desired column

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

Returns a const reference to the specified column.

Throws:

std::out_of_range – If i is out of the range [0, num_columns)

Parameters:

i – Index of the desired column

Returns:

A const reference to the desired column

class table_view : public cudf::detail::table_view_base<column_view>#
#include <table_view.hpp>

A set of cudf::column_view’s of the same size.

All public member functions and constructors are inherited from table_view_base<column_view>.

Public Types

using ColumnView = column_view#

The type of column view the table contains.

Public Functions

table_view(std::vector<table_view> const &views)#

Construct a table from a vector of table views.

Note

Because a std::vector is constructible from a std::initializer_list, this constructor also supports the following usage:

table_view t0, t1, t2;
...
table_view t{{t0,t1,t2}}; // Creates a `table` from the columns of
t0, t1, t2

Throws:

cudf::logic_error – If number of rows mismatch

Parameters:

views – The vector of table views to construct the table from

template<typename InputIterator>
inline table_view select(InputIterator begin, InputIterator end) const#

Returns a table_view built from a range of column indices.

Throws:

std::out_of_range – If any index is outside [0, num_columns())

Parameters:
  • begin – Beginning of the range

  • end – Ending of the range

Returns:

A table_view consisting of columns from the original table specified by the elements of column_indices

table_view select(std::vector<size_type> const &column_indices) const#

Returns a table_view with set of specified columns.

Throws:

std::out_of_range – If any element in column_indices is outside [0, num_columns())

Parameters:

column_indices – Indices of columns in the table

Returns:

A table_view consisting of columns from the original table specified by the elements of column_indices

class mutable_table_view : public cudf::detail::table_view_base<mutable_column_view>#
#include <table_view.hpp>

A set of mutable_column_views of the same size.

All public member functions and constructors are inherited from table_view_base<mutable_column_view>.

Public Types

using ColumnView = mutable_column_view#

The type of column views in the table.

Public Functions

inline mutable_column_view &column(size_type column_index) const#

Returns column at specified index.

Parameters:

column_index – The index of the desired column

Returns:

A mutable column view reference to the desired column

operator table_view()#

Creates an immutable table_view of the columns.

mutable_table_view(std::vector<mutable_table_view> const &views)#

Construct a table from a vector of table views.

Note

Because a std::vector is constructible from a std::initializer_list, this constructor also supports the following usage:

table_view t0, t1, t2;
...
table_view t{{t0,t1,t2}}; // Creates a `table` from the columns of
t0, t1, t2

Throws:

cudf::logic_error – If number of rows mismatch

Parameters:

views – The vector of table views to construct the table from