Table operations overview

A quick reference for table operations

This page is a quick-reference index of common table operations in Deephaven. Find your task in the table, then follow the link to the operation's reference page for its syntax and examples.

These operations work on static tables and on real-time tables that tick. When the source data changes, their results update with it. A few have restrictions. rangeJoin supports only static tables. Some operations, such as groupBy, raise an error on blink tables. Aggregations on blink tables cover every row since the aggregation started, not only the current cycle's rows. See specialized semantics for blink tables.

To learn a group of operations by task, see the how-to guides:

To choose from the aggregation operations, see Aggregations in Deephaven. To learn the concepts behind table operations, such as immutability, formula strings, and the dependency graph, see Understanding the Table API. For formulas in depth, see Formulas.

Quick reference

I want to...Use this
Keep rows matching a conditionwhere("condition")
Keep rows whose key values appear, or don't appear, in another tablewhereIn(filterTable, "Key") / whereNotIn(filterTable, "Key")
Get the first or last n rowshead(n) / tail(n)
Add columns (stored in memory)update("NewColumn = formula")
Add columns (computed on demand)updateView("NewColumn = formula")
Keep or compute specific columns (stored in memory), dropping the restselect("Column1", "NewColumn = formula")
Keep or compute specific columns (computed on demand), dropping the restview("Column1", "NewColumn = formula")
Remove columnsdropColumns("Column1")
Rename columnsrenameColumns("NewName = OldName")
Sort by columnsort("Column")
Sort in descending ordersortDescending("Column")
Add columns from a lookup table (at most one match per row, null if no match)naturalJoin(other, "Key", "AddedColumn")
Add columns from a table where every row must have exactly one matchexactJoin(other, "Key", "AddedColumn")
Join every matching row, or cross join with no keyjoin(other, "Key")
Match on a timestamp or other ordered key (closest at or before)aj(other, "Key, Timestamp", "AddedColumn")
Match on a timestamp or other ordered key (closest at or after)raj(other, "Key, Timestamp", "AddedColumn")
Group right-table values that fall in a range (static tables only)rangeJoin(other, ["Key", "Start <= Timestamp <= End"], [AggGroup(...)])
Apply one aggregation to every non-key column, per groupsumBy("Key") (also avgBy, maxBy, minBy, and similar dedicated aggregations)
Count the rows in each groupcountBy("Count", "Key")
Apply different aggregations to different columns, per groupaggBy([AggSum(...)], "Key")
Collect each group's values into arrays, or expand arrays back into rowsgroupBy("Key") / ungroup()
Compute cumulative or rolling valuesupdateBy([CumSum(...)], "Key")
Stack tables on top of each othermerge(table1, table2)

Most entries are methods on a table. merge is a static method. AggSum and AggGroup, which create aggregations, are static methods too. CumSum, which creates an update-by operation, is also a static method. Deephaven's Groovy sessions import these static methods by default, so your code needs no import statement.

Diving deeper: API references

For the full interface definitions and operation contracts, see the generated API documentation:

Each operation's reference page, such as where or update, also links to the relevant Javadoc.