Utility classes

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

class deephaven::client::utility::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

  • tableName – The name of the table

Returns

The TableHandle referencing the newly-created table.

class deephaven::client::highlevel::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::shared_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 addAuthHeaders(arrow::flight::FlightCallOptions *options)

Add Deephaven authentication headers 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.addAuthHeaders(&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.