Class BaseTable<IMPL_TYPE extends BaseTable<IMPL_TYPE>>
- All Implemented Interfaces:
TableOperations<Table,
,Table> TableOperationsDefaults<Table,
,Table> LogOutputAppendable
,LivenessManager
,LivenessNode
,LivenessReferent
,AttributeMap<Table>
,GridAttributes<Table>
,NotificationStepReceiver
,NotificationStepSource
,TableDefaults
,Table
,DynamicNode
,NotificationQueue.Dependency
,SystemicObject<Table>
,LongSizedDataStructure
,Serializable
- Direct Known Subclasses:
QueryTable
,UncoalescedTable
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
Simplest appropriate InstrumentedShiftAwareListener implementation for BaseTable and descendants.static class
Simplest appropriate legacy ShiftObliviousInstrumentedListener implementation for BaseTable and descendants.static interface
-
Field Summary
Modifier and TypeFieldDescriptionprotected final TableDefinition
This table's definition.protected final String
This table's description.static final boolean
protected final UpdateGraph
This table's update graph.static final boolean
Fields inherited from interface io.deephaven.engine.table.GridAttributes
COLUMN_DESCRIPTIONS_ATTRIBUTE, DESCRIPTION_ATTRIBUTE, LAYOUT_HINTS_ATTRIBUTE, SORTABLE_COLUMNS_ATTRIBUTE
Fields inherited from interface io.deephaven.engine.table.impl.NotificationStepReceiver
NULL_NOTIFICATION_STEP
Fields inherited from interface io.deephaven.engine.table.Table
ADD_ONLY_TABLE_ATTRIBUTE, AGGREGATION_ROW_LOOKUP_ATTRIBUTE, APPEND_ONLY_TABLE_ATTRIBUTE, BARRAGE_PERFORMANCE_KEY_ATTRIBUTE, BLINK_TABLE_ATTRIBUTE, FILTERABLE_COLUMNS_ATTRIBUTE, INITIALLY_EMPTY_COALESCED_SOURCE_TABLE_ATTRIBUTE, INPUT_TABLE_ATTRIBUTE, KEY_COLUMNS_ATTRIBUTE, MERGED_TABLE_ATTRIBUTE, NON_DISPLAY_TABLE, PLUGIN_NAME, PREVIEW_PARENT_TABLE, SNAPSHOT_VIEWPORT_TYPE, SORT_REVERSE_LOOKUP_ATTRIBUTE, SORTED_COLUMNS_ATTRIBUTE, SYSTEMIC_TABLE_ATTRIBUTE, TEST_SOURCE_TABLE_ATTRIBUTE, TOTALS_TABLE_ATTRIBUTE, UNIQUE_KEYS_ATTRIBUTE
Fields inherited from interface io.deephaven.engine.table.impl.TableDefaults
ZERO_LENGTH_TABLE_ARRAY
Fields inherited from interface io.deephaven.api.TableOperations
AGG_BY_PRESERVE_EMPTY_DEFAULT
Fields inherited from interface io.deephaven.api.TableOperationsDefaults
ZERO_LENGTH_COLUMNNAME_ARRAY, ZERO_LENGTH_FILTER_ARRAY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addParentReference
(@NotNull Object parent) Called on a dependent node to ensure that a strong reference is maintained to any parent object that is required for the proper maintenance and functioning of the dependent.void
addUpdateListener
(@NotNull TableUpdateListener listener) Subscribe for updates to this table.boolean
addUpdateListener
(@NotNull TableUpdateListener listener, long requiredLastNotificationStep) Subscribe for updates to this table if its last notification step matchesrequiredLastNotificationStep
.void
addUpdateListener
(ShiftObliviousListener listener, boolean replayInitialImage) Subscribe for updates to this table.void
Wait for updates to this Table.boolean
awaitUpdate
(long timeout) Wait for updates to this Table.final void
checkAvailableColumns
(@NotNull Collection<String> columns) Check this grid to ensure that allcolumns
are present.void
copyAttributes
(BaseTable<?> dest, BaseTable.CopyAttributeOperation copyType) Copy this table's attributes to the specified table.void
copyAttributes
(BaseTable<?> dest, Predicate<String> shouldCopy) Copy this table's attributes to the specified table.void
copySortableColumns
(@NotNull BaseGridAttributes<?, ?> destination, @NotNull Predicate<String> shouldCopy) <T extends OperationSnapshotControl>
TIf we are a refreshing table, then we should create a snapshot control to validate the snapshot.protected void
destroy()
Attempt to release (destructively when necessary) resources held by this object.long
Get the last logical clock step on which this element dispatched a notification.protected NotificationQueue
Get the notification queue to insert notifications into as they are generated by listeners duringnotifyListeners(io.deephaven.engine.rowset.RowSet, io.deephaven.engine.rowset.RowSet, io.deephaven.engine.rowset.RowSet)
andnotifyListenersOnError(Throwable, TableListener.Entry)
.boolean
static void
initializeWithSnapshot
(@NotNull String logPrefix, ConstructSnapshot.SnapshotControl snapshotControl, ConstructSnapshot.SnapshotFunction snapshotFunction) boolean
Returns true if this table is static, or has an attribute asserting that no modifies, shifts, or removals are generated.boolean
Returns true if this table is append-only, or has an attribute asserting that no modifies, shifts, or removals are generated and that all new rows are added to the end of the table.boolean
isBlink()
Returns true if this table is a blink table.boolean
isFailed()
final boolean
Is the node updating?boolean
Returns true if this is a systemically important object (seeSystemicObjectTracker
).Mark this object as systemically important.final void
notifyListeners
(RowSet added, RowSet removed, RowSet modified) Initiate update delivery to this table's listeners by enqueueing update notifications.final void
notifyListeners
(TableUpdate update) Initiate update delivery to this table's listeners by enqueueing update notifications.final void
notifyListenersOnError
(Throwable e, TableListener.Entry sourceEntry) Initiate failure delivery to this table's listeners by enqueueing error notifications.If this table is a blink table, i.e.void
removeUpdateListener
(ShiftObliviousListener listenerToRemove) Unsubscribe the supplied listener.void
removeUpdateListener
(TableUpdateListener listenerToRemove) Unsubscribe the supplied listener.boolean
satisfied
(long step) Is this ancestor satisfied? Note that this method must be safe to call on any thread.void
setLastNotificationStep
(long lastNotificationStep) Deliver a last notification step to this receiver.final boolean
setRefreshing
(boolean refreshing) Change the node's run mode.setTotalsTable
(String directive) Set a totals table for this Table.static boolean
shouldCopyAttribute
(String attrName, BaseTable.CopyAttributeOperation copyType) toString()
Set the table's key columns.withUniqueKeys
(String... columns) Set the table's key columns and indicate that each key set will be unique.Methods inherited from class io.deephaven.engine.table.impl.BaseGridAttributes
clearSortingRestrictions, getSortableColumns, restrictSortTo, setColumnDescriptions, setLayoutHints, setSortableColumns, withColumnDescription, withColumnDescriptions, withDescription
Methods inherited from class io.deephaven.engine.table.impl.LiveAttributeMap
copy, copyAttributes, getAttribute, getAttributeKeys, getAttributes, getAttributes, hasAttribute, prepareReturnCopy, prepareReturnThis, published, retainingAttributes, setAttribute, setAttribute, withAttributes, withAttributes, withoutAttributes
Methods inherited from class io.deephaven.engine.liveness.LivenessArtifact
manageWithCurrentScope
Methods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessNode
getWeakReference, initializeTransientFieldsForLiveness, onReferenceCountAtZero, tryManage, tryUnmanage, tryUnmanage
Methods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessReferent
dropReference, tryRetainReference
Methods inherited from class io.deephaven.util.referencecounting.ReferenceCounted
decrementReferenceCount, forceReferenceCountToZero, getReferenceCountDebug, incrementReferenceCount, resetReferenceCount, tryDecrementReferenceCount, tryIncrementReferenceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.deephaven.engine.table.AttributeMap
getAttribute, getAttributeKeys, getAttributes, getAttributes, hasAttribute, retainingAttributes, withAttributes, withAttributes, withoutAttributes
Methods inherited from interface io.deephaven.engine.table.GridAttributes
clearSortingRestrictions, restrictSortTo, setLayoutHints, withColumnDescription, withColumnDescriptions, withDescription
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.util.datastructures.LongSizedDataStructure
intSize, intSize, size
Methods inherited from interface io.deephaven.engine.updategraph.NotificationQueue.Dependency
getUpdateGraph
Methods inherited from interface io.deephaven.engine.table.impl.NotificationStepReceiver
initializeLastNotificationStep
Methods inherited from interface io.deephaven.engine.table.Table
apply, byteColumnIterator, characterColumnIterator, columnIterator, doubleColumnIterator, flatten, floatColumnIterator, getColumnSource, getColumnSourceMap, getColumnSources, getRowSet, getSubTable, headBy, headPct, integerColumnIterator, isFlat, longColumnIterator, moveColumns, objectColumnIterator, partitionBy, partitionedAggBy, renameColumns, rollup, shortColumnIterator, slice, slicePct, tailBy, tailPct, tree, wouldMatch
Methods inherited from interface io.deephaven.engine.table.impl.TableDefaults
addUpdateListener, applyToAllBy, applyToAllBy, applyToAllBy, close, coalesce, dropColumnFormats, formatColumns, formatColumnWhere, formatRowWhere, getColumnSource, getColumnSource, hasColumns, hasColumns, headBy, isEmpty, join, meta, moveColumnsDown, moveColumnsUp, numColumns, partitionBy, releaseCachedResources, renameAllColumns, renameColumns, rollup, rollup, rollup, rollup, rollup, selectDistinct, sizeForInstrumentation, snapshotWhen, snapshotWhen, tailBy, wouldMatch
Methods inherited from interface io.deephaven.api.TableOperations
aggAllBy, aggBy, asOfJoin, dropColumns, exactJoin, head, join, lazyUpdate, naturalJoin, rangeJoin, reverse, select, selectDistinct, snapshot, snapshotWhen, sort, tail, ungroup, update, updateBy, updateView, view, where, whereIn, whereNotIn
Methods inherited from interface io.deephaven.api.TableOperationsDefaults
absSumBy, absSumBy, absSumBy, absSumBy, aggAllBy, aggAllBy, aggAllBy, aggBy, aggBy, aggBy, aggBy, aggBy, aggBy, aggBy, aj, aj, avgBy, avgBy, avgBy, avgBy, countBy, countBy, countBy, countBy, dropColumns, dropColumns, exactJoin, exactJoin, firstBy, firstBy, firstBy, firstBy, groupBy, groupBy, groupBy, join, join, join, lastBy, lastBy, lastBy, lastBy, lazyUpdate, maxBy, maxBy, maxBy, maxBy, medianBy, medianBy, medianBy, medianBy, minBy, minBy, minBy, minBy, naturalJoin, naturalJoin, raj, raj, rangeJoin, select, select, selectDistinct, sort, sortDescending, stdBy, stdBy, stdBy, stdBy, sumBy, sumBy, sumBy, sumBy, ungroup, ungroup, ungroup, ungroup, update, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateBy, updateView, varBy, varBy, varBy, varBy, view, wavgBy, wavgBy, wavgBy, wavgBy, where, whereIn, whereNotIn, wsumBy, wsumBy, wsumBy, wsumBy
-
Field Details
-
VALIDATE_UPDATE_OVERLAPS
public static final boolean VALIDATE_UPDATE_OVERLAPS -
PRINT_SERIALIZED_UPDATE_OVERLAPS
public static final boolean PRINT_SERIALIZED_UPDATE_OVERLAPS -
definition
This table's definition. -
description
This table's description. -
updateGraph
This table's update graph.
-
-
Constructor Details
-
BaseTable
public BaseTable(@NotNull @NotNull TableDefinition definition, @NotNull @NotNull String description, @Nullable @Nullable Map<String, Object> attributes) - Parameters:
definition
- The definition for this tabledescription
- A description of this tableattributes
- The attributes map to use, or elsenull
to allocate a new one
-
-
Method Details
-
getDefinition
- Specified by:
getDefinition
in interfaceTable
-
getDescription
- Specified by:
getDescription
in interfaceTable
-
getUpdateGraph
- Specified by:
getUpdateGraph
in interfaceNotificationQueue.Dependency
- Returns:
- the update graph that this dependency is a part of
-
toString
- Overrides:
toString
in classReferenceCounted
-
append
- Specified by:
append
in interfaceLogOutputAppendable
- Overrides:
append
in classReferenceCounted
-
shouldCopyAttribute
public static boolean shouldCopyAttribute(String attrName, BaseTable.CopyAttributeOperation copyType) -
copyAttributes
Copy this table's attributes to the specified table. Attributes will be copied based upon the inputBaseTable.CopyAttributeOperation
.- Parameters:
dest
- The table to copy attributes tocopyType
- The operation being performed that requires attributes to be copied.
-
copyAttributes
Copy this table's attributes to the specified table. Attributes are copied based on a predicate.- Parameters:
dest
- The table to copy attributes toshouldCopy
- should we copy this attribute?
-
isAddOnly
public boolean isAddOnly()Returns true if this table is static, or has an attribute asserting that no modifies, shifts, or removals are generated.- Returns:
- true if this table does not produce modifications, shifts, or removals
-
isAppendOnly
public boolean isAppendOnly()Returns true if this table is append-only, or has an attribute asserting that no modifies, shifts, or removals are generated and that all new rows are added to the end of the table.- Returns:
- true if this table may only append rows at the end of the table
-
isBlink
public boolean isBlink()Returns true if this table is a blink table.- Returns:
- Whether this table is a blink table
- See Also:
-
removeBlink
Description copied from interface:Table
If this table is a blink table, i.e. it hasTable.BLINK_TABLE_ATTRIBUTE
set totrue
, return a child without the attribute, restoring standard semantics for aggregation operations.- Specified by:
removeBlink
in interfaceTable
- Returns:
- A non-blink child table, or this table if it is not a blink table
-
addParentReference
Description copied from interface:DynamicNode
Called on a dependent node to ensure that a strong reference is maintained to any parent object that is required for the proper maintenance and functioning of the dependent. In the most common case, the parent object is a child listener to a parent node. The parent node only keeps a weak reference to its child listener, but the listener maintains a strong reference to the parent node. In this scenario, the only strong reference to the listener (and thus indirectly to the parent node itself) is the reference kept by the dependent node.- Specified by:
addParentReference
in interfaceDynamicNode
- Parameters:
parent
- A parent of this node
-
satisfied
public boolean satisfied(long step) Description copied from interface:NotificationQueue.Dependency
Is this ancestor satisfied? Note that this method must be safe to call on any thread.- Specified by:
satisfied
in interfaceNotificationQueue.Dependency
- Parameters:
step
- The step for which we are testing satisfaction- Returns:
- Whether the dependency is satisfied on
step
(and will not fire subsequent notifications)
-
awaitUpdate
Description copied from interface:Table
Wait for updates to this Table. Should not be invoked from a
TableListener
or othernotification
on this Table'supdate graph
. It may be suitable to wait from another update graph if doing so does not introduce any cycles.In some implementations, this call may also terminate in case of interrupt or spurious wakeup.
- Specified by:
awaitUpdate
in interfaceTable
- Throws:
InterruptedException
- In the event this thread is interrupted- See Also:
-
awaitUpdate
Description copied from interface:Table
Wait for updates to this Table. Should not be invoked from a
TableListener
or othernotification
on this Table'supdate graph
. It may be suitable to wait from another update graph if doing so does not introduce any cycles.In some implementations, this call may also terminate in case of interrupt or spurious wakeup.
- Specified by:
awaitUpdate
in interfaceTable
- Parameters:
timeout
- The maximum time to wait in milliseconds.- Returns:
- false if the timeout elapses without notification, true otherwise.
- Throws:
InterruptedException
- In the event this thread is interrupted- See Also:
-
addUpdateListener
Description copied from interface:Table
Subscribe for updates to this table. After the optional initial image,listener
will be invoked via theNotificationQueue
associated with this Table.- Specified by:
addUpdateListener
in interfaceTable
- Parameters:
listener
- listener for updatesreplayInitialImage
- true to process updates for all initial rows in the table plus all changes; false to only process changes
-
addUpdateListener
Description copied from interface:Table
Subscribe for updates to this table.listener
will be invoked via theNotificationQueue
associated with this Table.- Specified by:
addUpdateListener
in interfaceTable
- Parameters:
listener
- listener for updates
-
addUpdateListener
public boolean addUpdateListener(@NotNull @NotNull TableUpdateListener listener, long requiredLastNotificationStep) Description copied from interface:Table
Subscribe for updates to this table if its last notification step matchesrequiredLastNotificationStep
.listener
will be invoked via theNotificationQueue
associated with this Table.- Specified by:
addUpdateListener
in interfaceTable
- Parameters:
listener
- listener for updatesrequiredLastNotificationStep
- the expected last notification step to match- Returns:
- true if the listener was added, false if the last notification step requirement was not met
-
removeUpdateListener
Description copied from interface:Table
Unsubscribe the supplied listener.- Specified by:
removeUpdateListener
in interfaceTable
- Parameters:
listenerToRemove
- listener for updates
-
removeUpdateListener
Description copied from interface:Table
Unsubscribe the supplied listener.- Specified by:
removeUpdateListener
in interfaceTable
- Parameters:
listenerToRemove
- listener for updates
-
isRefreshing
public final boolean isRefreshing()Description copied from interface:DynamicNode
Is the node updating?- Specified by:
isRefreshing
in interfaceDynamicNode
- Specified by:
isRefreshing
in interfaceTable
- Returns:
- true if the node is updating; false otherwise.
-
setRefreshing
public final boolean setRefreshing(boolean refreshing) Description copied from interface:DynamicNode
Change the node's run mode.- Specified by:
setRefreshing
in interfaceDynamicNode
- Parameters:
refreshing
- true to cause the node to update; false otherwise.- Returns:
- new refreshing state
-
isFailed
public boolean isFailed() -
hasListeners
public boolean hasListeners() -
notifyListeners
Initiate update delivery to this table's listeners by enqueueing update notifications.- Parameters:
added
- Row keys added to the tableremoved
- Row keys removed from the tablemodified
- Row keys modified in the table
-
notifyListeners
Initiate update delivery to this table's listeners by enqueueing update notifications.- Parameters:
update
- The set of table changes to propagate. The caller gives this update object away; the invocation ofnotifyListeners
takes ownership, and will callrelease
on it once it is not used anymore; callers should pass acopy
for updates they intend to further use.
-
notifyListenersOnError
Initiate failure delivery to this table's listeners by enqueueing error notifications.- Parameters:
e
- errorsourceEntry
- performance tracking
-
getNotificationQueue
Get the notification queue to insert notifications into as they are generated by listeners duringnotifyListeners(io.deephaven.engine.rowset.RowSet, io.deephaven.engine.rowset.RowSet, io.deephaven.engine.rowset.RowSet)
andnotifyListenersOnError(Throwable, TableListener.Entry)
. This method may be overridden to provide a different notification queue than the table'sPeriodicUpdateGraph
instance for more complex behavior.- Returns:
- The
NotificationQueue
to add to
-
getLastNotificationStep
public long getLastNotificationStep()Description copied from interface:NotificationStepSource
Get the last logical clock step on which this element dispatched a notification.- Specified by:
getLastNotificationStep
in interfaceNotificationStepSource
- Returns:
- The last notification step
-
setLastNotificationStep
public void setLastNotificationStep(long lastNotificationStep) Description copied from interface:NotificationStepReceiver
Deliver a last notification step to this receiver.- Specified by:
setLastNotificationStep
in interfaceNotificationStepReceiver
- Parameters:
lastNotificationStep
- The last notification step to be delivered
-
isSystemicObject
public boolean isSystemicObject()Description copied from interface:SystemicObject
Returns true if this is a systemically important object (seeSystemicObjectTracker
).- Specified by:
isSystemicObject
in interfaceSystemicObject<IMPL_TYPE extends BaseTable<IMPL_TYPE>>
- Returns:
- true if this is a systemically important object, false otherwise.
-
markSystemic
Description copied from interface:SystemicObject
Mark this object as systemically important.- Specified by:
markSystemic
in interfaceSystemicObject<IMPL_TYPE extends BaseTable<IMPL_TYPE>>
-
withKeys
Description copied from interface:Table
Set the table's key columns. -
withUniqueKeys
Description copied from interface:Table
Set the table's key columns and indicate that each key set will be unique.- Specified by:
withUniqueKeys
in interfaceTable
- Returns:
- A copy of this table with the unique key columns specified, or this if no change was needed
-
checkAvailableColumns
Description copied from class:BaseGridAttributes
Check this grid to ensure that allcolumns
are present.- Specified by:
checkAvailableColumns
in classBaseGridAttributes<Table,
IMPL_TYPE extends BaseTable<IMPL_TYPE>> - Parameters:
columns
- The column names to check
-
copySortableColumns
public void copySortableColumns(@NotNull @NotNull BaseGridAttributes<?, ?> destination, @NotNull @NotNull Predicate<String> shouldCopy) -
setTotalsTable
Description copied from interface:Table
Set a totals table for this Table.- Specified by:
setTotalsTable
in interfaceTable
- Parameters:
directive
- A packed string of totals table instructions- Returns:
- A copy of this Table with the
totals table attribute
set
-
initializeWithSnapshot
public static void initializeWithSnapshot(@NotNull @NotNull String logPrefix, @Nullable ConstructSnapshot.SnapshotControl snapshotControl, @NotNull ConstructSnapshot.SnapshotFunction snapshotFunction) -
createSnapshotControlIfRefreshing
@Nullable public <T extends OperationSnapshotControl> T createSnapshotControlIfRefreshing(BaseTable.SnapshotControlFactory<T> factory) If we are a refreshing table, then we should create a snapshot control to validate the snapshot.Otherwise, we return null.
- Returns:
- a snapshot control to snapshot this table (or null)
-
destroy
protected void destroy()Description copied from class:ReferenceCountedLivenessReferent
Attempt to release (destructively when necessary) resources held by this object. This may render the object unusable for subsequent operations. Implementations should be sure to call super.destroy().This is intended to only ever be used as a side effect of decreasing the reference count to 0.
- Overrides:
destroy
in classReferenceCountedLivenessReferent
-