Class TreeTableImpl

All Implemented Interfaces:
LogOutputAppendable, LivenessManager, LivenessNode, LivenessReferent, AttributeMap<TreeTable>, GridAttributes<TreeTable>, HierarchicalTable<TreeTable>, TreeTable, Serializable

public class TreeTableImpl extends BaseGridAttributes<IFACE_TYPE,IMPL_TYPE> implements TreeTable
RollupTable implementation.
See Also:
  • Method Details

    • getDescription

      public String getDescription()
      Description copied from interface: HierarchicalTable
      Get a description of this HierarchicalTable.
      Specified by:
      getDescription in interface HierarchicalTable<TreeTable>
      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<TreeTable>
      Returns:
      An empty key Table for default expansions
    • getIdentifierColumn

      public ColumnName getIdentifierColumn()
      Description copied from interface: TreeTable
      Get the identifier column from the tree operation.
      Specified by:
      getIdentifierColumn in interface TreeTable
      Returns:
      The identifier column
    • getParentIdentifierColumn

      public ColumnName getParentIdentifierColumn()
      Description copied from interface: TreeTable
      Get the parent identifier column from the {tree operation.
      Specified by:
      getParentIdentifierColumn in interface TreeTable
      Returns:
      The parent identifier column
    • getNodeDefinition

      public TableDefinition getNodeDefinition()
      Description copied from interface: TreeTable
      Get the TableDefinition that should be exposed to node table consumers, e.g. UI-driven snapshots. This excludes "internal" columns used to organize the tree or support operations, as well as the row-depth column and row-expanded column, but includes formatting columns.
      Specified by:
      getNodeDefinition in interface TreeTable
      Returns:
      The externally-visible node TableDefinition
    • 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<TreeTable>
      Returns:
      A list of definitions for all available columns that may be requested in a snapshot
    • withNodeFilterColumns

      public TreeTable withNodeFilterColumns(@NotNull @NotNull Collection<? extends ColumnName> columns)
      Description copied from interface: TreeTable
      Get a new TreeTable with columns designated for node-level filtering, in addition to any columns already so-designated on this TreeTable.

      Filters specified via TreeTable.withFilter(Filter), typically from the UI, that only use the designated node-level filtering columns will be applied to the nodes during snapshots. If no node-filter columns are designated, no filters will be handled at node level.

      Filters that include other columns are handled by filtering the source table in a ancestor-preserving manner and re-applying the tree operation to the result to produce a new TreeTable. Users of orphan promotion or other strategies to govern the structure of the tree should carefully consider the structure of their data before specifying node-filter columns.

      Specifying node-filter columns represents a trade-off between performance (which is expected to be much better for node-level filtering) and tree structural integrity (which may be lost since node-level filters are not ancestor-preserving).

      Specified by:
      withNodeFilterColumns in interface TreeTable
      Parameters:
      columns - The columns to designate
      Returns:
      The new TreeTable
    • withFilter

      public TreeTable withFilter(@NotNull @NotNull Filter filter)
      Description copied from interface: TreeTable
      Apply a filter to the columns of this TreeTable in order to produce a new TreeTable.
      Specified by:
      withFilter in interface TreeTable
      Parameters:
      filter - The filter to apply
      Returns:
      The new TreeTable
    • makeNodeOperationsRecorder

      public TreeTable.NodeOperationsRecorder makeNodeOperationsRecorder()
      Description copied from interface: TreeTable
      Get a recorder for per-node operations to apply during snapshots.
      Specified by:
      makeNodeOperationsRecorder in interface TreeTable
      Returns:
      The new recorder
    • withNodeOperations

      public TreeTable withNodeOperations(@NotNull @NotNull TreeTable.NodeOperationsRecorder nodeOperations)
      Description copied from interface: TreeTable
      Get a new TreeTable that will apply the recorded operations to nodes when gathering snapshots.
      Specified by:
      withNodeOperations in interface TreeTable
      Parameters:
      nodeOperations - The node-level operations to apply. Must have been initially supplied by TreeTable.makeNodeOperationsRecorder() from this TreeTable.
      Returns:
      The new TreeTable
    • copy

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

      public static TreeTable makeTree(@NotNull @NotNull QueryTable source, @NotNull @NotNull ColumnName identifierColumn, @NotNull @NotNull ColumnName parentIdentifierColumn)
    • 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