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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Can the constituents of the underlyingpartitioned table
change?Get the name of the "constituent" column oftables
.constituentFor
(@NotNull Object... keyColumnValues) Get a singleconstituent
by its corresponding key column values.Table[]
Get all the currentconstituents
.filter
(Collection<? extends Filter> filters) Make a new PartitionedTable from the result of applyingfilters
to the underlying partitioned table.Get the names of all "key" columns that are part oftable().getDefinition()
.merge()
Make a newTable
that 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 PartitionedTable
partitionedTransform
(@NotNull PartitionedTable other, @NotNull BinaryOperator<Table> transformer, @NotNull NotificationQueue.Dependency... dependencies) Applytransformer
to all constituenttables
found inthis
andother
with 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) Applytransformer
to all constituenttables
found inthis
andother
with the same key column values, and produce a new PartitionedTable containing the results.default PartitionedTable.Proxy
proxy()
Same asproxy(true, true)
.proxy
(boolean requireMatchingKeys, boolean sanityCheckJoinOperations) Make a proxy that allowstable operations
to be applied to the constituent tables of this PartitionedTable.sort
(Collection<SortColumn> sortColumns) Make a new PartitionedTable from the result of applyingsortColumns
to the underlying partitioned table.table()
Get the "raw"partitioned table
underlying this PartitionedTable.default PartitionedTable
transform
(@NotNull UnaryOperator<Table> transformer, @NotNull NotificationQueue.Dependency... dependencies) Applytransformer
to all constituenttables
, and produce a new PartitionedTable containing the results.transform
(@Nullable ExecutionContext executionContext, @NotNull UnaryOperator<Table> transformer, boolean expectRefreshingResults, @NotNull NotificationQueue.Dependency... dependencies) Applytransformer
to all constituenttables
, and produce a new PartitionedTable containing the results.boolean
Are the keys (key column values for a row considered as a tuple) in the underlyingpartitioned table
unique?Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, tryManage
Methods inherited from interface io.deephaven.engine.liveness.LivenessNode
tryUnmanage, tryUnmanage, unmanage, unmanage
Methods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
Methods inherited from interface io.deephaven.base.log.LogOutputAppendable
append
-
Method Details
-
table
Get the "raw"partitioned table
underlying 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 table
unique?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 table
change?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() == false
must 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 operations
to 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 operations
to 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 usesthis
and anotherPartitionedTable
as inputs for apartitioned transform
sanityCheckJoinOperations
- Whether to check that proxied join operations will only find a given join key in one constituent table forthis
and thetable
argument if it is also aproxy
- Returns:
- A proxy that allows
table operations
to be applied to the constituent tables of this PartitionedTable
-
merge
Table merge()Make a newTable
that 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
filters
to the underlying partitioned table.filters
must 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
sortColumns
to the underlying partitioned table.sortColumns
must 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
transformer
to all constituenttables
, and produce a new PartitionedTable containing the results.This overload uses the
enclosing ExecutionContext
and expectstransformer
to producerefreshing
results if and only if this PartitionedTable'sunderlying table
is refreshing.- Parameters:
transformer
- TheUnaryOperator
to apply to all constituenttables
dependencies
- Additional dependencies that must be satisfied before applyingtransformer
to added or modified constituents during update processing; use this whentransformer
uses additionalTable
orPartitionedTable
inputs besides the constituents ofthis
- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException
- On instantiation or update if!table().isRefreshing()
andtransformer
produces a refreshing result for any constituent- ApiNote:
transformer
must 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
transformer
to all constituenttables
, and produce a new PartitionedTable containing the results. Thetransformer
will be invoked in the provided ExecutionContext.transformer
must 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 thetransformer
transformer
- TheUnaryOperator
to apply to all constituenttables
expectRefreshingResults
- Whether to expect that the results of applyingtransformer
may 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 specifyingfalse
will result in exceptions.dependencies
- Additional dependencies that must be satisfied before applyingtransformer
to added or modified constituents during update processing; use this whentransformer
uses additionalTable
orPartitionedTable
inputs besides the constituents ofthis
- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException
- On instantiation or update if!table().isRefreshing() && !expectRefreshingResults
andtransformer
produces 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
transformer
to all constituenttables
found inthis
andother
with the same key column values, and produce a new PartitionedTable containing the results.Note that
other
's key columns must matchthis
PartitionedTable'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 type
andcomponent 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 type
andcomponent type
.
This overload uses the
enclosing ExecutionContext
and expectstransformer
to producerefreshing
results if and only ifthis
orother
has a refreshingunderlying table
.- Parameters:
other
- The other PartitionedTable to find constituents intransformer
- TheBinaryOperator
to apply to all pairs of constituenttables
dependencies
- Additional dependencies that must be satisfied before applyingtransformer
to added, modified, or newly-matched constituents during update processing; use this whentransformer
uses additionalTable
orPartitionedTable
inputs besides the constituents ofthis
orother
- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException
- On instantiation or update if!table().isRefreshing() && !other.table().isRefreshing()
andtransformer
produces a refreshing result for any constituent- ApiNote:
transformer
must 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
transformer
to all constituenttables
found inthis
andother
with the same key column values, and produce a new PartitionedTable containing the results. Thetransformer
will be invoked in the provided ExecutionContext.Note that
other
's key columns must matchthis
PartitionedTable'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 type
andcomponent 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 type
andcomponent type
.
transformer
must 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 thetransformer
transformer
- TheBinaryOperator
to apply to all pairs of constituenttables
expectRefreshingResults
- Whether to expect that the results of applyingtransformer
may 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 specifyingfalse
will result in exceptions.dependencies
- Additional dependencies that must be satisfied before applyingtransformer
to added, modified, or newly-matched constituents during update processing; use this whentransformer
uses additionalTable
orPartitionedTable
inputs besides the constituents ofthis
orother
- Returns:
- The new PartitionedTable containing the resulting constituents
- Throws:
IllegalStateException
- On instantiation or update if!table().isRefreshing() && !other.table().isRefreshing() && !expectRefreshingResults
andtransformer
produces a refreshing result for any constituent
- Match by column name. Both PartitionedTables must have all the same
-
constituentFor
Get a single
constituent
by its corresponding key column values.The
keyColumnValues
can 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, anUnsupportedOperationException
is thrown.The result will be
managed
by 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
constituent
at the single row intable()
matching thekeyColumnValues
, ornull
if no matches were found - Throws:
IllegalArgumentException
- IfkeyColumnValues.length != keyColumnNames().size()
UnsupportedOperationException
- If multiple matching rows for thekeyColumnValues
were found
-
constituents
Get all the currentconstituents
.The results will be
managed
by the enclosingliveness scope
.Note that if
constituentChangesPermitted()
, this method may return different results if invoked multiple times.- Returns:
- An array of all current
constituents
-