Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
arrow::Table Class Referenceabstract

Logical table as sequence of chunked arrays. More...

#include <arrow/table.h>

Public Member Functions

virtual ~Table ()=default
 
std::shared_ptr< Schemaschema () const
 
virtual std::shared_ptr< Columncolumn (int i) const =0
 
virtual Status RemoveColumn (int i, std::shared_ptr< Table > *out) const =0
 Remove column from the table, producing a new Table. More...
 
virtual Status AddColumn (int i, const std::shared_ptr< Column > &column, std::shared_ptr< Table > *out) const =0
 Add column to the table, producing a new Table. More...
 
virtual Status SetColumn (int i, const std::shared_ptr< Column > &column, std::shared_ptr< Table > *out) const =0
 Replace a column in the table, producing a new Table. More...
 
virtual std::shared_ptr< TableReplaceSchemaMetadata (const std::shared_ptr< const KeyValueMetadata > &metadata) const =0
 Replace schema key-value metadata with new metadata (EXPERIMENTAL) More...
 
virtual Status Flatten (MemoryPool *pool, std::shared_ptr< Table > *out) const =0
 Flatten the table, producing a new Table. More...
 
virtual Status Validate () const =0
 Perform any checks to validate the input arguments. More...
 
int num_columns () const
 
int64_t num_rows () const
 
bool Equals (const Table &other) const
 Determine if semantic contents of tables are exactly equal. More...
 

Static Public Member Functions

static std::shared_ptr< TableMake (const std::shared_ptr< Schema > &schema, const std::vector< std::shared_ptr< Column >> &columns, int64_t num_rows=-1)
 Construct Table from schema and columns If columns is zero-length, the table's number of rows is zero. More...
 
static std::shared_ptr< TableMake (const std::shared_ptr< Schema > &schema, const std::vector< std::shared_ptr< Array >> &arrays, int64_t num_rows=-1)
 Construct Table from schema and arrays. More...
 
static Status FromRecordBatches (const std::vector< std::shared_ptr< RecordBatch >> &batches, std::shared_ptr< Table > *table)
 Construct table from RecordBatches, using schema supplied by the first RecordBatch. More...
 
static Status FromRecordBatches (const std::shared_ptr< Schema > &schema, const std::vector< std::shared_ptr< RecordBatch >> &batches, std::shared_ptr< Table > *table)
 Construct table from RecordBatches, using supplied schema. More...
 

Protected Member Functions

 Table ()
 

Protected Attributes

std::shared_ptr< Schemaschema_
 
int64_t num_rows_
 

Detailed Description

Logical table as sequence of chunked arrays.

Constructor & Destructor Documentation

◆ ~Table()

virtual arrow::Table::~Table ( )
virtualdefault

◆ Table()

arrow::Table::Table ( )
protected

Member Function Documentation

◆ AddColumn()

virtual Status arrow::Table::AddColumn ( int  i,
const std::shared_ptr< Column > &  column,
std::shared_ptr< Table > *  out 
) const
pure virtual

Add column to the table, producing a new Table.

◆ column()

virtual std::shared_ptr<Column> arrow::Table::column ( int  i) const
pure virtual
Parameters
[in]icolumn index, does not boundscheck
Returns
the i-th column

◆ Equals()

bool arrow::Table::Equals ( const Table other) const

Determine if semantic contents of tables are exactly equal.

◆ Flatten()

virtual Status arrow::Table::Flatten ( MemoryPool pool,
std::shared_ptr< Table > *  out 
) const
pure virtual

Flatten the table, producing a new Table.

Any column with a struct type will be flattened into multiple columns

Parameters
[in]poolThe pool for buffer allocations, if any
[out]outThe returned table

◆ FromRecordBatches() [1/2]

static Status arrow::Table::FromRecordBatches ( const std::vector< std::shared_ptr< RecordBatch >> &  batches,
std::shared_ptr< Table > *  table 
)
static

Construct table from RecordBatches, using schema supplied by the first RecordBatch.

Parameters
[in]batchesa std::vector of record batches
[out]tablethe returned table
Returns
Status Returns Status::Invalid if there is some problem

◆ FromRecordBatches() [2/2]

static Status arrow::Table::FromRecordBatches ( const std::shared_ptr< Schema > &  schema,
const std::vector< std::shared_ptr< RecordBatch >> &  batches,
std::shared_ptr< Table > *  table 
)
static

Construct table from RecordBatches, using supplied schema.

There may be zero record batches

Parameters
[in]schemathe arrow::Schema for each batch
[in]batchesa std::vector of record batches
[out]tablethe returned table
Returns
Status

◆ Make() [1/2]

static std::shared_ptr<Table> arrow::Table::Make ( const std::shared_ptr< Schema > &  schema,
const std::vector< std::shared_ptr< Column >> &  columns,
int64_t  num_rows = -1 
)
static

Construct Table from schema and columns If columns is zero-length, the table's number of rows is zero.

Parameters
schemaThe table schema (column types)
columnsThe table's columns
num_rowsnumber of rows in table, -1 (default) to infer from columns

◆ Make() [2/2]

static std::shared_ptr<Table> arrow::Table::Make ( const std::shared_ptr< Schema > &  schema,
const std::vector< std::shared_ptr< Array >> &  arrays,
int64_t  num_rows = -1 
)
static

Construct Table from schema and arrays.

Parameters
schemaThe table schema (column types)
arraysThe table's columns as arrays
num_rowsnumber of rows in table, -1 (default) to infer from columns

◆ num_columns()

int arrow::Table::num_columns ( ) const
inline
Returns
the number of columns in the table

◆ num_rows()

int64_t arrow::Table::num_rows ( ) const
inline
Returns
the number of rows (the corresponding length of each column)

◆ RemoveColumn()

virtual Status arrow::Table::RemoveColumn ( int  i,
std::shared_ptr< Table > *  out 
) const
pure virtual

Remove column from the table, producing a new Table.

◆ ReplaceSchemaMetadata()

virtual std::shared_ptr<Table> arrow::Table::ReplaceSchemaMetadata ( const std::shared_ptr< const KeyValueMetadata > &  metadata) const
pure virtual

Replace schema key-value metadata with new metadata (EXPERIMENTAL)

Since
0.5.0
Parameters
[in]metadatanew KeyValueMetadata
Returns
new Table

◆ schema()

std::shared_ptr<Schema> arrow::Table::schema ( ) const
inline
Returns
the table's schema

◆ SetColumn()

virtual Status arrow::Table::SetColumn ( int  i,
const std::shared_ptr< Column > &  column,
std::shared_ptr< Table > *  out 
) const
pure virtual

Replace a column in the table, producing a new Table.

◆ Validate()

virtual Status arrow::Table::Validate ( ) const
pure virtual

Perform any checks to validate the input arguments.

Member Data Documentation

◆ num_rows_

int64_t arrow::Table::num_rows_
protected

◆ schema_

std::shared_ptr<Schema> arrow::Table::schema_
protected

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