Package io.deephaven.pivot
Interface PivotTable
- All Superinterfaces:
- AttributeMap<PivotTable>,- LivenessReferent
A pivot table is a display-only object that aggregates using a list of row by-columns and column by-columns,
 presenting the aggregated value for each combination of row and column by-column as a single cell.
 
Each row by-column or column by-column creates a level of aggregation that can be expanded or contracted, as in a rollup. For each logical combination of row and column values, multiple aggregation outputs are permitted.
The PivotTable may be filtered by row or column by-columns; and the rows or columns sorted by their by-columns.
 A PivotTable is not a Table. It does not send updates or allow you to listen to changes. The mechanism to access data
 is the snapshot method.
 
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA pivot snapshot contains three logical tables (represented as parallel definitions and chunks) that can be assembled into a view on the screen: Rows: The rows "table" contain the values of the row keys, their depth, and expanded state.static interfaceOpaque interface for objects used to cache snapshot state across multiple invocations ofsnapshot(SnapshotState, Table, Table, ColumnName, ColumnName, Collection, RowSequence, RowSequence)
- 
Method SummaryModifier and TypeMethodDescription@NotNull PivotTableapply(Collection<SortColumn> rowSorts, Collection<SortColumn> columnSorts, List<? extends Filter> filters) Apply transformations to this pivot.@NotNull Collection<Aggregation>Get the aggregations used to construct this PivotTable.@NotNull Collection<? extends ColumnName>Get the column keys used to create this Pivot.@NotNull ColumnNameGet the name of a column that denotes column depth.@NotNull ColumnNameGet the name of a column ofBooleansthat denotes whether a column is expanded (or expandable).The set of column names that can be column sorted.@NotNull Collection<ColumnDefinition<?>>@NotNull TableDefinition@NotNull TableGet a re-usable, static keyTablewith zero rows that will cause a snapshot to expand only the default nodes in the column dimension.@NotNull TableGet a re-usable, static keyTablewith zero rows that will cause a snapshot to expand only the default nodes in the row dimension.@NotNull List<ColumnName>Get the column names of the aggregation outputs that are available for subscription.@NotNull Collection<? extends ColumnName>Get the row keys used to create this Pivot.@NotNull ColumnNameGet the name of a column that denotes row depth.@NotNull ColumnNameGet the name of a column ofBooleansthat denotes whether a row is expanded (or expandable).The set of column names that can be row sorted.@NotNull Collection<ColumnDefinition<?>>@NotNull TableDefinitionReturn the source used to generate this PivotTable.@NotNull TableDefinitionstatic @NotNull PivotTablemake(Table source, Collection<Aggregation> aggregations, Collection<? extends ColumnName> rowByColumns, Collection<? extends ColumnName> columnByColumns) Create a new PivotTable.@NotNull PivotTable.SnapshotStateMake a re-usable snapshot state.@NotNull PivotTableCreate a new PivotTable based onnewSource, inheriting this Pivot'saggregations,getRowByColumns()row by-columns,column by-columns, and applied operations (i.e.@NotNull PivotTable.PivotSnapshotsnapshot(@NotNull PivotTable.SnapshotState snapshotState, @NotNull Table rowKeyTable, @NotNull Table columnKeyTable, @Nullable ColumnName rowKeyTableActionColumn, @Nullable ColumnName columnKeyTableActionColumn, @Nullable Collection<ColumnName> valueColumns, @NotNull RowSequence rows, @NotNull RowSequence columns) Generate a snapshot of this PivotTable.Methods inherited from interface io.deephaven.engine.table.AttributeMapgetAttribute, getAttributeKeys, getAttributes, getAttributes, hasAttribute, retainingAttributes, withAttributes, withAttributes, withoutAttributesMethods inherited from interface io.deephaven.engine.liveness.LivenessReferentdropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
- 
Method Details- 
make@NotNull static @NotNull PivotTable make(Table source, Collection<Aggregation> aggregations, Collection<? extends ColumnName> rowByColumns, Collection<? extends ColumnName> columnByColumns) Create a new PivotTable.- Parameters:
- source- the table to aggregate
- aggregations- the list of aggregations
- rowByColumns- the columns that serve as key columns for the row aggregations. Each unique value (and unique value prefix) creates another row in the output grid.
- columnByColumns- the columns that serve as key columns for the column aggregations. Each unique value (and unique value prefix) creates another (logical) column in the output grid.
- Returns:
- a new PivotTable
 
- 
getSourceTable getSource()Return the source used to generate this PivotTable.- Returns:
- the source used to generate this PivotTable
 
- 
getDescriptionString getDescription()- Returns:
- a textual description of this PivotTable for use in performance logs
 
- 
getRowTableDefinition- Returns:
- the definition of the row portion of the snapshot
 
- 
getRowStructuralColumns- Returns:
- the structural columns for the row key table
- See Also:
 
- 
getColumnTableDefinition- Returns:
- the definition of the column portion of the snapshot
 
- 
getColumnStructuralColumns- Returns:
- the structural columns for the column key table
- See Also:
 
- 
getValuesTableDefinition- Returns:
- the definition of the values portion of the snapshot
 
- 
apply@NotNull @NotNull PivotTable apply(Collection<SortColumn> rowSorts, Collection<SortColumn> columnSorts, List<? extends Filter> filters) Apply transformations to this pivot.- Parameters:
- rowSorts- the sorting columns for the rows in this pivot
- columnSorts- the sorting columns for the columns in this pivot
- filters- the filters for this pivot, only permitted for row and column keys
- Returns:
- a PivotTable with the operations applied
 
- 
rebaseCreate a new PivotTable based onnewSource, inheriting this Pivot'saggregations,getRowByColumns()row by-columns,column by-columns, and applied operations (i.e. filters and sorts).- Parameters:
- newSource- A new source table that must have the same definition as the source of this pivot; that is,- newSource.getDefinition().equals(getSource().getDefinition())must be- true
- Returns:
- The new PivotTable
 
- 
makeSnapshotStateMake a re-usable snapshot state. The result will ensure liveness forthisPivotTable if thesourceisRefreshing, and callers must similarly retain the result for the duration of their usage under the same conditions.- Returns:
- a SnapshotState for use with the
         snapshot(SnapshotState, Table, Table, ColumnName, ColumnName, Collection, RowSequence, RowSequence)method.
 
- 
getRowExpandedColumnGet the name of a column ofBooleansthat denotes whether a row is expanded (or expandable). It takes on the valuenullfor rows that are not expandable,falsefor expandable but unexpanded rows, andtruefor expanded rows. This column is "synthetic"; that is, it's not part of the data, but rather calculated as part of snapshotting.- Returns:
- The name of a column that denotes whether a row is expanded or expandable
 
- 
getRowDepthColumnGet 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.- Returns:
- The name of a column that denotes row depth
 
- 
getColumnExpandedColumnGet the name of a column ofBooleansthat denotes whether a column is expanded (or expandable). It takes on the valuenullfor columns that are not expandable,falsefor expandable but unexpanded columns, andtruefor expanded columns. This column is "synthetic"; that is, it's not part of the data, but rather calculated as part of snapshotting.- Returns:
- The name of a column that denotes whether a column is expanded or expandable
 
- 
getColumnDepthColumnGet the name of a column that denotes column depth. This column is "synthetic"; that is, it's not part of the data, but rather calculated as part of snapshotting.- Returns:
- The name of a column that denotes column depth
 
- 
getAggregationsGet the aggregations used to construct this PivotTable.- Returns:
- the aggregations used to construct this PivotTable
 
- 
getOutputColumnsGet the column names of the aggregation outputs that are available for subscription.- Returns:
- the column names that are available as aggregation outputs
 
- 
getRowByColumnsGet the row keys used to create this Pivot.- Returns:
- the row keys used to create this Pivot
 
- 
getColumnByColumnsGet the column keys used to create this Pivot.- Returns:
- the columns keys used to create this Pivot
 
- 
getEmptyRowExpansionsTableGet a re-usable, static keyTablewith zero rows that will cause a snapshot to expand only the default nodes in the row dimension.- Returns:
- An empty key Tablefor default row expansions
 
- 
getEmptyColumnExpansionsTableGet a re-usable, static keyTablewith zero rows that will cause a snapshot to expand only the default nodes in the column dimension.- Returns:
- An empty key Tablefor default column expansions
 
- 
getRowSortableColumnsThe set of column names that can be row sorted.- Returns:
- the set of column names that can be row sorted
 
- 
getColumnSortableColumnsThe set of column names that can be column sorted.- Returns:
- the set of column names that can be column sorted
 
- 
snapshot@NotNull @NotNull PivotTable.PivotSnapshot snapshot(@NotNull @NotNull PivotTable.SnapshotState snapshotState, @NotNull @NotNull Table rowKeyTable, @NotNull @NotNull Table columnKeyTable, @Nullable @Nullable ColumnName rowKeyTableActionColumn, @Nullable @Nullable ColumnName columnKeyTableActionColumn, @Nullable @Nullable Collection<ColumnName> valueColumns, @NotNull @NotNull RowSequence rows, @NotNull @NotNull RowSequence columns) Generate a snapshot of this PivotTable.- Parameters:
- snapshotState- the snapshot state, generated with- makeSnapshotState()
- rowKeyTable- a table of row key values (corresponding to the row by-columns and other columns annotated with- PivotTableSchemaConstants.PIVOT_TABLE_IS_ROW_EXPAND_BY_COLUMN) that should be expanded
- columnKeyTable- a table of column key values (corresponding to the column by-columns and other columns annotated with- PivotTableSchemaConstants.PIVOT_TABLE_IS_COLUMN_EXPAND_BY_COLUMN) that should be expanded
- rowKeyTableActionColumn- the name of the action column in the rowKeyTable. If not present, the action is assumed to be- HierarchicalTable.KEY_TABLE_ACTION_EXPAND
- columnKeyTableActionColumn- the name of the action column in the columnKeyTable. If not present, the action is assumed to be- HierarchicalTable.KEY_TABLE_ACTION_EXPAND
- valueColumns- the names of the value columns to include in the snapshot
- rows- a row sequence of rows to include in the snapshot, must be contiguous or be row 0 (the totals row) and one more contiguous region.
- columns- a row sequence of columns to include in the snapshot, must be contiguous
- Returns:
- a snapshot of the current pivot table values
 
 
-