Interface Table
- All Superinterfaces:
AttributeMap<Table>
,DynamicNode
,GridAttributes<Table>
,LivenessManager
,LivenessNode
,LivenessReferent
,LogOutputAppendable
,LongSizedDataStructure
,NotificationQueue.Dependency
,SystemicObject<Table>
,TableOperations<Table,
Table>
- All Known Subinterfaces:
IcebergTable
,LazySnapshotTable
,TableAdapter
,TableDefaults
- All Known Implementing Classes:
AppendOnlyArrayBackedInputTable
,BarrageBlinkTable
,BarrageRedirectedTable
,BarrageTable
,BaseTable
,DeferredViewTable
,IcebergTableImpl
,InMemoryTable
,KeyedArrayBackedInputTable
,PartitionAwareSourceTable
,QueryReplayGroupedTable
,QueryTable
,QueryTable.FilteredTable
,RedefinableTable
,ReplayGroupedFullTable
,ReplayLastByGroupedTable
,ReplayTable
,ReplayTableBase
,SimpleSourceTable
,SourceTable
,TimeTable
,UncoalescedTable
,UpdatableTable
,UpdateSourceQueryTable
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
If this attribute is set, we can only add new row keys, we can never shift them, modify them, or remove them.static final String
Attribute on aggregation results used for hierarchical table construction.static final String
If this attribute is set, we can only append new row keys to the end of the table.static final String
Set this attribute to enable collection of barrage performance stats.static final String
If this attribute is present with valuetrue
, this Table is a "blink table".static final String
static final String
This attribute is applied to the descendants of source tables, and takes on Boolean values.static final String
static final String
static final String
This attribute is used internally by TableTools.merge to detect successive merges.static final String
Set this attribute for tables that should not be displayed in the UI.static final String
Set this attribute to load a plugin for this table in the Web Clientstatic final String
This attribute stores a reference to a table that is the parent table for a Preview Table.static final String
static final String
Attribute on sort results used for hierarchical table construction.static final String
The query engine may set or read this attribute to determine if a table is sorted by a particular column.static final String
static final String
static final String
static final String
Fields inherited from interface io.deephaven.engine.table.GridAttributes
COLUMN_DESCRIPTIONS_ATTRIBUTE, DESCRIPTION_ATTRIBUTE, LAYOUT_HINTS_ATTRIBUTE, SORTABLE_COLUMNS_ATTRIBUTE
Fields inherited from interface io.deephaven.api.TableOperations
AGG_BY_PRESERVE_EMPTY_DEFAULT
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addUpdateListener
(ShiftObliviousListener listener) Subscribe for updates to this table.void
addUpdateListener
(ShiftObliviousListener listener, boolean replayInitialImage) Subscribe for updates to this table.void
addUpdateListener
(TableUpdateListener listener) Subscribe for updates to this table.boolean
addUpdateListener
(TableUpdateListener listener, long requiredLastNotificationStep) Subscribe for updates to this table if its last notification step matchesrequiredLastNotificationStep
.<R> R
Applies a function to this table.applyToAllBy
(String formulaColumn, String... groupByColumns) Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.applyToAllBy
(String formulaColumn, String columnParamName, Collection<? extends ColumnName> groupByColumns) Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.applyToAllBy
(String formulaColumn, Collection<? extends ColumnName> groupByColumns) Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.void
Wait for updates to this Table.boolean
awaitUpdate
(long timeout) Wait for updates to this Table.byteColumnIterator
(@NotNull String columnName) characterColumnIterator
(@NotNull String columnName) void
close()
Release resources held by this table, possibly destructively.coalesce()
Explicitly ensure that any work needed to make a table addressable, iterable, or queryable has been done, and return the coalesced child table if appropriate.<DATA_TYPE>
CloseableIterator<DATA_TYPE>columnIterator
(@NotNull String columnName) doubleColumnIterator
(@NotNull String columnName) flatten()
Creates a version of this table with a flat RowSet.floatColumnIterator
(@NotNull String columnName) formatColumns
(String... columnFormats) formatColumnWhere
(String columnName, String condition, String formula) formatRowWhere
(String condition, String formula) <T> ColumnSource<T>
getColumnSource
(String sourceName) Retrieves aColumnSource
.<T> ColumnSource<T>
getColumnSource
(String sourceName, Class<? extends T> clazz) <T> ColumnSource<T>
getColumnSource
(String sourceName, Class<? extends T> clazz, Class<?> componentType) Retrieves aColumnSource
andColumnSource.cast(Class, Class)
casts} it to the target classclazz
andcomponentType
.Map<String,
? extends ColumnSource<?>> Collection<? extends ColumnSource<?>>
getSubTable
(TrackingRowSet rowSet) Get aTable
that contains a sub-set of the rows fromthis
.boolean
hasColumns
(String... columnNames) Determines whether this Table contains a column for each string in the specified array ofcolumnNames
.boolean
hasColumns
(Collection<String> columnNames) Determines whether this Table contains a column for each string in the specified collection ofcolumnNames
.headBy
(long nRows, Collection<String> groupByColumnNames) headPct
(double percent) Provides a head that selects a dynamic number of rows based on a percent.integerColumnIterator
(@NotNull String columnName) boolean
isEmpty()
Returnstrue
if this table has no rows (i.e.boolean
isFailed()
boolean
isFlat()
Return true if this table is guaranteed to be flat.boolean
Is the node updating?longColumnIterator
(@NotNull String columnName) meta()
Provides column metadata in Table form.moveColumns
(int index, String... columnsToMove) Produce a new table with the specified columns moved to the specifiedindex
.moveColumnsDown
(String... columnsToMove) Produce a new table with the specified columns moved to the rightmost position.moveColumnsUp
(String... columnsToMove) Produce a new table with the specified columns moved to the leftmost position.int
Get the number of columns defined for this table.<DATA_TYPE>
CloseableIterator<DATA_TYPE>objectColumnIterator
(@NotNull String columnName) <DATA_TYPE>
CloseableIterator<DATA_TYPE>objectColumnIterator
(@NotNull String columnName, @NotNull Class<? extends DATA_TYPE> clazz) partitionBy
(boolean dropKeys, String... keyColumnNames) Create aPartitionedTable
from this table, partitioned according to the specified key columns.partitionBy
(String... keyColumnNames) Equivalent topartitionBy(false, keyColumnNames)
partitionedAggBy
(Collection<? extends Aggregation> aggregations, boolean preserveEmpty, Table initialGroups, String... keyColumnNames) Convenience method that performs anTableOperations.aggBy(io.deephaven.api.agg.Aggregation)
and wraps the result in aPartitionedTable
.void
Attempt to release cached resources held by this table.If this table is a blink table, i.e.void
removeUpdateListener
(ShiftObliviousListener listener) Unsubscribe the supplied listener.void
removeUpdateListener
(TableUpdateListener listener) Unsubscribe the supplied listener.renameAllColumns
(UnaryOperator<String> renameFunction) Produce a new table with the specified columns renamed using the provided function.renameColumns
(String... pairs) Produce a new table with the specified columns renamed using the syntax"NewColumnName=OldColumnName"
.renameColumns
(Collection<Pair> pairs) Produce a new table with the specified columns renamed using the specifiedpairs
.rollup
(Collection<? extends Aggregation> aggregations) Create a rollup table.rollup
(Collection<? extends Aggregation> aggregations, boolean includeConstituents) Create a rollup table.rollup
(Collection<? extends Aggregation> aggregations, boolean includeConstituents, String... groupByColumns) Create a rollup table.rollup
(Collection<? extends Aggregation> aggregations, boolean includeConstituents, Collection<? extends ColumnName> groupByColumns) Create a rollup table.rollup
(Collection<? extends Aggregation> aggregations, String... groupByColumns) Create a rollup table.rollup
(Collection<? extends Aggregation> aggregations, Collection<? extends ColumnName> groupByColumns) Create a rollup table.setTotalsTable
(String directive) Set a totals table for this Table.shortColumnIterator
(@NotNull String columnName) long
slicePct
(double startPercentInclusive, double endPercentExclusive) Extracts a subset of a table by row percentages.tailBy
(long nRows, Collection<String> groupByColumnNames) tailPct
(double percent) Provides a tail that selects a dynamic number of rows based on a percent.Create a hierarchical tree table.Set the table's key columns.withUniqueKeys
(String... columns) Set the table's key columns and indicate that each key set will be unique.wouldMatch
(WouldMatchPair... matchers) A table operation that applies the supplied predicate to each row in the table and produces columns containing the pass/fail result of the predicate application.wouldMatch
(String... expressions) Methods inherited from interface io.deephaven.engine.table.AttributeMap
getAttribute, getAttributeKeys, getAttributes, getAttributes, hasAttribute, retainingAttributes, withAttributes, withAttributes, withoutAttributes
Methods inherited from interface io.deephaven.engine.updategraph.DynamicNode
addParentReference, setRefreshing
Methods inherited from interface io.deephaven.engine.table.GridAttributes
clearSortingRestrictions, restrictSortTo, setLayoutHints, withColumnDescription, withColumnDescriptions, withDescription
Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, tryManage, tryUnmanage, tryUnmanage, unmanage, unmanage
Methods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
Methods inherited from interface io.deephaven.base.log.LogOutputAppendable
append
Methods inherited from interface io.deephaven.util.datastructures.LongSizedDataStructure
intSize, intSize, size
Methods inherited from interface io.deephaven.engine.updategraph.NotificationQueue.Dependency
getUpdateGraph, getUpdateGraph, satisfied
Methods inherited from interface io.deephaven.engine.util.systemicmarking.SystemicObject
isSystemicObject, markSystemic
Methods inherited from interface io.deephaven.api.TableOperations
absSumBy, absSumBy, absSumBy, absSumBy, aggAllBy, aggAllBy, aggAllBy, aggAllBy, aggBy, aggBy, aggBy, aggBy, aggBy, aggBy, aggBy, aggBy, aj, aj, asOfJoin, avgBy, avgBy, avgBy, avgBy, countBy, countBy, countBy, countBy, dropColumns, dropColumns, dropColumns, exactJoin, exactJoin, exactJoin, firstBy, firstBy, firstBy, firstBy, groupBy, groupBy, groupBy, head, join, join, join, join, join, lastBy, lastBy, lastBy, lastBy, lazyUpdate, lazyUpdate, maxBy, maxBy, maxBy, maxBy, medianBy, medianBy, medianBy, medianBy, minBy, minBy, minBy, minBy, naturalJoin, naturalJoin, naturalJoin, raj, raj, rangeJoin, rangeJoin, reverse, select, select, select, selectDistinct, selectDistinct, selectDistinct, slice, snapshot, snapshotWhen, snapshotWhen, snapshotWhen, sort, sort, sortDescending, stdBy, stdBy, stdBy, stdBy, sumBy, sumBy, sumBy, sumBy, tail, ungroup, ungroup, ungroup, ungroup, ungroup, update, update, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateView, updateView, varBy, varBy, varBy, varBy, view, view, wavgBy, wavgBy, wavgBy, wavgBy, where, where, whereIn, whereIn, whereNotIn, whereNotIn, wsumBy, wsumBy, wsumBy, wsumBy
-
Field Details
-
INPUT_TABLE_ATTRIBUTE
- See Also:
-
KEY_COLUMNS_ATTRIBUTE
- See Also:
-
UNIQUE_KEYS_ATTRIBUTE
- See Also:
-
FILTERABLE_COLUMNS_ATTRIBUTE
- See Also:
-
TOTALS_TABLE_ATTRIBUTE
- See Also:
-
ADD_ONLY_TABLE_ATTRIBUTE
If this attribute is set, we can only add new row keys, we can never shift them, modify them, or remove them.- See Also:
-
APPEND_ONLY_TABLE_ATTRIBUTE
If this attribute is set, we can only append new row keys to the end of the table. We can never shift them, modify them, or remove them.- See Also:
-
TEST_SOURCE_TABLE_ATTRIBUTE
- See Also:
-
BLINK_TABLE_ATTRIBUTE
If this attribute is present with valuetrue
, this Table is a "blink table".A blink table provides a tabular presentation of rows accumulated from a stream since the previous cycle. Rows added on a particular cycle are always removed on the following cycle. Note that this means any particular row of data (not to be confused with a row key) never exists for more than one cycle. A blink table will never deliver modifies or shifts as part of its
updates
, just adds for this cycle's new data and removes for the previous cycle's old data.Aggregation operations (e.g.
TableOperations.aggBy(io.deephaven.api.agg.Aggregation)
,TableOperations.aggAllBy(io.deephaven.api.agg.spec.AggSpec)
,TableOperations.countBy(java.lang.String)
, etc) on blink tables have special semantics, allowing the result to aggregate over the entire observed stream of rows from the time the operation is initiated. That means, for example, that aTableOperations.sumBy()
on a blink table will contain the result sums for each aggregation group over all observed rows since thesumBy
was applied, rather than just the sums for the current update cycle. This allows for aggregations over the full history of a stream to be performed with greatly reduced memory costs when compared to the alternative strategy of holding the entirety of the stream as an in-memory table.All other operations on blink tables behave exactly as they do on other tables; that is, adds and removes are processed as normal. For example
select
on a blink table will have only the newly added rows on current update cycle.The special aggregation semantics necessitate a few exclusions, i.e. operations that cannot be supported because they need to keep track of all rows:
groupBy
is unsupportedpartitionBy
is unsupportedpartitionedAggBy
is unsupportedaggBy
is unsupported if eithergroup
orpartition
is usedrollup
is unsupported ifincludeConstituents == true
tree
is unsupported
To disable these semantics, a
removeBlink
method is offered.- See Also:
-
SORTED_COLUMNS_ATTRIBUTE
The query engine may set or read this attribute to determine if a table is sorted by a particular column.- See Also:
-
SYSTEMIC_TABLE_ATTRIBUTE
- See Also:
-
AGGREGATION_ROW_LOOKUP_ATTRIBUTE
Attribute on aggregation results used for hierarchical table construction. Specification is left to the implementation.- See Also:
-
SORT_REVERSE_LOOKUP_ATTRIBUTE
Attribute on sort results used for hierarchical table construction. Specification is left to the implementation.- See Also:
-
SNAPSHOT_VIEWPORT_TYPE
- See Also:
-
MERGED_TABLE_ATTRIBUTE
This attribute is used internally by TableTools.merge to detect successive merges. Its presence indicates that it is safe to decompose the table into its multiple constituent parts.- See Also:
-
INITIALLY_EMPTY_COALESCED_SOURCE_TABLE_ATTRIBUTE
This attribute is applied to the descendants of source tables, and takes on Boolean values.
- True for the result of
coalesce()
on source tables and their children if the source table was initially empty on coalesce. - Missing for all other tables.
size() > 0
, this hint should be disregarded.- See Also:
- True for the result of
-
PREVIEW_PARENT_TABLE
This attribute stores a reference to a table that is the parent table for a Preview Table.- See Also:
-
NON_DISPLAY_TABLE
Set this attribute for tables that should not be displayed in the UI.- See Also:
-
PLUGIN_NAME
Set this attribute to load a plugin for this table in the Web Client- See Also:
-
BARRAGE_PERFORMANCE_KEY_ATTRIBUTE
Set this attribute to enable collection of barrage performance stats.- See Also:
-
-
Method Details
-
getDefinition
-
meta
Provides column metadata in Table form.- Returns:
- A Table of metadata about this Table's columns.
-
getDescription
-
numColumns
Get the number of columns defined for this table. Equivalent togetDefinition().getColumns().length
.- Returns:
- The number of columns defined for this table
-
hasColumns
Determines whether this Table contains a column for each string in the specified array ofcolumnNames
.- Parameters:
columnNames
- The array of column names to be checked for inclusion in this table. Must not benull
.- Returns:
true
if this Table contains a column for each and every string in thecolumnNames
array;false
if any element ofcolumnNames
is not the name of a column in this table
-
hasColumns
Determines whether this Table contains a column for each string in the specified collection ofcolumnNames
.- Parameters:
columnNames
- The collection of column names to be checked for inclusion in this table. Must not benull
.- Returns:
true
if this Table contains a column for each and every string in thecolumnNames
collection;false
if any element ofcolumnNames
is not the name of a column in this table
-
isRefreshing
Description copied from interface:DynamicNode
Is the node updating?- Specified by:
isRefreshing
in interfaceDynamicNode
- Returns:
- true if the node is updating; false otherwise.
-
getRowSet
TrackingRowSet getRowSet()- Returns:
- The
TrackingRowSet
that exposes the row keys present in this Table
-
sizeForInstrumentation
long sizeForInstrumentation() -
isEmpty
boolean isEmpty()Returnstrue
if this table has no rows (i.e.size() == 0
).- Returns:
true
if this table has no rows
-
isFlat
Return true if this table is guaranteed to be flat. The RowSet of a flat table will be from 0...numRows-1. -
getColumnSource
Retrieves aColumnSource
. It is conveniently cast toColumnSource<Object>
using the type that caller expects. This differs fromgetColumnSource(String, Class)
which uses the providedClass
object to verify that the data type is a subclass of the expected class.The success of this call is equivalent to
getDefinition().checkColumn(sourceName)
, which is the preferred way to check for compatibility in scenarios where the caller does not want the implementation to potentially invokecoalesce()
.- Type Parameters:
T
- The target type, as a type parameter. Inferred from context.- Parameters:
sourceName
- The name of the column- Returns:
- The column source for
sourceName
, parameterized byT
- See Also:
-
getColumnSource
Retrieves aColumnSource
andcasts
it to the target classclazz
.The success of this call is equivalent to
getDefinition().checkColumn(sourceName, clazz)
, which is the preferred way to check for compatibility in scenarios where the caller does not want to the implementation to potentially invokecoalesce()
.- Type Parameters:
T
- The target type, as a type parameter. Intended to be inferred fromclazz
.- Parameters:
sourceName
- The name of the columnclazz
- The target type- Returns:
- The column source for
sourceName
, parameterized byT
- See Also:
-
getColumnSource
<T> ColumnSource<T> getColumnSource(String sourceName, Class<? extends T> clazz, @Nullable Class<?> componentType) Retrieves aColumnSource
andColumnSource.cast(Class, Class)
casts} it to the target classclazz
andcomponentType
.The success of this call is equivalent to
getDefinition().checkColumn(sourceName, clazz, componentType)
, which is the preferred way to check for compatibility in scenarios where the caller does not want the implementation to potentially invokecoalesce()
.- Type Parameters:
T
- The target type, as a type parameter. Intended to be inferred fromclazz
.- Parameters:
sourceName
- The name of the columnclazz
- The target typecomponentType
- The target component type, may be null- Returns:
- The column source for
sourceName
, parameterized byT
- See Also:
-
getColumnSourceMap
Map<String,? extends ColumnSource<?>> getColumnSourceMap() -
getColumnSources
Collection<? extends ColumnSource<?>> getColumnSources() -
columnIterator
-
characterColumnIterator
-
byteColumnIterator
-
shortColumnIterator
-
integerColumnIterator
-
longColumnIterator
-
floatColumnIterator
-
doubleColumnIterator
-
objectColumnIterator
-
objectColumnIterator
<DATA_TYPE> CloseableIterator<DATA_TYPE> objectColumnIterator(@NotNull @NotNull String columnName, @NotNull @NotNull Class<? extends DATA_TYPE> clazz) -
wouldMatch
A table operation that applies the supplied predicate to each row in the table and produces columns containing the pass/fail result of the predicate application. This is similar toTableOperations.where(String...)
except that instead of selecting only rows that meet the criteria, new columns are added with the result of the comparison.- Returns:
- a table with new columns containing the filter result for each row.
-
wouldMatch
-
dropColumnFormats
-
renameColumns
Produce a new table with the specified columns renamed using the specifiedpairs
. The renames are simultaneous and unordered, enabling direct swaps between column names. The resulting table retains the original column ordering after applying the specified renames.IllegalArgumentException
will be thrown:- if a source column does not exist
- if a source column is used more than once
- if a destination column is used more than once
- Parameters:
pairs
- The columns to rename- Returns:
- The new table, with the columns renamed
-
renameColumns
Produce a new table with the specified columns renamed using the syntax"NewColumnName=OldColumnName"
. The renames are simultaneous and unordered, enabling direct swaps between column names. The resulting table retains the original column ordering after applying the specified renames.IllegalArgumentException
will be thrown:- if a source column does not exist
- if a source column is used more than once
- if a destination column is used more than once
- Parameters:
pairs
- The columns to rename- Returns:
- The new table, with the columns renamed
-
renameAllColumns
Produce a new table with the specified columns renamed using the provided function. The renames are simultaneous and unordered, enabling direct swaps between column names. The resulting table retains the original column ordering after applying the specified renames.IllegalArgumentException
will be thrown:- if a destination column is used more than once
- Parameters:
renameFunction
- The function to apply to each column name- Returns:
- The new table, with the columns renamed
-
formatColumns
-
formatRowWhere
-
formatColumnWhere
-
moveColumnsUp
Produce a new table with the specified columns moved to the leftmost position. Columns can be renamed with the usual syntax, i.e."NewColumnName=OldColumnName")
. The renames are simultaneous and unordered, enabling direct swaps between column names. All other columns are left in their original order.IllegalArgumentException
will be thrown:- if a source column does not exist
- if a source column is used more than once
- if a destination column is used more than once
- Parameters:
columnsToMove
- The columns to move to the left (and, optionally, to rename)- Returns:
- The new table, with the columns rearranged as explained above
-
moveColumnsDown
Produce a new table with the specified columns moved to the rightmost position. Columns can be renamed with the usual syntax, i.e."NewColumnName=OldColumnName")
. The renames are simultaneous and unordered, enabling direct swaps between column names. All other columns are left in their original order.IllegalArgumentException
will be thrown:- if a source column does not exist
- if a source column is used more than once
- if a destination column is used more than once
- Parameters:
columnsToMove
- The columns to move to the right (and, optionally, to rename)- Returns:
- The new table, with the columns rearranged as explained above
-
moveColumns
Produce a new table with the specified columns moved to the specifiedindex
. Column indices begin at 0. Columns can be renamed with the usual syntax, i.e."NewColumnName=OldColumnName")
. The renames are simultaneous and unordered, enabling direct swaps between column names. The resulting table retains the original column ordering except for the specified columns, which are inserted at the specified index, in the order ofcolumnsToMove
, after the effects of applying any renames.IllegalArgumentException
will be thrown:- if a source column does not exist
- if a source column is used more than once
- if a destination column is used more than once
Values of
index
outside the range of 0 to the number of columns in the table (exclusive) will be clamped to the nearest valid index.- Parameters:
index
- The index to which the specified columns should be movedcolumnsToMove
- The columns to move to the specified index (and, optionally, to rename)- Returns:
- The new table, with the columns rearranged as explained above
-
slicePct
Extracts a subset of a table by row percentages.Returns a subset of table in the range [floor(startPercentInclusive * sizeOfTable), floor(endPercentExclusive * sizeOfTable)). For example, for a table of size 10, slicePct(0.1, 0.7) will return a subset from the second row to the seventh row. Similarly, slicePct(0, 1) would return the entire table (because row positions run from 0 to size-1). The percentage arguments must be in range [0,1], otherwise the function returns an error.
- Parameters:
startPercentInclusive
- the starting percentage point for rows to include in the result, range [0, 1]endPercentExclusive
- the ending percentage point for rows to include in the result, range [0, 1]- Returns:
- a new Table, which is the requested subset of rows from the original table
-
headPct
Provides a head that selects a dynamic number of rows based on a percent.- Parameters:
percent
- the fraction of the table to return between [0, 1]. The number of rows will be rounded up. For example if there are 3 rows, headPct(50) returns the first two rows. For percent values outside [0, 1], the function will throw an exception.
-
tailPct
Provides a tail that selects a dynamic number of rows based on a percent.- Parameters:
percent
- the fraction of the table to return between [0, 1]. The number of rows will be rounded up. For example if there are 3 rows, tailPct(50) returns the last two rows. For percent values outside [0, 1], the function will throw an exception.
-
headBy
-
headBy
-
tailBy
-
tailBy
-
applyToAllBy
@ConcurrentMethod Table applyToAllBy(String formulaColumn, String columnParamName, Collection<? extends ColumnName> groupByColumns) Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.columnParamName
is used as place-holder for the name of each column insideformulaColumn
.- Parameters:
formulaColumn
- Formula applied to each columncolumnParamName
- The parameter name used as a placeholder for each columngroupByColumns
- The grouping columns as inTableOperations.groupBy(Collection)
-
applyToAllBy
@ConcurrentMethod Table applyToAllBy(String formulaColumn, Collection<? extends ColumnName> groupByColumns) Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.- Parameters:
formulaColumn
- Formula applied to each column, uses parameter each to refer to each colum it being applied togroupByColumns
- The grouping columns as inTableOperations.groupBy(Collection)
-
applyToAllBy
Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.- Parameters:
formulaColumn
- Formula applied to each column, uses parameter each to refer to each colum it being applied togroupByColumns
- The grouping columns as inTableOperations.groupBy()
-
removeBlink
If this table is a blink table, i.e. it hasBLINK_TABLE_ATTRIBUTE
set totrue
, return a child without the attribute, restoring standard semantics for aggregation operations.- Returns:
- A non-blink child table, or this table if it is not a blink table
-
partitionBy
Create aPartitionedTable
from this table, partitioned according to the specified key columns.The underlying partitioned table backing the result contains each row in
this
table in exactly one of the result's constituent tables.- Parameters:
dropKeys
- Whether to drop key columns in the output constituent tableskeyColumnNames
- The names of the key columns to partition by- Returns:
- A
PartitionedTable
keyed bykeyColumnNames
-
partitionBy
Equivalent topartitionBy(false, keyColumnNames)
Create a
PartitionedTable
from this table, partitioned according to the specified key columns. Key columns are never dropped from the output constituent tables.The underlying partitioned table backing the result contains each row in
this
table in exactly one of the result's constituent tables.- Parameters:
keyColumnNames
- The names of the key columns to partition by- Returns:
- A
PartitionedTable
keyed bykeyColumnNames
-
partitionedAggBy
@ConcurrentMethod PartitionedTable partitionedAggBy(Collection<? extends Aggregation> aggregations, boolean preserveEmpty, Table initialGroups, String... keyColumnNames) Convenience method that performs anTableOperations.aggBy(io.deephaven.api.agg.Aggregation)
and wraps the result in aPartitionedTable
. Ifaggregations
does not include apartition
, one will be added automatically with the default constituent column name and behavior used inpartitionBy(String...)
.- Parameters:
aggregations
- Theaggregations
to applypreserveEmpty
- Whether to keep result rows for groups that are initially empty or become empty as a result of updates. Each aggregation operator defines its own value for empty groups.initialGroups
- A table whose distinct combinations of values for thegroupByColumns
should be used to create an initial set of aggregation groups. All other columns are ignored. This is useful in combination withpreserveEmpty == true
to ensure that particular groups appear in the result table, or withpreserveEmpty == false
to control the encounter order for a collection of groups and thus their relative order in the result. Changes toinitialGroups
are not expected or handled; ifinitialGroups
is a refreshing table, only its contents at instantiation time will be used. IfinitialGroups == null
, the result will be the same as if a table with no rows was supplied.keyColumnNames
- The names of the key columns to aggregate by- Returns:
- A
PartitionedTable
keyed bykeyColumnNames
-
rollup
Create a rollup table.A rollup table aggregates all rows of the table.
- Parameters:
aggregations
- The aggregations to perform- Returns:
- a hierarchical table with the rollup applied
-
rollup
@ConcurrentMethod RollupTable rollup(Collection<? extends Aggregation> aggregations, boolean includeConstituents) Create a rollup table.A rollup table aggregates all rows of the table.
- Parameters:
aggregations
- The aggregations to performincludeConstituents
- set to true to include the constituent rows at the leaf level- Returns:
- a hierarchical table with the rollup applied
-
rollup
@ConcurrentMethod RollupTable rollup(Collection<? extends Aggregation> aggregations, String... groupByColumns) Create a rollup table.A rollup table aggregates by the specified columns, and then creates a hierarchical table which re-aggregates using one less aggregation column on each level. The column that is no longer part of the aggregation key is replaced with null on each level.
- Parameters:
aggregations
- The aggregations to performgroupByColumns
- the columns to group by- Returns:
- a hierarchical table with the rollup applied
-
rollup
@ConcurrentMethod RollupTable rollup(Collection<? extends Aggregation> aggregations, boolean includeConstituents, String... groupByColumns) Create a rollup table.A rollup table aggregates by the specified columns, and then creates a hierarchical table which re-aggregates using one less aggregation column on each level. The column that is no longer part of the aggregation key is replaced with null on each level.
- Parameters:
aggregations
- The aggregations to performgroupByColumns
- the columns to group byincludeConstituents
- set to true to include the constituent rows at the leaf level- Returns:
- a hierarchical table with the rollup applied
-
rollup
@ConcurrentMethod RollupTable rollup(Collection<? extends Aggregation> aggregations, Collection<? extends ColumnName> groupByColumns) Create a rollup table.A rollup table aggregates by the specified columns, and then creates a hierarchical table which re-aggregates using one less aggregation column on each level. The column that is no longer part of the aggregation key is replaced with null on each level.
- Parameters:
aggregations
- The aggregations to performgroupByColumns
- the columns to group by- Returns:
- a hierarchical table with the rollup applied
-
rollup
@ConcurrentMethod RollupTable rollup(Collection<? extends Aggregation> aggregations, boolean includeConstituents, Collection<? extends ColumnName> groupByColumns) Create a rollup table.A rollup table aggregates by the specified columns, and then creates a hierarchical table which re-aggregates using one less aggregation column on each level. The column that is no longer part of the aggregation key is replaced with null on each level.
- Parameters:
aggregations
- The aggregations to performincludeConstituents
- set to true to include the constituent rows at the leaf levelgroupByColumns
- the columns to group by- Returns:
- a hierarchical table with the rollup applied
-
tree
Create a hierarchical tree table.The structure of the table is encoded by an "id" and a "parent" column. The id column should represent a unique identifier for a given row, and the parent column indicates which row is the parent for a given row. Rows that have a
null
parent are part of the "root" table.It is possible for rows to be "orphaned" if their parent is non-
null
and does not exist in the table. SeeTreeTable.promoteOrphans(Table, String, String)
.- Parameters:
idColumn
- The name of a column containing a unique identifier for a particular row in the tableparentColumn
- The name of a column containing the parent's identifier,null
for rows that are part of the root table- Returns:
- A
TreeTable
organized according to the parent-child relationships expressed byidColumn
andparentColumn
-
coalesce
Explicitly ensure that any work needed to make a table addressable, iterable, or queryable has been done, and return the coalesced child table if appropriate.- Returns:
- This table, or a fully-coalesced child
-
getSubTable
Get aTable
that contains a sub-set of the rows fromthis
. The result will share the samecolumn sources
anddefinition
as this table.The result will not update on its own. The caller must also establish an appropriate listener to update
rowSet
and propagateupdates
.- Parameters:
rowSet
- Therow set
for the result- Returns:
- A new sub-table
-
apply
Applies a function to this table.This is useful if you have a reference to a table or a proxy and want to run a series of operations against the table without each individual operation resulting in an RMI.
- Type Parameters:
R
- the return type of function- Parameters:
function
- the function to run, its single argument will be this table- Returns:
- the return value of function
- ImplNote:
- If the UGP is not required the
Function.apply(Object)
method should be annotated withConcurrentMethod
.
-
flatten
Creates a version of this table with a flat RowSet. -
withKeys
Set the table's key columns.- Returns:
- A copy of this table with the key columns specified, or this if no change was needed
-
withUniqueKeys
Set the table's key columns and indicate that each key set will be unique.- Returns:
- A copy of this table with the unique key columns specified, or this if no change was needed
-
setTotalsTable
Set a totals table for this Table.- Parameters:
directive
- A packed string of totals table instructions- Returns:
- A copy of this Table with the
totals table attribute
set
-
close
void close()Release resources held by this table, possibly destructively. This may render the table unsuitable or unsafe for further use.- ApiNote:
- In practice, implementations usually just invoke
releaseCachedResources()
.
-
releaseCachedResources
void releaseCachedResources()Attempt to release cached resources held by this table. Unlikeclose()
, this must not render the table unusable for subsequent read operations. Implementations should be sure to callsuper.releaseCachedResources()
. -
awaitUpdate
Wait for updates to this Table. Should not be invoked from a
TableListener
or othernotification
on this Table'supdate graph
. It may be suitable to wait from another update graph if doing so does not introduce any cycles.In some implementations, this call may also terminate in case of interrupt or spurious wakeup.
- Throws:
InterruptedException
- In the event this thread is interrupted- See Also:
-
awaitUpdate
Wait for updates to this Table. Should not be invoked from a
TableListener
or othernotification
on this Table'supdate graph
. It may be suitable to wait from another update graph if doing so does not introduce any cycles.In some implementations, this call may also terminate in case of interrupt or spurious wakeup.
- Parameters:
timeout
- The maximum time to wait in milliseconds.- Returns:
- false if the timeout elapses without notification, true otherwise.
- Throws:
InterruptedException
- In the event this thread is interrupted- See Also:
-
addUpdateListener
Subscribe for updates to this table.listener
will be invoked via theNotificationQueue
associated with this Table.- Parameters:
listener
- listener for updates
-
addUpdateListener
Subscribe for updates to this table. After the optional initial image,listener
will be invoked via theNotificationQueue
associated with this Table.- Parameters:
listener
- listener for updatesreplayInitialImage
- true to process updates for all initial rows in the table plus all changes; false to only process changes
-
addUpdateListener
Subscribe for updates to this table.listener
will be invoked via theNotificationQueue
associated with this Table.- Parameters:
listener
- listener for updates
-
addUpdateListener
Subscribe for updates to this table if its last notification step matchesrequiredLastNotificationStep
.listener
will be invoked via theNotificationQueue
associated with this Table.- Parameters:
listener
- listener for updatesrequiredLastNotificationStep
- the expected last notification step to match- Returns:
- true if the listener was added, false if the last notification step requirement was not met
-
removeUpdateListener
Unsubscribe the supplied listener.- Parameters:
listener
- listener for updates
-
removeUpdateListener
Unsubscribe the supplied listener.- Parameters:
listener
- listener for updates
-
isFailed
boolean isFailed()- Returns:
- true if this table is in a failure state.
-