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); tm.AddColumn<T3>("col3", {elt_1, elt_2, elt_3}); // youi can also inline the data like this // option 1: make an Arrow table in local memory auto arrow_table = tm.MakeArrowTable(); // option 2: make the table on the Deephaven server and get a TableHandle to it TableHandleManager manager = ...; auto table_handle = tm.MakeTable(manager);
Public Functions
-
TableMaker()¶
Constructor
-
~TableMaker()¶
Destructor
-
template<typename T>
inline 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 across those calls. That is, when the table has multiple columns, they all have to have the same number of rows.
-
TableHandle MakeTable(const TableHandleManager &manager) const¶
Make a table on the Deephaven server based on all the AddColumn calls you have made so far.
- Parameters:
manager – The TableHandleManager
- Returns:
The TableHandle referencing the newly-created table.
-
TableMaker()¶
-
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
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.