Class 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:
  • Method Details

    • getAggregations

      public Collection<? extends Aggregation> getAggregations()
      Description copied from interface: RollupTable
      Get the aggregations for the rollup operation.
      Specified by:
      getAggregations in interface RollupTable
      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 interface RollupTable
      Returns:
      Whether constituents are included
    • getGroupByColumns

      public Collection<? extends ColumnName> getGroupByColumns()
      Description copied from interface: RollupTable
      Get the group-by columns for the rollup operation.
      Specified by:
      getGroupByColumns in interface RollupTable
      Returns:
      The group-by columns
    • getDescription

      public String getDescription()
      Description copied from interface: HierarchicalTable
      Get a description of this HierarchicalTable.
      Specified by:
      getDescription in interface HierarchicalTable<RollupTable>
      Returns:
      The description
    • getEmptyExpansionsTable

      public Table getEmptyExpansionsTable()
      Description copied from interface: HierarchicalTable
      Get a re-usable, static key Table with zero rows that will cause a snapshot to expand only the default nodes.
      Specified by:
      getEmptyExpansionsTable in interface HierarchicalTable<RollupTable>
      Returns:
      An empty key Table for default expansions
    • getNodeDefinition

      public TableDefinition getNodeDefinition(@NotNull @NotNull RollupTable.NodeType nodeType)
      Description copied from interface: RollupTable
      Get the TableDefinition 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 the row-depth column and row-expanded column, but includes formatting columns.
      Specified by:
      getNodeDefinition in interface RollupTable
      Parameters:
      nodeType - The node type to get the TableDefinition for
      Returns:
      The externally-visible node TableDefinition for the requested nodeType
    • getAvailableColumnDefinitions

      public List<ColumnDefinition<?>> getAvailableColumnDefinitions()
      Description copied from interface: HierarchicalTable
      Get the definitions 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 interface HierarchicalTable<RollupTable>
      Returns:
      A list of definitions for all available columns that may be requested in a snapshot
    • withFilter

      public RollupTable withFilter(@NotNull @NotNull Filter filter)
      Description copied from interface: RollupTable
      Apply a filter to the source table for this RollupTable before applying the rollup operation. This filter must use only non-aggregate columns and must not use column arrays.
      Specified by:
      withFilter in interface RollupTable
      Parameters:
      filter - The filter to apply; must only reference non-aggregate columns and must not use column arrays
      Returns:
      The new RollupTable
    • withUpdateView

      public RollupTable withUpdateView(@NotNull @NotNull String... columns)
      Description copied from interface: RollupTable
      Apply a view to this RollupTable in order to produce a new RollupTable with additional columns at the aggregated node level.
      Specified by:
      withUpdateView in interface RollupTable
      Parameters:
      columns - The new columns to add
      Returns:
      The new RollupTable
    • withUpdateView

      public RollupTable withUpdateView(Collection<Selectable> columns)
      Description copied from interface: RollupTable
      Apply a view to this RollupTable in order to produce a new RollupTable with additional columns at the aggregated node level.
      Specified by:
      withUpdateView in interface RollupTable
      Parameters:
      columns - The new columns to add
      Returns:
      The new RollupTable
    • initializeAndValidateFilters

      public static WhereFilter[] initializeAndValidateFilters(@NotNull @NotNull Table source, @NotNull @NotNull Collection<? extends Aggregation> aggregations, @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 rollup source
      aggregations - The rollup aggregations}
      filters - The filters to initialize and validate
      exceptionFactory - 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 a recorder for per-node operations to apply during snapshots of the requested RollupTable.NodeType.
      Specified by:
      makeNodeOperationsRecorder in interface RollupTable
      Parameters:
      nodeType - The node 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 the recorded operations to nodes when gathering snapshots. Operations will be applied only to the node type supplied when the elements of nodeOperations were initially created.
      Specified by:
      withNodeOperations in interface RollupTable
      Parameters:
      nodeOperations - The node-level operations to apply. Elements must have been initially supplied by RollupTable.makeNodeOperationsRecorder(NodeType) from this 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 if includesConstituents() == true.
      Specified by:
      translateAggregatedNodeOperationsForConstituentNodes in interface RollupTable
      Parameters:
      aggregatedNodeOperationsToTranslate - Node-level operations for aggregated nodes, initially supplied by makeNodeOperationsRecorder(NodeType.Aggregated).
      Returns:
      Node-level operations for constituent nodes
    • copy

      protected RollupTableImpl copy()
      Description copied from class: LiveAttributeMap
      Create a copy of this with initially-shared LiveAttributeMap.mutableAttributes.
      Specified by:
      copy in class LiveAttributeMap<RollupTable,RollupTableImpl>
    • rebase

      public RollupTableImpl rebase(@NotNull @NotNull Table newSource)
      Description copied from interface: RollupTable
      Create a new RollupTable based on newSource, inheriting this RollupTable's aggregations, constituent inclusion, group-by columns, node operations, and filters.
      Specified by:
      rebase in interface RollupTable
      Parameters:
      newSource - A new source table that must have the same definition as the source of this rollup; that is newSource.getDefinition().equals(getSource().getDefinition()) must be true
      Returns:
      The new RollupTable
    • makeRollup

      public static RollupTable makeRollup(@NotNull @NotNull QueryTable source, @NotNull @NotNull Collection<? extends Aggregation> aggregations, boolean includeConstituents, @NotNull @NotNull Collection<? extends ColumnName> groupByColumns)
    • makeFromPartsInternal

      @InternalUseOnly public static RollupTable makeFromPartsInternal(@NotNull @NotNull QueryTable source, @NotNull @NotNull Map<String,Object> attributes, @NotNull @NotNull Collection<? extends Aggregation> aggregations, @NotNull @NotNull Collection<? extends ColumnName> groupByColumns, @NotNull @NotNull QueryTable[] levelTables, @NotNull @NotNull AggregationRowLookup[] levelRowLookups, @NotNull @NotNull ColumnSource<Table>[] levelNodeTableSources)

      Create a RollupTable from internal data structures that have been made outside the rollup code.

      Constituents may not be included, and node operations are not provided.

      Note: This function is not part of the public Deephaven API, and the semantics are subject to change at any time.

      Parameters:
      source - the original table being aggregated for this rollup
      attributes - the attributes of the result rollup
      aggregations - the aggregations used to make this rollup
      groupByColumns - the group by columns for this rollup
      levelTables - an array of tables for each level
      levelRowLookups - an array of row lookup structures for each level
      levelNodeTableSources - an array of column sources containing a lower-level table
      Returns:
      a RollupTable from the provided data structures
    • getSource

      public Table getSource()
      Description copied from interface: HierarchicalTable
      Get the source Table that was aggregated to make this HierarchicalTable.
      Specified by:
      getSource in interface HierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
      Returns:
      The source table
    • getRoot

      public Table getRoot()
      Description copied from interface: HierarchicalTable
      Get the root Table that represents the top level of this HierarchicalTable.
      Specified by:
      getRoot in interface HierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
      Returns:
      The root table
    • getRowExpandedColumn

      public ColumnName getRowExpandedColumn()
      Description copied from interface: HierarchicalTable
      Get the name of a column of Booleans that denotes whether a row is expanded (or expandable). It takes on the value null for rows that are not expandable, false for expandable but unexpanded rows, and true 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 interface HierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
      Returns:
      The name of a column that denotes whether a row is expanded or expandable
    • getRowDepthColumn

      public ColumnName 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 interface HierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
      Returns:
      The name of a column that denotes row depth
    • getStructuralColumnDefinitions

      public List<ColumnDefinition<?>> getStructuralColumnDefinitions()
      Description copied from interface: HierarchicalTable
      Get the definitions 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 the row-depth column and the row-expanded column, but never includes type-specific node-level columns.
      Specified by:
      getStructuralColumnDefinitions in interface HierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
      Returns:
      A list of @link ColumnDefinition definitions} for all structural columns
    • makeSnapshotState

      public HierarchicalTable.SnapshotState makeSnapshotState()
      Description copied from interface: HierarchicalTable
      Make a re-usable snapshot state. The result will ensure liveness for this HierarchicalTable if the source isRefreshing, and callers must similarly retain the result for the duration of their usage under the same conditions.
      Specified by:
      makeSnapshotState in interface HierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
    • checkAvailableColumns

      protected final void checkAvailableColumns(@NotNull @NotNull Collection<String> columns)
      Description copied from class: BaseGridAttributes
      Check this grid to ensure that all columns are present.
      Specified by:
      checkAvailableColumns in class BaseGridAttributes<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 by columns, rows, and the directives in keyTable. Accumulate the results in destinations.
      Specified by:
      snapshot in interface HierarchicalTable<IFACE_TYPE extends HierarchicalTable<IFACE_TYPE>>
      Parameters:
      snapshotState - Snapshot state object used to cache data across invocations. Must have been created by this HierarchicalTable with HierarchicalTable.makeSnapshotState().
      keyTable - Type-specific "key" table specifying expanded and contracted nodes
      keyTableActionColumn - The name of a column of byte on keyTable that specifies whether nodes should be expanded, expanded with their descendants, or contracted. If null, all rows are treated as simple expansions.
      columns - Optional bit-set of columns to include, null to include all columns
      rows - Position-space rows to include from the expanded data specified by keyTable
      destinations - The destination chunks
      Returns:
      The total expanded data size or an estimate thereof