Class AbstractTableLocation
- All Implemented Interfaces:
LogOutputAppendable,DelegatingLivenessReferent,LivenessReferent,TableLocation,TableLocationState,PushdownFilterMatcher,NamedImplementation
- Direct Known Subclasses:
NonexistentTableLocation,ParquetTableLocation,PythonTableDataService.TableLocationImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.locations.TableLocation
TableLocation.Listener -
Field Summary
Fields inherited from class io.deephaven.engine.table.impl.locations.impl.SubscriptionAggregator
subscriptionsFields inherited from interface io.deephaven.engine.table.impl.locations.TableLocationState
NULL_SIZE, NULL_TIME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTableLocation(@NotNull TableKey tableKey, @NotNull TableLocationKey tableLocationKey, boolean supportsSubscriptions) -
Method Summary
Modifier and TypeMethodDescriptionReturns the "real"LivenessReferentinstance.final voidClear all column locations (usually because a truncated location was observed).protected final voiddeliverInitialSnapshot(@NotNull TableLocation.Listener listener) Prompt listeners to record current state, under the subscriptions lock.protected voiddestroy()The reference count has reached zero, we can clear this location and release any resources.voidestimatePushdownFilterCost(WhereFilter filter, RowSet selection, boolean usePrev, PushdownFilterContext context, JobScheduler jobScheduler, LongConsumer onComplete, Consumer<Exception> onError) Estimate the cost of pushing down the next pushdown filter.final @NotNull ColumnLocationgetColumnLocation(@NotNull CharSequence name) final @Nullable BasicDataIndexgetDataIndex(@NotNull String... columns) Get the data index table for the specified set of columns.final @NotNull ImmutableTableLocationKeygetKey()final longfinal RowSetfinal longgetSize()final @NotNull Objectfinal @NotNull ImmutableTableKeyfinal voidhandleUpdate(RowSet rowSet, long lastModifiedTimeMillis) See TableLocationState for documentation of values.voidhandleUpdate(@NotNull TableLocationState source) Update all state fields from source's values, as inhandleUpdate(RowSet, long).protected final voidhandleUpdateInternal(RowSet rowSet, long lastModifiedTimeMillis) protected final voidhandleUpdateInternal(@NotNull TableLocationState source) protected booleanbooleanhasCachedDataIndex(@NotNull String... columns) Check if this TableLocation has a data index for the specified columns already loaded in memory.protected voidNo-op by default, can be overridden by subclasses to initialize state on first access.abstract @Nullable BasicDataIndexloadDataIndex(@NotNull String... columns) Load the data index from the location implementation.protected abstract @NotNull ColumnLocationmakeColumnLocation(@NotNull String name) makePushdownFilterContext(WhereFilter filter, List<ColumnSource<?>> filterSources) Create a pushdown filter context for this entity.voidpushdownFilter(WhereFilter filter, RowSet selection, boolean usePrev, PushdownFilterContext context, long costCeiling, JobScheduler jobScheduler, Consumer<PushdownResult> onComplete, Consumer<Exception> onError) Push down the given filter to the underlying table and pass the result to the consumer.final StringtoString()Methods inherited from class io.deephaven.engine.table.impl.locations.impl.SubscriptionAggregator
activateUnderlyingDataSource, activationFailed, activationSuccessful, checkHasSubscribers, deactivateUnderlyingDataSource, matchSubscriptionToken, postActivationHook, subscribe, supportsSubscriptions, unsubscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.deephaven.engine.liveness.DelegatingLivenessReferent
dropReference, getWeakReference, tryRetainReferenceMethods inherited from interface io.deephaven.engine.liveness.LivenessReferent
getReferentDescription, retainReferenceMethods inherited from interface io.deephaven.util.type.NamedImplementation
getImplementationNameMethods inherited from interface io.deephaven.engine.table.impl.locations.TableLocation
append, getDataIndexColumns, getSortedColumns, hasDataIndex, refresh, subscribe, supportsSubscriptions, toGenericString, toStringDetailed, toStringHelper, unsubscribeMethods inherited from interface io.deephaven.engine.table.impl.locations.TableLocationState
copyStateValuesTo
-
Constructor Details
-
AbstractTableLocation
protected AbstractTableLocation(@NotNull @NotNull TableKey tableKey, @NotNull @NotNull TableLocationKey tableLocationKey, boolean supportsSubscriptions) - Parameters:
tableKey- Table key for the table this location belongs totableLocationKey- Table location key that identifies this locationsupportsSubscriptions- Whether subscriptions are to be supported
-
-
Method Details
-
toString
-
asLivenessReferent
Description copied from interface:DelegatingLivenessReferentReturns the "real"LivenessReferentinstance. When implementing this, care should be taken to match lifecycle of theDelegatingLivenessReferentinstance with this instance, as the returnedLivenessReferentbehaves as a proxy forthis.- Specified by:
asLivenessReferentin interfaceDelegatingLivenessReferent- Returns:
- a LivenessReferent to use to manage this object's liveness.
-
initializeState
protected void initializeState()No-op by default, can be overridden by subclasses to initialize state on first access.The expectation for static locations that override this is to call
handleUpdateInternal(RowSet, long)instead ofhandleUpdate(RowSet, long), andhandleUpdateInternal(TableLocationState)instead ofhandleUpdate(TableLocationState)from insideinitializeState(). Otherwise, the initialization logic will recurse infinitely. -
getStateLock
- Specified by:
getStateLockin interfaceTableLocationState- Returns:
- The Object that accessors should synchronize on if they want to invoke multiple getters with consistent results.
-
getRowSet
- Specified by:
getRowSetin interfaceTableLocationState- Returns:
- The (possibly-empty)
RowSetof a table location, ornullif RowSet information is unknown or does not exist for this table location.
-
getSize
public final long getSize()- Specified by:
getSizein interfaceTableLocationState- Returns:
- The size of a table location:
NULL_SIZE: Size information is unknown or does not exist for this location
>= 0: The table location exists and has (possibly empty) data
-
getLastModifiedTimeMillis
public final long getLastModifiedTimeMillis()- Specified by:
getLastModifiedTimeMillisin interfaceTableLocationState- Returns:
- The last modified time for a table location, in milliseconds from the epoch:
NULL_TIME: Modification time information is unknown or does not exist for this location
>= 0: The time this table was last modified, in milliseconds from the UTC epoch
-
getTableKey
- Specified by:
getTableKeyin interfaceTableLocation- Returns:
- An
ImmutableTableKeyinstance for the enclosing table
-
getKey
- Specified by:
getKeyin interfaceTableLocation- Returns:
- An
ImmutableTableLocationKeyinstance for this location
-
deliverInitialSnapshot
Description copied from class:SubscriptionAggregatorPrompt listeners to record current state, under the subscriptions lock.- Specified by:
deliverInitialSnapshotin classSubscriptionAggregator<TableLocation.Listener>- Parameters:
listener- The listener to notify
-
handleUpdate
See TableLocationState for documentation of values.- Parameters:
rowSet- The new RowSet. Ownership passes to this location; callers shouldcopyit if necessary.lastModifiedTimeMillis- The new lastModificationTimeMillis
-
handleUpdateInternal
-
handleUpdate
Update all state fields from source's values, as inhandleUpdate(RowSet, long). SeeTableLocationStatefor documentation of values.- Parameters:
source- The source to copy state values from
-
handleUpdateInternal
-
getColumnLocation
@NotNull public final @NotNull ColumnLocation getColumnLocation(@NotNull @NotNull CharSequence name) - Specified by:
getColumnLocationin interfaceTableLocation- Parameters:
name- The column name- Returns:
- The ColumnLocation for the defined column under this table location. The exact same ColumnLocation object should be returned for the same column name.
-
makeColumnLocation
@NotNull protected abstract @NotNull ColumnLocation makeColumnLocation(@NotNull @NotNull String name) -
clearColumnLocations
public final void clearColumnLocations()Clear all column locations (usually because a truncated location was observed). -
hasAnyCachedDataIndex
protected boolean hasAnyCachedDataIndex() -
hasCachedDataIndex
Description copied from interface:TableLocationCheck if this TableLocation has a data index for the specified columns already loaded in memory.- Specified by:
hasCachedDataIndexin interfaceTableLocation- Parameters:
columns- The set of columns to check for- Returns:
- Whether the TableLocation has a cached index for the specified columns
-
getDataIndex
Description copied from interface:TableLocationGet the data index table for the specified set of columns. Note that the order of columns does not matter here.- Specified by:
getDataIndexin interfaceTableLocation- Parameters:
columns- The key columns for the index- Returns:
- The index table or null if one does not exist
-
loadDataIndex
@InternalUseOnly @Nullable public abstract @Nullable BasicDataIndex loadDataIndex(@NotNull @NotNull String... columns) Load the data index from the location implementation. Implementations of this method should not perform any result caching.- Parameters:
columns- The columns to load an index for- Returns:
- The data index, or
nullif none exists - ApiNote:
- This method is
publicfor use in delegating implementations, and should not be called directly otherwise.
-
estimatePushdownFilterCost
public void estimatePushdownFilterCost(WhereFilter filter, RowSet selection, boolean usePrev, PushdownFilterContext context, JobScheduler jobScheduler, LongConsumer onComplete, Consumer<Exception> onError) Description copied from interface:PushdownFilterMatcherEstimate the cost of pushing down the next pushdown filter. This returns a unitless value to compare the cost of executing different filters. Common costs are listed inPushdownResult(such asPushdownResult.METADATA_STATS_COST) and should be used as a baseline for estimating the cost of newly implemented pushdown operations.A no-op implementation should simply complete with
Long.MAX_VALUE.- Specified by:
estimatePushdownFilterCostin interfacePushdownFilterMatcher- Parameters:
filter- Thefilterto test.selection- The set of rows to tests.usePrev- Whether to use the previous resultcontext- ThePushdownFilterContextto use for the pushdown operation.jobScheduler- The job scheduler to use for scheduling child jobsonComplete- Consumer of the estimated cost of the pushdown operation. 9223372036854775807L indicates that the filter cannot be pushed down.onError- Consumer of any exceptions that occur during the estimate operation
-
pushdownFilter
public void pushdownFilter(WhereFilter filter, RowSet selection, boolean usePrev, PushdownFilterContext context, long costCeiling, JobScheduler jobScheduler, Consumer<PushdownResult> onComplete, Consumer<Exception> onError) Description copied from interface:PushdownFilterMatcherPush down the given filter to the underlying table and pass the result to the consumer. This method is expected to execute all pushdown filter steps that are greater thanPushdownFilterContext.executedFilterCost()and less than or equal tocostCeiling.The resulting
PushdownResult(toonComplete) must only contain rows fromselection. Thematch row setare rows that are guaranteed to match. The implicitly "missing" rowsselection - match - maybeMatchare rows that are guaranteed to not match. The remainingmaybe match row setare rows that may, or may not, match. The pushdown result ownership passes toonComplete.A no-op implementation should simply complete with
PushdownResult.maybeMatch(selection).- Specified by:
pushdownFilterin interfacePushdownFilterMatcher- Parameters:
filter- Thefilterto apply.selection- The set of rows to test.usePrev- Whether to use the previous resultcontext- ThePushdownFilterContextto use for the pushdown operation.costCeiling- Execute all possible filters with a cost less than or equal this value.jobScheduler- The job scheduler to use for scheduling child jobsonComplete- Consumer of the output rowsets for added and modified rows that pass the filteronError- Consumer of any exceptions that occur during the pushdown operation
-
makePushdownFilterContext
public PushdownFilterContext makePushdownFilterContext(WhereFilter filter, List<ColumnSource<?>> filterSources) Description copied from interface:PushdownFilterMatcherCreate a pushdown filter context for this entity.- Specified by:
makePushdownFilterContextin interfacePushdownFilterMatcher- Parameters:
filter- the filter to use while making the contextfilterSources- the column sources that match the filter column names- Returns:
- the created filter context
-
destroy
protected void destroy()The reference count has reached zero, we can clear this location and release any resources.
-