Interface PartitionedTable
- All Superinterfaces:
LivenessManager,LivenessNode,LivenessReferent,LogOutputAppendable
- All Known Implementing Classes:
PartitionedTableImpl,SourcePartitionedTable
Interface for working with partitioned tables.
A partitioned table is a Table with one or more columns containing non-null, like-defined constituent
tables, optionally with "key" columns defined to allow
partitionedTransform(PartitionedTable, BinaryOperator, Dependency...) or proxied joins with other like-keyed
partitioned tables.
Note that partitioned tables should depend on and
manage their
refreshing constituents.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleanCan the constituents of the underlyingpartitioned tablechange?Get the name of the "constituent" column oftables.constituentFor(@NotNull Object... keyColumnValues) Get a singleconstituentby its corresponding key column values.Table[]Get all the currentconstituents.filter(Collection<? extends Filter> filters) Make a new PartitionedTable from the result of applyingfiltersto the underlying partitioned table.Get the names of all "key" columns that are part oftable().getDefinition().merge()Make a newTablethat contains the rows from all the constituent tables of this PartitionedTable, in the same relative order as the underlying partitioned table and its constituents.default PartitionedTablepartitionedTransform(@NotNull PartitionedTable other, @NotNull BinaryOperator<Table> transformer, @NotNull NotificationQueue.Dependency... dependencies) Applytransformerto all constituenttablesfound inthisandotherwith the same key column values, and produce a new PartitionedTable containing the results.partitionedTransform(@NotNull PartitionedTable other, @Nullable ExecutionContext executionContext, @NotNull BinaryOperator<Table> transformer, boolean expectRefreshingResults, @NotNull NotificationQueue.Dependency... dependencies) Applytransformerto all constituenttablesfound inthisandotherwith the same key column values, and produce a new PartitionedTable containing the results.default PartitionedTable.Proxyproxy()Same asproxy(true, true).proxy(boolean requireMatchingKeys, boolean sanityCheckJoinOperations) Make a proxy that allowstable operationsto be applied to the constituent tables of this PartitionedTable.sort(Collection<SortColumn> sortColumns) Make a new PartitionedTable from the result of applyingsortColumnsto the underlying partitioned table.table()Get the "raw"partitioned tableunderlying this PartitionedTable.default PartitionedTabletransform(@NotNull UnaryOperator<Table> transformer, @NotNull NotificationQueue.Dependency... dependencies) Applytransformerto all constituenttables, and produce a new PartitionedTable containing the results.transform(@Nullable ExecutionContext executionContext, @NotNull UnaryOperator<Table> transformer, boolean expectRefreshingResults, @NotNull NotificationQueue.Dependency... dependencies) Applytransformerto all constituenttables, and produce a new PartitionedTable containing the results.booleanAre the keys (key column values for a row considered as a tuple) in the underlyingpartitioned tableunique?Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, tryManage, tryUnmanage, tryUnmanage, unmanage, unmanageMethods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReferenceMethods inherited from interface io.deephaven.base.log.LogOutputAppendable
append
-
Method Details
-
table
Get the "raw"partitioned tableunderlying this PartitionedTable.The raw table can be converted back into a partitioned table using
PartitionedTableFactory.of(Table)orPartitionedTableFactory.of(Table, Collection, boolean, String, TableDefinition, boolean).- Returns:
- The underlying
partitioned table
-
keyColumnNames
Get the names of all "key" columns that are part oftable().getDefinition(). If there are no key columns, the result will be empty. This set is explicitly ordered.- Returns:
- The key column names
-
uniqueKeys
Are the keys (key column values for a row considered as a tuple) in the underlying
partitioned tableunique?If keys are unique, one can expect that
table().selectDistinct(keyColumnNames.toArray(String[]::new))is equivalent totable().view(keyColumnNames.toArray(String[]::new)).- Returns:
- Whether the keys in the underlying partitioned table are unique
-
constituentColumnName
Get the name of the "constituent" column oftables.- Returns:
- The constituent column name
-
constituentDefinition
- Returns:
- The constituent definition
-
constituentChangesPermitted
Can the constituents of the underlying
partitioned tablechange?This is completely unrelated to whether the constituents themselves are
refreshing, or whether the underlying partitioned table is refreshing. Note that the underlying partitioned table must be refreshing if it contains any refreshing constituents.PartitionedTables that specify
constituentChangesPermitted() == falsemust be guaranteed to never change their constituents. Formally, it is expected thattable()will never report additions, removals, or shifts, and that any modifications reported will not change values in the constituent column (that is,table().getColumnSource(constituentColumnName())).- Returns:
- Whether the constituents of the underlying partitioned table can change
-
proxy
Same asproxy(true, true).- Returns:
- A proxy that allows
table operationsto be applied to the constituent tables of this PartitionedTable - See Also:
-
proxy
@ConcurrentMethod PartitionedTable.Proxy proxy(boolean requireMatchingKeys, boolean sanityCheckJoinOperations) Make a proxy that allows
table operationsto be applied to the constituent tables of this PartitionedTable.Each operation thus applied will produce a new PartitionedTable with the results as in
transform(UnaryOperator, Dependency...)orpartitionedTransform(PartitionedTable, BinaryOperator, Dependency...), and return a new proxy to that PartitionedTable.- Parameters:
requireMatchingKeys- Whether to ensure that both partitioned tables have all the same keys present when a proxied operation usesthisand anotherPartitionedTableas inputs for apartitioned transformsanityCheckJoinOperations- Whether to check that proxied join operations will only find a given join key in one constituent table forthisand thetableargument if it is also aproxy- Returns:
- A proxy that allows
table operationsto be applied to the constituent tables of this PartitionedTable
-
merge
Table merge()Make a newTablethat contains the rows from all the constituent tables of this PartitionedTable, in the same relative order as the underlying partitioned table and its constituents. If constituent tables contain extra columns not in theconstituent definition, those columns will be ignored. If constituent tables are missing columns in the constituent definition, the corresponding output rows will benull.- Returns:
- A merged representation of the constituent tables
-
filter
Make a new PartitionedTable from the result of applying
filtersto the underlying partitioned table.filtersmust not reference the constituent column.- Parameters:
filters- The filters to apply. Must not reference the constituent column.- Returns:
- The filtered PartitionedTable
-
sort
Make a new PartitionedTable from the result of applying
sortColumnsto the underlying partitioned table.sortColumnsmust not reference the constituent column.- Parameters:
sortColumns- The columns to sort by. Must not reference the constituent column.- Returns:
- The sorted PartitionedTable
-
transform
default PartitionedTable transform(@NotNull @NotNull UnaryOperator<Table> transformer, @NotNull @NotNull NotificationQueue.Dependency... dependencies) Apply
transformerto all constituenttables, and produce a new PartitionedTable containing the results.This overload uses the
enclosing ExecutionContextand expectstransformerto producerefreshingresults if and only if this PartitionedTable'sunderlying tableis refreshing.- Parameters:
transformer- TheUnaryOperatorto apply to all constituenttablesdependencies- Additional dependencies that must be satisfied before applyingtransformerto added or modified constituents during update processing; use this whentransformeruses additionalTableorPartitionedTableinputs besides the constituents ofthis- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException- On instantiation or update if!table().isRefreshing()andtransformerproduces a refreshing result for any constituent- ApiNote:
transformermust be stateless, safe for concurrent use, and able to return a valid result for an empty input table. It is required to install an ExecutionContext to access any QueryLibrary/QueryScope/QueryCompiler functionality from thetransformer.
-
transform
PartitionedTable transform(@Nullable @Nullable ExecutionContext executionContext, @NotNull @NotNull UnaryOperator<Table> transformer, boolean expectRefreshingResults, @NotNull @NotNull NotificationQueue.Dependency... dependencies) Apply
transformerto all constituenttables, and produce a new PartitionedTable containing the results. Thetransformerwill be invoked in the provided ExecutionContext.transformermust be stateless, safe for concurrent use, and able to return a valid result for an empty input table.- Parameters:
executionContext- The ExecutionContext to use for thetransformertransformer- TheUnaryOperatorto apply to all constituenttablesexpectRefreshingResults- Whether to expect that the results of applyingtransformermay berefreshing. Iftrue, the resulting PartitionedTable will always be backed by a refreshingtable. This hint is important for transforms to static inputs that might produce refreshing output, in order to ensure correct liveness management; incorrectly specifyingfalsewill result in exceptions.dependencies- Additional dependencies that must be satisfied before applyingtransformerto added or modified constituents during update processing; use this whentransformeruses additionalTableorPartitionedTableinputs besides the constituents ofthis- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException- On instantiation or update if!table().isRefreshing() && !expectRefreshingResultsandtransformerproduces a refreshing result for any constituent
-
partitionedTransform
default PartitionedTable partitionedTransform(@NotNull @NotNull PartitionedTable other, @NotNull @NotNull BinaryOperator<Table> transformer, @NotNull @NotNull NotificationQueue.Dependency... dependencies) Apply
transformerto all constituenttablesfound inthisandotherwith the same key column values, and produce a new PartitionedTable containing the results.Note that
other's key columns must matchthisPartitionedTable's key columns. Two matching mechanisms are supported, and will be attempted in the order listed:- Match by column name. Both PartitionedTables must have all the same
key column names. Like-named columns must have the samedata typeandcomponent type. - Match by column order. Both PartitionedTables must have their matchable columns in the same order within
their
key column names. Like-positioned columns must have the samedata typeandcomponent type.
This overload uses the
enclosing ExecutionContextand expectstransformerto producerefreshingresults if and only ifthisorotherhas a refreshingunderlying table.- Parameters:
other- The other PartitionedTable to find constituents intransformer- TheBinaryOperatorto apply to all pairs of constituenttablesdependencies- Additional dependencies that must be satisfied before applyingtransformerto added, modified, or newly-matched constituents during update processing; use this whentransformeruses additionalTableorPartitionedTableinputs besides the constituents ofthisorother- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException- On instantiation or update if!table().isRefreshing() && !other.table().isRefreshing()andtransformerproduces a refreshing result for any constituent- ApiNote:
transformermust be stateless, safe for concurrent use, and able to return a valid result for empty input tables. It is required to install an ExecutionContext to access any QueryLibrary/QueryScope/QueryCompiler functionality from thetransformer.
- Match by column name. Both PartitionedTables must have all the same
-
partitionedTransform
PartitionedTable partitionedTransform(@NotNull @NotNull PartitionedTable other, @Nullable @Nullable ExecutionContext executionContext, @NotNull @NotNull BinaryOperator<Table> transformer, boolean expectRefreshingResults, @NotNull @NotNull NotificationQueue.Dependency... dependencies) Apply
transformerto all constituenttablesfound inthisandotherwith the same key column values, and produce a new PartitionedTable containing the results. Thetransformerwill be invoked in the provided ExecutionContext.Note that
other's key columns must matchthisPartitionedTable's key columns. Two matching mechanisms are supported, and will be attempted in the order listed:- Match by column name. Both PartitionedTables must have all the same
key column names. Like-named columns must have the samedata typeandcomponent type. - Match by column order. Both PartitionedTables must have their matchable columns in the same order within
their
key column names. Like-positioned columns must have the samedata typeandcomponent type.
transformermust be stateless, safe for concurrent use, and able to return a valid result for empty input tables. It is required to install an ExecutionContext to access any QueryLibrary/QueryScope/QueryCompiler functionality from thetransformer.- Parameters:
other- The other PartitionedTable to find constituents inexecutionContext- The ExecutionContext to use for thetransformertransformer- TheBinaryOperatorto apply to all pairs of constituenttablesexpectRefreshingResults- Whether to expect that the results of applyingtransformermay berefreshing. Iftrue, the resulting PartitionedTable will always be backed by a refreshingtable. This hint is important for transforms to static inputs that might produce refreshing output, in order to ensure correct liveness management; incorrectly specifyingfalsewill result in exceptions.dependencies- Additional dependencies that must be satisfied before applyingtransformerto added, modified, or newly-matched constituents during update processing; use this whentransformeruses additionalTableorPartitionedTableinputs besides the constituents ofthisorother- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException- On instantiation or update if!table().isRefreshing() && !other.table().isRefreshing() && !expectRefreshingResultsandtransformerproduces a refreshing result for any constituent
- Match by column name. Both PartitionedTables must have all the same
-
constituentFor
Get a single
constituentby its corresponding key column values.The
keyColumnValuescan be thought of as a tuple constraining the values for the corresponding key columns for the result row. If there are no matching rows, the result isnull. If there are multiple matching rows, anUnsupportedOperationExceptionis thrown.The result will be
managedby the enclosingliveness scope.Note that if
constituentChangesPermitted(), this method may return different results if invoked multiple times.- Parameters:
keyColumnValues- Ordered, boxed values for the key columns in the same order askeyColumnNames()- Returns:
- The
constituentat the single row intable()matching thekeyColumnValues, ornullif no matches were found - Throws:
IllegalArgumentException- IfkeyColumnValues.length != keyColumnNames().size()UnsupportedOperationException- If multiple matching rows for thekeyColumnValueswere found
-
constituents
Get all the currentconstituents.The results will be
managedby the enclosingliveness scope.Note that if
constituentChangesPermitted(), this method may return different results if invoked multiple times.- Returns:
- An array of all current
constituents
-