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

A non-owning view over the host metadata produced by cudf::pack. More...

#include <contiguous_split.hpp>

Classes

class  column_view
 A non-owning view of a single column's metadata within packed column data. More...
 

Public Member Functions

 packed_metadata_view (std::span< std::uint8_t const > buffer)
 Construct a view from a metadata byte buffer. More...
 
size_type num_columns () const
 
size_type num_rows () const
 The number of rows in the table. More...
 
column_view column (size_type i) const
 A view of the i-th top-level column's metadata. More...
 

Detailed Description

A non-owning view over the host metadata produced by cudf::pack.

packed_metadata_view enables schema introspection — querying column types, sizes, null counts, and nesting structure — without requiring device data and building a table_view.

The view interprets the serialized packed_columns::metadata wire format.

auto packed = cudf::pack(table);
auto view = cudf::packed_metadata_view(*packed.metadata);
std::cout << "columns: " << view.num_columns()
<< ", rows: " << view.num_rows() << "\n";
for (cudf::size_type i = 0; i < view.num_columns(); i++) {
auto col = view.column(i);
std::cout << " type=" << cudf::type_to_name(col.type())
<< " children=" << col.num_children() << "\n";
}
A non-owning view over the host metadata produced by cudf::pack.
packed_columns pack(cudf::table_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Deep-copy a table_view into a serialized contiguous memory format.
std::string type_to_name(data_type type)
Return a name for a given type.
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:84

Definition at line 338 of file contiguous_split.hpp.

Constructor & Destructor Documentation

◆ packed_metadata_view()

cudf::packed_metadata_view::packed_metadata_view ( std::span< std::uint8_t const >  buffer)
explicit

Construct a view from a metadata byte buffer.

Exceptions
cudf::logic_errorif the buffer is empty or does not satisfy minimum requirements for describing a valid column tree.
Parameters
bufferThe metadata bytes (as produced by cudf::pack)

Member Function Documentation

◆ column()

column_view cudf::packed_metadata_view::column ( size_type  i) const

A view of the i-th top-level column's metadata.

Exceptions
std::out_of_rangeif i is not contained in [0, num_columns())
Parameters
iIndex of the top-level column
Returns
A packed_metadata_view::column for the i-th column

◆ num_columns()

size_type cudf::packed_metadata_view::num_columns ( ) const
Returns
The number of top-level columns.

◆ num_rows()

size_type cudf::packed_metadata_view::num_rows ( ) const

The number of rows in the table.

This is the row count of the first top-level column. Returns 0 if the table has no columns.

Returns
The row count

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