Class RollupTableImpl
java.lang.Object
io.deephaven.util.referencecounting.ReferenceCounted
io.deephaven.engine.liveness.ReferenceCountedLivenessReferent
io.deephaven.engine.liveness.ReferenceCountedLivenessNode
io.deephaven.engine.liveness.LivenessArtifact
io.deephaven.engine.table.impl.LiveAttributeMap<IFACE_TYPE,IMPL_TYPE>
io.deephaven.engine.table.impl.BaseGridAttributes<IFACE_TYPE,IMPL_TYPE>
io.deephaven.engine.table.impl.hierarchical.RollupTableImpl
- All Implemented Interfaces:
LogOutputAppendable
,LivenessManager
,LivenessNode
,LivenessReferent
,AttributeMap<RollupTable>
,GridAttributes<RollupTable>
,HierarchicalTable<RollupTable>
,RollupTable
,Serializable
public class RollupTableImpl
extends BaseGridAttributes<IFACE_TYPE,IMPL_TYPE>
implements RollupTable
RollupTable
implementation.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.hierarchical.HierarchicalTable
HierarchicalTable.SnapshotState
Nested classes/interfaces inherited from interface io.deephaven.engine.table.hierarchical.RollupTable
RollupTable.NodeOperationsRecorder, RollupTable.NodeType
-
Field Summary
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.engine.table.hierarchical.HierarchicalTable
KEY_TABLE_ACTION_CONTRACT, KEY_TABLE_ACTION_EXPAND, KEY_TABLE_ACTION_EXPAND_ALL
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
checkAvailableColumns
(@NotNull Collection<String> columns) Check this grid to ensure that allcolumns
are present.protected RollupTableImpl
copy()
Create a copy ofthis
with initially-sharedLiveAttributeMap.mutableAttributes
.Collection<? extends Aggregation>
Get the aggregations for therollup
operation.List<ColumnDefinition<?>>
Get thedefinitions
for all available columns that may be requested in a snapshot.Get a description of this HierarchicalTable.Get a re-usable, static keyTable
with zero rows that will cause a snapshot to expand only the default nodes.Collection<? extends ColumnName>
Get the group-by columns for therollup
operation.getNodeDefinition
(@NotNull RollupTable.NodeType nodeType) Get theTableDefinition
that should be exposed to node table consumers, e.g.getRoot()
Get the rootTable
that represents the top level of this HierarchicalTable.Get the name of a column that denotes row depth.Get the name of a column ofBooleans
that denotes whether a row is expanded (or expandable).Get the sourceTable
that was aggregated to make this HierarchicalTable.List<ColumnDefinition<?>>
Get thedefinitions
for all structural columns.boolean
Are the source table's constituent rows included at the lowest level of the rollup?static WhereFilter[]
initializeAndValidateFilters
(@NotNull Table source, @NotNull Collection<? extends ColumnName> groupByColumns, @NotNull Collection<? extends Filter> filters, @NotNull Function<String, ? extends RuntimeException> exceptionFactory) Initialize and validate the supplied filters for this RollupTable.io.deephaven.engine.table.impl.hierarchical.RollupNodeOperationsRecorder
makeNodeOperationsRecorder
(@NotNull RollupTable.NodeType nodeType) Get arecorder
for per-node operations to apply during snapshots of the requestedRollupTable.NodeType
.static RollupTable
makeRollup
(@NotNull QueryTable source, @NotNull Collection<? extends Aggregation> aggregations, boolean includeConstituents, @NotNull Collection<? extends ColumnName> groupByColumns) Make a re-usable snapshot state.long
snapshot
(HierarchicalTable.SnapshotState snapshotState, @NotNull Table keyTable, @Nullable ColumnName keyTableActionColumn, @Nullable BitSet columns, @NotNull RowSequence rows, @NotNull WritableChunk<? super Values>[] destinations) Take a snapshot of the data in the grid defined bycolumns
,rows
, and the directives inkeyTable
.translateAggregatedNodeOperationsForConstituentNodes
(@NotNull RollupTable.NodeOperationsRecorder aggregatedNodeOperationsToTranslate) Translate node operations for aggregated nodes to the closest equivalent for a constituent node.withFilter
(@NotNull Filter filter) Apply a filter to the group-by columns of this RollupTable in order to produce a new RollupTable.withNodeOperations
(@NotNull RollupTable.NodeOperationsRecorder... nodeOperations) Get a new RollupTable that will apply therecorded
operations to nodes when gathering snapshots.Methods inherited from class io.deephaven.engine.table.impl.BaseGridAttributes
clearSortingRestrictions, getSortableColumns, restrictSortTo, setColumnDescriptions, setLayoutHints, setSortableColumns, withColumnDescription, withColumnDescriptions, withDescription
Methods inherited from class io.deephaven.engine.table.impl.LiveAttributeMap
copyAttributes, getAttribute, getAttributeKeys, getAttributes, getAttributes, hasAttribute, prepareReturnCopy, prepareReturnThis, published, retainingAttributes, setAttribute, setAttribute, withAttributes, withAttributes, withoutAttributes
Methods inherited from class io.deephaven.engine.liveness.LivenessArtifact
manageWithCurrentScope
Methods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessNode
getWeakReference, initializeTransientFieldsForLiveness, onReferenceCountAtZero, tryManage, tryUnmanage, tryUnmanage
Methods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessReferent
destroy, dropReference, tryRetainReference
Methods inherited from class io.deephaven.util.referencecounting.ReferenceCounted
append, decrementReferenceCount, forceReferenceCountToZero, getReferenceCountDebug, incrementReferenceCount, resetReferenceCount, toString, tryDecrementReferenceCount, tryIncrementReferenceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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.table.GridAttributes
clearSortingRestrictions, restrictSortTo, setLayoutHints, withColumnDescription, withColumnDescriptions, withDescription
Methods inherited from interface io.deephaven.engine.table.hierarchical.HierarchicalTable
getRoot, getRowDepthColumn, getRowExpandedColumn, getSource, getStructuralColumnDefinitions, makeSnapshotState, snapshot
Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage
Methods inherited from interface io.deephaven.engine.liveness.LivenessNode
unmanage, unmanage
Methods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
Methods inherited from interface io.deephaven.engine.table.hierarchical.RollupTable
getLeafNodeType
-
Method Details
-
getAggregations
Description copied from interface:RollupTable
Get the aggregations for therollup
operation.- Specified by:
getAggregations
in interfaceRollupTable
- Returns:
- The rollup aggregations
-
includesConstituents
public boolean includesConstituents()Description copied from interface:RollupTable
Are the source table's constituent rows included at the lowest level of the rollup?- Specified by:
includesConstituents
in interfaceRollupTable
- Returns:
- Whether constituents are included
-
getGroupByColumns
Description copied from interface:RollupTable
Get the group-by columns for therollup
operation.- Specified by:
getGroupByColumns
in interfaceRollupTable
- Returns:
- The group-by columns
-
getDescription
Description copied from interface:HierarchicalTable
Get a description of this HierarchicalTable.- Specified by:
getDescription
in interfaceHierarchicalTable<RollupTable>
- Returns:
- The description
-
getEmptyExpansionsTable
Description copied from interface:HierarchicalTable
Get a re-usable, static keyTable
with zero rows that will cause a snapshot to expand only the default nodes.- Specified by:
getEmptyExpansionsTable
in interfaceHierarchicalTable<RollupTable>
- Returns:
- An empty key
Table
for default expansions
-
getNodeDefinition
Description copied from interface:RollupTable
Get theTableDefinition
that should be exposed to node table consumers, e.g. UI-driven snapshots. This excludes "internal" columns used to organize the rollup or support operations, as well as therow-depth column
androw-expanded column
, but includes formatting columns.- Specified by:
getNodeDefinition
in interfaceRollupTable
- Parameters:
nodeType
- Thenode type
to get theTableDefinition
for- Returns:
- The externally-visible node
TableDefinition
for the requestednodeType
-
getAvailableColumnDefinitions
Description copied from interface:HierarchicalTable
Get thedefinitions
for all available columns that may be requested in a snapshot.The result will always begin with the
structural columns
, which are then followed by type-specific node-level columns.- Specified by:
getAvailableColumnDefinitions
in interfaceHierarchicalTable<RollupTable>
- Returns:
- A list of
definitions
for all available columns that may be requested in a snapshot
-
withFilter
Description copied from interface:RollupTable
Apply a filter to the group-by columns of this RollupTable in order to produce a new RollupTable.- Specified by:
withFilter
in interfaceRollupTable
- Parameters:
filter
- The filter to apply; must only reference the group-by columns and must not use column arrays- Returns:
- The new RollupTable
-
initializeAndValidateFilters
public static WhereFilter[] initializeAndValidateFilters(@NotNull @NotNull Table source, @NotNull @NotNull Collection<? extends ColumnName> groupByColumns, @NotNull @NotNull Collection<? extends Filter> filters, @NotNull @NotNull Function<String, ? extends RuntimeException> exceptionFactory) Initialize and validate the supplied filters for this RollupTable.- Parameters:
source
- The rollupsource
groupByColumns
- The rollupgroup-by columns
filters
- The filters to initialize and validateexceptionFactory
- A factory for creating exceptions from their messages- Returns:
- The initialized and validated filters
-
makeNodeOperationsRecorder
public io.deephaven.engine.table.impl.hierarchical.RollupNodeOperationsRecorder makeNodeOperationsRecorder(@NotNull @NotNull RollupTable.NodeType nodeType) Description copied from interface:RollupTable
Get arecorder
for per-node operations to apply during snapshots of the requestedRollupTable.NodeType
.- Specified by:
makeNodeOperationsRecorder
in interfaceRollupTable
- Parameters:
nodeType
- Thenode type
that operations will be applied to- Returns:
- The new recorder
-
withNodeOperations
public RollupTable withNodeOperations(@NotNull @NotNull RollupTable.NodeOperationsRecorder... nodeOperations) Description copied from interface:RollupTable
Get a new RollupTable that will apply therecorded
operations to nodes when gathering snapshots. Operations will be applied only to thenode type
supplied when the elements ofnodeOperations
were initiallycreated
.- Specified by:
withNodeOperations
in interfaceRollupTable
- Parameters:
nodeOperations
- The node-level operations to apply. Elements must have been initially supplied byRollupTable.makeNodeOperationsRecorder(NodeType)
fromthis
RollupTable.- Returns:
- The new RollupTable
-
translateAggregatedNodeOperationsForConstituentNodes
public RollupTable.NodeOperationsRecorder translateAggregatedNodeOperationsForConstituentNodes(@NotNull @NotNull RollupTable.NodeOperationsRecorder aggregatedNodeOperationsToTranslate) Description copied from interface:RollupTable
Translate node operations for aggregated nodes to the closest equivalent for a constituent node. May only be invoked ifincludesConstituents() == true
.- Specified by:
translateAggregatedNodeOperationsForConstituentNodes
in interfaceRollupTable
- Parameters:
aggregatedNodeOperationsToTranslate
- Node-level operations for aggregated nodes, initially supplied bymakeNodeOperationsRecorder(NodeType.Aggregated)
.- Returns:
- Node-level operations for constituent nodes
-
copy
Description copied from class:LiveAttributeMap
Create a copy ofthis
with initially-sharedLiveAttributeMap.mutableAttributes
.- Specified by:
copy
in classLiveAttributeMap<RollupTable,
RollupTableImpl>
-
makeRollup
public static RollupTable makeRollup(@NotNull @NotNull QueryTable source, @NotNull @NotNull Collection<? extends Aggregation> aggregations, boolean includeConstituents, @NotNull @NotNull Collection<? extends ColumnName> groupByColumns) -
getSource
Description copied from interface:HierarchicalTable
Get the sourceTable
that was aggregated to make this HierarchicalTable.- Specified by:
getSource
in interfaceHierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
- Returns:
- The source table
-
getRoot
Description copied from interface:HierarchicalTable
Get the rootTable
that represents the top level of this HierarchicalTable.- Specified by:
getRoot
in interfaceHierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
- Returns:
- The root table
-
getRowExpandedColumn
Description copied from interface:HierarchicalTable
Get the name of a column ofBooleans
that denotes whether a row is expanded (or expandable). It takes on the valuenull
for rows that are not expandable,false
for expandable but unexpanded rows, andtrue
for expanded rows. This column is "synthetic"; that is, it's not part of the data, but rather calculated as part of snapshotting.- Specified by:
getRowExpandedColumn
in interfaceHierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
- Returns:
- The name of a column that denotes whether a row is expanded or expandable
-
getRowDepthColumn
Description copied from interface:HierarchicalTable
Get the name of a column that denotes row depth. This column is "synthetic"; that is, it's not part of the data, but rather calculated as part of snapshotting.- Specified by:
getRowDepthColumn
in interfaceHierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
- Returns:
- The name of a column that denotes row depth
-
getStructuralColumnDefinitions
Description copied from interface:HierarchicalTable
Get thedefinitions
for all structural columns. Structural columns are synthetic columns that allow snapshot consumers to make sense of the relationship between rows, and should always be included in the requested columns set when snapshotting a HierarchicalTable. This list includes therow-depth column
and therow-expanded column
, but never includes type-specific node-level columns.- Specified by:
getStructuralColumnDefinitions
in interfaceHierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
- Returns:
- A list of @link ColumnDefinition definitions} for all structural columns
-
makeSnapshotState
Description copied from interface:HierarchicalTable
Make a re-usable snapshot state. The result will ensure liveness forthis
HierarchicalTable if thesource
isRefreshing
, and callers must similarly retain the result for the duration of their usage under the same conditions.- Specified by:
makeSnapshotState
in interfaceHierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
-
checkAvailableColumns
Description copied from class:BaseGridAttributes
Check this grid to ensure that allcolumns
are present.- Specified by:
checkAvailableColumns
in classBaseGridAttributes<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>,
IMPL_TYPE extends io.deephaven.engine.table.impl.hierarchical.HierarchicalTableImpl<IFACE_TYPE, IMPL_TYPE>> - Parameters:
columns
- The column names to check
-
snapshot
public long snapshot(@NotNull HierarchicalTable.SnapshotState snapshotState, @NotNull @NotNull Table keyTable, @Nullable @Nullable ColumnName keyTableActionColumn, @Nullable @Nullable BitSet columns, @NotNull @NotNull RowSequence rows, @NotNull @NotNull WritableChunk<? super Values>[] destinations) Description copied from interface:HierarchicalTable
Take a snapshot of the data in the grid defined bycolumns
,rows
, and the directives inkeyTable
. Accumulate the results indestinations
.- Specified by:
snapshot
in interfaceHierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
- Parameters:
snapshotState
- Snapshot state object used to cache data across invocations. Must have been created by this HierarchicalTable withHierarchicalTable.makeSnapshotState()
.keyTable
- Type-specific "key" table specifying expanded and contracted nodeskeyTableActionColumn
- The name of a column ofbyte
onkeyTable
that specifies whether nodes should beexpanded
,expanded with their descendants
, orcontracted
. Ifnull
, all rows are treated assimple expansions
.columns
- Optional bit-set of columns to include,null
to include all columnsrows
- Position-space rows to include from the expanded data specified bykeyTable
destinations
- The destinationchunks
- Returns:
- The total expanded data size or an estimate thereof
-