Utility classes#

These are various utility and helper classes available in the system.

class TableMaker#

A convenience class for populating small tables. It is a wrapper around Arrow Flight’s DoPut functionality. Typical usage

TableMaker tm;
std::vector<T1> data1 = { ... };
std::vector<T2> data2 = { ... };
tm.AddColumn("col1", data1);
tm.AddColumn("col2", data2);
auto tableHandle = tm.MakeTable();

Public Functions

TableMaker()#

Constructor

~TableMaker()#

Destructor

template<typename T>
void AddColumn(std::string name, const std::vector<T> &values)#

Creates a column whose server type most closely matches type T, having the given name and values. Each call to this method adds a column. When there are multiple calls to this method, the sizes of the values arrays must be consistent.

TableHandle MakeTable(const TableHandleManager &manager)#

Make the table. Call this after all your calls to AddColumn().

Parameters:

manager – The TableHandleManager

Returns:

The TableHandle referencing the newly-created table.

class FlightWrapper#

This class provides an interface to Arrow Flight, which is the main way to push data into and get data out of the system.

Public Functions

explicit FlightWrapper(std::shared_ptr<impl::TableHandleManagerImpl> impl)#

Constructor. Used internally.

~FlightWrapper()#

Destructor

std::unique_ptr<arrow::flight::FlightStreamReader> GetFlightStreamReader(const TableHandle &table) const#

Construct an Arrow FlightStreamReader that is set up to read the given TableHandle.

Parameters:

table – The table to read from.

Returns:

An Arrow FlightStreamReader

void AddHeaders(arrow::flight::FlightCallOptions *options) const#

Add Deephaven authentication headers, and any other extra headers request at session creation, to Arrow FlightCallOptions.

This is a bit of a hack, and is used in the scenario Where the caller is rolling their own Arrow Flight DoPut operation. Example code might look like this:

// Get a FlightWrapper
auto wrapper = manager.CreateFlightWrapper();
// Get a
auto [result, fd] = manager.newTableHandleAndFlightDescriptor();
// Empty FlightCallOptions
arrow::flight::FlightCallOptions options;
// add Deephaven auth headers to the FlightCallOptions
wrapper.AddHeaders(&options);
std::unique_ptr<arrow::flight::FlightStreamWriter> fsw;
std::unique_ptr<arrow::flight::FlightMetadataReader> fmr;
auto status = wrapper.FlightClient()->DoPut(options, fd, Schema, &fsw, &fmr);

Parameters:

options – Destination object Where the authentication headers should be written.

arrow::flight::FlightClient *FlightClient() const#

Gets the underlying FlightClient

Returns:

A pointer to the FlightClient.