TableHandleManager and TableHandle#

TableHandleManager#

TableHandleManager is used to access existing tables in the system (e.g. via FetchTable) or create new tables (e.g. via EmptyTable or TimeTable). These calls return a TableHandle.

TableHandleManager can also be used to access the arrow::flight::FlightClient for direct access to Arrow.

TableHandle#

Once you have a TableHandle, you can create derived tables via a large variety of methods, such as Where and Sort.

A simple example is:

TableHandle my_data = manager.FetchTable("MyData");
TableHandle filtered = my_data.Where("Price < 100")
    .Sort(SortPair("Timestamp"))
    .Tail(5);

Declarations#

class TableHandleManager#

This class is the main way to get access to new TableHandle objects, via methods like EmptyTable() and FetchTable(). A TableHandleManager is created by Client::GetManager(). You can have more than one TableHandleManager for a given client. The reason you’d want more than one is that (in the future) you will be able to set parameters here that will apply to all TableHandles created by this class, such as flags that control asynchronous behavior. This class is move-only.

Public Functions

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

Constructor. Used internally.

TableHandleManager(TableHandleManager &&other) noexcept#

Move constructor

TableHandleManager &operator=(TableHandleManager &&other) noexcept#

Move assigment operator.

~TableHandleManager()#

Destructor

TableHandle EmptyTable(int64_t size) const#

Creates a “zero-width” table on the server. Such a table knows its number of rows but has no columns.

Parameters:

size – Number of rows in the empty table.

TableHandle FetchTable(std::string table_name) const#

Looks up an existing table by name.

Parameters:

tableName – The name of the table.

TableHandle TimeTable(DurationSpecifier period, TimePointSpecifier start_time = 0, bool blink_table = false) const#

Creates a ticking table.

Parameters:
  • period – Table ticking frequency, specified as a std::chrono::duration, int64_t nanoseconds, or a string containing an ISO 8601 duration representation.

  • start_time – When the table should start ticking, specified as a std::chrono::time_point, int64_t nanoseconds since the epoch, or a string containing an ISO 8601 time point specifier.

Returns:

The TableHandle of the new table.

TableHandle InputTable(const TableHandle &initial_table, std::vector<std::string> key_columns = {}) const#

Creates an input table from an initial table. When key columns are provided, the InputTable will be keyed, otherwise it will be append-only.

Parameters:

columns – The set of key columns

Returns:

A TableHandle referencing the new table

TableHandle MakeTableHandleFromTicket(std::string ticket) const#

Creates a TableHandle that owns the underlying ticket and its resources. The ticket argument is typically created with NewTicket() and then populated e.g. with Arrow operations.

void RunScript(std::string code) const#

Execute a script on the server. This assumes that the Client was created with a sessionType corresponding to the language of the script (typically either “python” or “groovy”) and that the code matches that language.

FlightWrapper CreateFlightWrapper() const#

Creates a FlightWrapper that is used for Arrow Flight integration. Arrow Flight is the primary way to push data into or pull data out of the system. The object returned is only forward-referenced in this file. If you want to use it, you will also need to include deephaven/client/flight.h.

Returns:

A FlightWrapper object.

class TableHandle#

Holds an reference to a server resource representing a table. TableHandle objects have shared ownership semantics so they can be copied freely. When the last TableHandle pointing to a server resource is destructed, the resource will be released.

Public Functions

explicit TableHandle(std::shared_ptr<impl::TableHandleImpl> impl)#

Constructor. Used internally.

TableHandle(const TableHandle &other)#

Copy constructor.

TableHandle &operator=(const TableHandle &other)#

Copy assignment.

TableHandle(TableHandle &&other) noexcept#

Move constructor.

TableHandle &operator=(TableHandle &&other) noexcept#

Move assignment.

~TableHandle()#

Destructor

TableHandleManager GetManager() const#

Get the TableHandlerManager that is managing this TableHandle.

Returns:

the TableHandleManager.

TableHandle Select(std::vector<std::string> column_specs) const#

Select columnSpecs from a table. The columnSpecs can be column names or formulas like “NewCol = A + 12”. See the Deephaven documentation for the difference between “Select” and “View”.

Parameters:

columnSpecs – The columnSpecs

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle Select(Args&&... args) const#

A variadic form of Select(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The arguments to Select

Returns:

A TableHandle referencing the new table

TableHandle View(std::vector<std::string> column_specs) const#

View columnSpecs from a table. The columnSpecs can be column names or formulas like “NewCol = A + 12”. See the Deephaven documentation for the difference between Select() and View().

Parameters:

columnSpecs – The columnSpecs to View

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle View(Args&&... args) const#

A variadic form of View(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The arguments to View

Returns:

A TableHandle referencing the new table

TableHandle DropColumns(std::vector<std::string> column_specs) const#

Creates a new table from this table Where the specified columns have been excluded.

Parameters:

columnSpecs – The columns to exclude.

Returns:

template<typename ...Args>
inline TableHandle DropColumns(Args&&... args) const#

A variadic form of DropColumns(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns to drop

Returns:

A TableHandle referencing the new table

TableHandle Update(std::vector<std::string> column_specs) const#

Creates a new table from this table, but including the additional specified columns.

Parameters:

columnSpecs – The columnSpecs to add. For example, {“X = A + 5”, “Y = X * 2”}. See the Deephaven documentation for the difference between Update() and UpdateView().

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle Update(Args&&... args) const#

A variadic form of Update(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns to Update

Returns:

A TableHandle referencing the new table

TableHandle LazyUpdate(std::vector<std::string> column_specs) const#

Creates a new table containing a new cached formula column for each argument.

Parameters:

columnSpecs – The columnSpecs to add. For exampe, {“X = A + 5”, “Y = X * 2”}. See the Deephaven documentation for the difference between Update() and LazyUpdate().

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle LazyUpdate(Args&&... args) const#

A variadic form of LazyUpdate(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns to LazyUpdate

Returns:

A TableHandle referencing the new table

TableHandle UpdateView(std::vector<std::string> column_specs) const#

Creates a new View from this table, but including the additional specified columns.

Parameters:

columnSpecs – The columnSpecs to add. For exampe, {“X = A + 5”, “Y = X * 2”}. See the Deephaven documentation for the difference between Update() and UpdateView().

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle UpdateView(Args&&... args) const#

A variadic form of UpdateView(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns to UpdateView

Returns:

A TableHandle referencing the new table

TableHandle Where(std::string condition) const#

Creates a new table from this table, filtered by condition. Consult the Deephaven documentation for more information about valid conditions.

Parameters:

condition – A Deephaven boolean expression such as “Price > 100” or “Col3 == Col1 * Col2”.

Returns:

A TableHandle referencing the new table

TableHandle Sort(std::vector<SortPair> sort_pairs) const#

Creates a new table from this table, sorted By sortPairs.

Parameters:

sortPairs – A vector of SortPair objects describing the sort. Each SortPair refers to a column, a sort direction, and whether the sort should consider to the value’s regular or absolute value when doing comparisons.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle Sort(Args&&... args) const#

A variadic form of Sort(std::vector<SortPair>) const

Template Parameters:

Args – One or more SortPairs

Parameters:

args – The sort_pairs

Returns:

A TableHandle referencing the new table

TableHandle By(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs with the column content grouped into arrays.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle By(Args&&... args) const#

A variadic form of By(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns to UpdateView

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle By(AggregateCombo combo, Args&&... args) const#

A variadic form of By(AggregateCombo, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns to UpdateView

Returns:

A TableHandle referencing the new table

TableHandle MinBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “Min” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle MinBy(Args&&... args) const#

A variadic form of MinBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns to UpdateView

Returns:

A TableHandle referencing the new table

TableHandle MaxBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “Max” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle MaxBy(Args&&... args) const#

A variadic form of MaxBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle SumBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “Sum” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle SumBy(Args&&... args) const#

A variadic form of SumBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle AbsSumBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “AbsSum” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle AbsSumBy(Args&&... args) const#

A variadic form of AbsSumBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle VarBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “Var” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle VarBy(Args&&... args) const#

A variadic form of VarBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle StdBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “std” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle StdBy(Args&&... args) const#

A variadic form of StdBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle AvgBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “Avg” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle AvgBy(Args&&... args) const#

A variadic form of AvgBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle FirstBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “First” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle FirstBy(Args&&... args) const#

A variadic form of FirstBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle LastBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “Last” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle LastBy(Args&&... args) const#

A variadic form of LastBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle MedianBy(std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “median” aggregate operation applied to the remaining columns.

Parameters:

columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle MedianBy(Args&&... args) const#

A variadic form of LastBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle PercentileBy(double percentile, bool avg_median, std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “percentile” aggregate operation applied to the remaining columns.

Parameters:
  • percentile – The designated percentile

  • columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle PercentileBy(double percentile, bool avg_median, Args&&... args) const#

A variadic form of PercentileBy(double, bool, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle PercentileBy(double percentile, std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, with the “percentile” aggregate operation applied to the remaining columns.

Parameters:
  • percentile – The designated percentile

  • columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle PercentileBy(double percentile, Args&&... args) const#

A variadic form of PercentileBy(double, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle CountBy(std::string count_by_column, std::vector<std::string> columnSpecs) const#

Creates a new table from this table, grouped by columnSpecs, having a new column named By countByColumn containing the size of each group.

Parameters:
  • countByColumn – Name of the output column.

  • columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle CountBy(std::string count_by_column, Args&&... args) const#

A variadic form of CountBy(std::string, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle WAvgBy(std::string weight_column, std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, having a new column named By weightColumn containing the weighted average of each group.

Parameters:
  • countByColumn – Name of the output column.

  • columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle WAvgBy(std::string weight_column, Args&&... args) const#

A variadic form of WAvgBy(std::string, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle TailBy(int64_t n, std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, containing the Last n rows of each group.

Parameters:
  • n – Number of rows

  • columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle TailBy(int64_t n, Args&&... args) const#

A variadic form of TailBy(int64_t, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle HeadBy(int64_t n, std::vector<std::string> column_specs) const#

Creates a new table from this table, grouped by columnSpecs, containing the First n rows of each group.

Parameters:
  • n – Number of rows

  • columnSpecs – Columns to group by.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle HeadBy(int64_t n, Args&&... args) const#

A variadic form of HeadBy(int64_t, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle Head(int64_t n) const#

Creates a new table from this table containing the First n rows of this table.

Parameters:

n – Number of rows

Returns:

A TableHandle referencing the new table

TableHandle Tail(int64_t n) const#

Creates a new table from this table containing the Last n rows of this table.

Parameters:

n – Number of rows

Returns:

A TableHandle referencing the new table

TableHandle Ungroup(bool null_fill, std::vector<std::string> group_by_columns) const#

Creates a new table from this table with the column array data ungrouped. This is the inverse of the By(std::vector<std::string>) const operation.

Parameters:

groupByColumns – Columns to Ungroup.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle Ungroup(bool null_fill, Args&&... args) const#

A variadic form of Ungroup(bool, std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

inline TableHandle Ungroup(std::vector<std::string> group_by_columns) const#

Creates a new table from this table with the column array data ungrouped. This is the inverse of the By(std::vector<std::string>) const operation.

Parameters:

groupByColumns – Columns to Ungroup.

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle Ungroup(Args&&... args) const#

A variadic form of Ungroup(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle Merge(std::string key_columns, std::vector<TableHandle> sources) const#

Creates a new table By merging sources together. The tables are essentially stacked on top of each other.

Parameters:

sources – The tables to Merge.

Returns:

A TableHandle referencing the new table

template<typename ...Rest>
inline TableHandle Merge(std::string key_column, TableHandle first, Rest&&... rest) const#

A variadic form of Merge(std::string, std::vector<std::string>) const that takes a combination of argument types.

Parameters:
  • first – The first TableHandle in the list of sources.

  • rest – The rest of the TableHandles in the list of sources. The arguments are split this way to aid in overload resolution.

  • args – The columns

Template Parameters:

Rest – Zero or more TableHandles

Returns:

A TableHandle referencing the new table

inline TableHandle Merge(std::vector<TableHandle> sources) const#

Creates a new table By merging sources together. The tables are essentially stacked on top of each other.

Parameters:

sources – The tables to Merge.

Returns:

A TableHandle referencing the new table

template<typename ...Rest>
inline TableHandle Merge(TableHandle first, Rest&&... rest) const#

A variadic form of Merge(std::vector<std::string>) const that takes a combination of argument types.

Parameters:
  • first – The first TableHandle in the list of sources.

  • rest – The rest of the TableHandles in the list of sources. The arguments are split this

  • args – The columns

Template Parameters:

Rest – Zero or more TableHandles

Returns:

A TableHandle referencing the new table

TableHandle CrossJoin(const TableHandle &right_side, std::vector<std::string> columns_to_match, std::vector<std::string> columns_to_add) const#

Creates a new table By cross joining this table with rightSide. The tables are joined By the columns in columnsToMatch, and columns from rightSide are brought in and optionally renamed By columnsToAdd. Example:

t1.CrossJoin({"Col1", "Col2"}, {"Col3", "NewCol=Col4"})

Parameters:
  • rightSide – The table to join with this table

  • columns_to_match – The columns to join on

  • columns_to_add – The columns from the right side to add, and possibly rename.

Returns:

A TableHandle referencing the new table

TableHandle NaturalJoin(const TableHandle &right_side, std::vector<std::string> columns_to_match, std::vector<std::string> columns_to_add) const#

Creates a new table By natural joining this table with rightSide. The tables are joined By the columns in columnsToMatch, and columns from rightSide are brought in and optionally renamed By columnsToAdd. Example:

t1.NaturalJoin({"Col1", "Col2"}, {"Col3", "NewCol=Col4"})

Parameters:
  • rightSide – The table to join with this table

  • columns_to_match – The columns to join on

  • columns_to_add – The columns from the right side to add, and possibly rename.

Returns:

A TableHandle referencing the new table

TableHandle ExactJoin(const TableHandle &right_side, std::vector<std::string> columns_to_match, std::vector<std::string> columns_to_add) const#

Creates a new table By exact joining this table with rightSide. The tables are joined By the columns in columnsToMatch, and columns from rightSide are brought in and optionally renamed By columnsToAdd. Example:

t1.ExactJoin({"Col1", "Col2"}, {"Col3", "NewCol=Col4"})

Parameters:
  • rightSide – The table to join with this table

  • columns_to_match – The columns to join on

  • columns_to_add – The columns from the right side to add, and possibly rename.

Returns:

A TableHandle referencing the new table

TableHandle Aj(const TableHandle &right_side, std::vector<std::string> on, std::vector<std::string> joins = {}) const#

Creates a new table containing all the rows and columns of the left table, plus additional columns containing data from the right table. For columns appended to the left table (joins), row values equal the row values from the right table where the keys from the left table most closely match the keys from the right table without going over. If there is no matching key in the right table, appended row values are NULL.

Parameters:
  • right_side – The table to join with this table

  • on – The column(s) to match, can be a common name or a match condition of two columns, e.g. ‘col_a = col_b’. The first ‘N-1’ matches are exact matches. The final match is an inexact match. The inexact match can use either ‘>’ or ‘>=’. If a common name is used for the inexact match, ‘>=’ is used for the comparison.

  • joins – The column(s) to be added from the right table to the result table, can be renaming expressions, i.e. “new_col = col”; default is empty, which means all the columns from the right table, excluding those specified in ‘on’

TableHandle Raj(const TableHandle &right_side, std::vector<std::string> on, std::vector<std::string> joins = {}) const#

Creates a new table containing all the rows and columns of the left table, plus additional columns containing data from the right table. For columns appended to the left table (joins), row values equal the row values from the right table where the keys from the left table most closely match the keys from the right table without going under. If there is no matching key in the right table, appended row values are NULL.

Parameters:
  • right_side – The table to join with this table

  • on – The column(s) to match, can be a common name or a match condition of two columns, e.g. ‘col_a = col_b’. The first ‘N-1’ matches are exact matches. The final match is an inexact match. The inexact match can use either ‘<’ or ‘<=’. If a common name is used for the inexact match, ‘<=’ is used for the comparison.

  • joins – The column(s) to be added from the right table to the result table, can be renaming expressions, i.e. “new_col = col”; default is empty, which means all the columns from the right table, excluding those specified in ‘on’

TableHandle UpdateBy(std::vector<UpdateByOperation> ops, std::vector<std::string> by) const#

Performs one or more UpdateByOperation ops grouped by zero or more key columns to calculate cumulative or window-based aggregations of columns in a source table. Operations include cumulative sums, moving averages, EMAs, etc. The aggregations are defined by the provided operations, which support incremental aggregations over the corresponding rows in the source table. Cumulative aggregations use all rows in the source table, whereas rolling aggregations will apply position or time-based windowing relative to the current row. Calculations are performed over all rows or each row group as identified by the provided key columns.

Parameters:
  • ops – The requested UpdateByOperation ops

  • by – The columns to group by

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle UpdateBy(Args&&... args) const#

A variadic form of UpdateBy(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle SelectDistinct(std::vector<std::string> columns) const#

Creates a new table containing all of the unique values for a set of key columns. When used on multiple columns, it looks for distinct sets of values in the selected columns.

Parameters:

columns – The set of key columns

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle SelectDistinct(Args&&... args) const#

A variadic form of SelectDistinct(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

TableHandle WhereIn(const TableHandle &filter_table, std::vector<std::string> columns) const#

Creates a new table containing rows from the source table, where the rows match values in the filter table. The filter is updated whenever either table changes. See the Deephaven documentation for the difference between “Where” and “WhereIn”.

Parameters:
  • filter_table – The table containing the set of values to filter on

  • columns – The columns to match on

Returns:

A TableHandle referencing the new table

template<typename ...Args>
inline TableHandle WhereIn(const TableHandle &filter_table, Args&&... args) const#

A variadic form of WhereIn(std::vector<std::string>) const that takes a combination of argument types.

Template Parameters:

Args – Any combination of std::string, std::string_view, or const char *

Parameters:

args – The columns

Returns:

A TableHandle referencing the new table

void AddTable(const TableHandle &table_to_add)#

Adds a table to an input table. Requires that this object be an InputTable (such as that created by TableHandleManager::InputTable).

Parameters:

table_to_add – The table to add to the InputTable

void RemoveTable(const TableHandle &table_to_remove)#

Removes a table from an input table. Requires that this object be an InputTable (such as that created by TableHandleManager::InputTable).

Parameters:

table_to_add – The table to remove from the InputTable

Returns:

The new table

void BindToVariable(std::string variable) const#

Binds this table to a variable name in the QueryScope.

Parameters:

variable – The QueryScope variable to bind to.

internal::TableHandleStreamAdaptor Stream(bool want_headers) const#

Create an ostream adpator that prints a human-readable representation of the table to a C++ stream. Example:

std::cout << table.Stream(true) << std::endl;

Parameters:

wantHeaders – Include column headers.

Returns:

std::string ToString(bool want_headers) const#

Used internally, for demo purposes.

inline void Release()#

A specialized operation to Release the state of this TableHandle. This operation is normally done By the destructor, so most programs will never need to call this method.. If there are no other copies of this TableHandle, and if there are no “child” TableHandles dependent on this TableHandle, then the corresponding server resources will be released.

int64_t NumRows() const#

Number of rows in the table at the time this TableHandle was created.

bool IsStatic() const#

Whether the table was static at the time this TableHandle was created.

std::shared_ptr<SchemaType> Schema() const#

Returns the table’s Schema.

inline const std::shared_ptr<impl::TableHandleImpl> &Impl() const#

Used internally. Returns the underlying Impl object.

std::shared_ptr<arrow::flight::FlightStreamReader> GetFlightStreamReader() const#

Construct an arrow FlightStreamReader bound to this table

Returns:

the Arrow FlightStreamReader.

std::shared_ptr<SubscriptionHandle> Subscribe(std::shared_ptr<TickingCallback> callback)#

Subscribe to a ticking table.

std::shared_ptr<SubscriptionHandle> Subscribe(onTickCallback_t on_tick, void *on_tick_user_data, onErrorCallback_t on_error, void *on_error_user_data)#

Subscribe to a ticking table (C-style).

void Unsubscribe(std::shared_ptr<SubscriptionHandle> callback)#

Unsubscribe from the table.

const std::string &GetTicketAsString() const#

Get access to the bytes of the Deephaven “Ticket” type (without having to reference the protobuf data structure, which we would prefer not to have a dependency on here)