Interface WhereFilter
- All Superinterfaces:
ConcurrencyControl<Filter>,Expression,Filter
- All Known Subinterfaces:
ReindexingFilter
- All Known Implementing Classes:
AbstractConditionFilter,AbstractRangeFilter,AutoTuningIncrementalReleaseFilter,BaseIncrementalReleaseFilter,ByteRangeFilter,CharRangeFilter,ClockFilter,ComparableRangeFilter,ComposedFilter,ConditionFilter,ConjunctiveFilter,DisjunctiveFilter,DoubleRangeFilter,DownsampledWhereFilter,DynamicWhereFilter,FloatRangeFilter,IncrementalReleaseFilter,InstantRangeFilter,IntRangeFilter,LongRangeFilter,MatchFilter,RangeFilter,RollingReleaseFilter,ShortRangeFilter,SingleSidedComparableRangeFilter,SortedClockFilter,TimeSeriesFilter,UnsortedClockFilter,VectorComponentFilterWrapper,WhereAllFilter,WhereFilterDelegatingBase,WhereFilterImpl,WhereFilterInvertedImpl,WhereFilterLivenessArtifactImpl,WhereFilterSerialImpl,WhereFilterWithDeclaredBarriersImpl,WhereFilterWithRespectedBarriersImpl,WhereNoneFilter
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThis exception is thrown when a where() filter is incapable of handling previous values, and thus needs to be executed while under the UGP lock.static interfaceUsers of WhereFilter may implement this interface if they must react to the filter fundamentally changing.static interfaceThe visitor. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault SafeCloseablebeginOperation(@NotNull Table sourceTable) Perform any operation-level initialization necessary using theTablethat will be filtered with this WhereFilter, e.g.default booleanCan this filter operation be memoized?copy()Create a copy of this WhereFilter.static WhereFilter[]copyFrom(WhereFilter[] filters) @NotNull WritableRowSetFilter selection to only matching rows.default WritableRowSetDelegates tofilter(RowSet, RowSet, Table, boolean)wheninvert == falseandfilterInverse(RowSet, RowSet, Table, boolean)wheninvert == true.default @NotNull WritableRowSetfilterInverse(@NotNull RowSet selection, @NotNull RowSet fullSet, @NotNull Table table, boolean usePrev) Filter selection to only non-matching rows.static WhereFilter[]from(Collection<? extends Filter> filters) static WhereFilter[]fromInternal(Filter filter) Get the array columns required by this select filter.Get the columns required by this select filter.default booleanReturns true if this filter uses row virtual offset columns ofi,iiork.voidinit(@NotNull TableDefinition tableDefinition) Initialize this filter given the table definition.default voidinit(@NotNull TableDefinition tableDefinition, @NotNull QueryCompilerRequestProcessor compilationProcessor) Initialize this select filter given the table definitiondefault Filterinvert()The logical inversion ofthis.booleanThe database system may automatically generate a filter, for example, when applying an ACL to a table.default booleanIs this filter refreshing?booleanstatic WhereFilterdefault booleanvoidsetAutomatedFilter(boolean value) The database system may automatically generate a filter, for example, when applying an ACL to a table.voidSet theWhereFilter.RecomputeListenerthat should be notified if results based on this WhereFilter must be recomputed.default voidvalidateSafeForRefresh(BaseTable<?> sourceTable) Validate that thisWhereFilteris safe to use in the context of the provided sourceTable.default <T> Twalk(Expression.Visitor<T> visitor) default <T> Twalk(Filter.Visitor<T> visitor) default <T> Twalk(WhereFilter.Visitor<T> visitor) default WhereFilterwithDeclaredBarriers(Object... declaredBarriers) Designates the filter/selectable as declaring the specified barrier object(s).default WhereFilterwithRespectedBarriers(Object... respectedBarriers) Specifies that the filter/selectable should respect the ordering constraints of the given barriers.default WhereFilterApplies serial concurrency control to the expression.
-
Field Details
-
ZERO_LENGTH_WHERE_FILTER_ARRAY
-
-
Method Details
-
of
-
from
-
copyFrom
-
fromInternal
-
withDeclaredBarriers
Description copied from interface:ConcurrencyControlDesignates the filter/selectable as declaring the specified barrier object(s).A barrier does not affect concurrency but imposes an ordering constraint for the filters or selectables that respect the same barrier. When a filter/selectable is marked as respecting a barrier object, it indicates that the respecting filter/selectable will be executed entirely after the filter/selectable declaring the barrier.
Each barrier must be unique and declared by at most one filter. Object
equalsandObject.hashCode()hashCode will be used to determine uniqueness and identification of barrier objects.- Specified by:
withDeclaredBarriersin interfaceConcurrencyControl<Filter>- Specified by:
withDeclaredBarriersin interfaceFilter- Parameters:
declaredBarriers- the unique barrier object identifiers- Returns:
- a new instance of T with the declaredBarriers applied
-
withRespectedBarriers
Description copied from interface:ConcurrencyControlSpecifies that the filter/selectable should respect the ordering constraints of the given barriers.Filters that define a barrier (using
ConcurrencyControl.withDeclaredBarriers(Object...)) will be executed entirely before filters/selectables that respect that barrier.It is an error to respect a barrier that has not already been defined per the natural left to right ordering of filters/selectables at the operation level. This is to minimize the risk of user error as the API is loosely typed.
Object
equalsandObject.hashCode()hashCode will be used to identify which barriers are respected.- Specified by:
withRespectedBarriersin interfaceConcurrencyControl<Filter>- Specified by:
withRespectedBarriersin interfaceFilter- Parameters:
respectedBarriers- the unique barrier object identifiers to respect- Returns:
- a new instance of T with the respects barrier rule applied
-
withSerial
Description copied from interface:ConcurrencyControlApplies serial concurrency control to the expression.The serial wrapped filter/selectable is guaranteed to process exactly the set of rows as if any prior filters/selectables were applied, but it will do so in a serial manner. If this is a filter, then the expression will not evaluate additional rows or skip rows that future filters may eliminate. Take care when selecting marking filters/selectables as serial, as the operation will not be able to take advantage of powerful optimizations.
- Concurrency impact: The expression will never be invoked concurrently with itself.
- Intra-expression ordering impact: Rows are evaluated sequentially in row set order.
-
Inter-expression ordering impact: For a filter, serial acts as an absolute reordering barrier, ensuring that no parts of a filter are executed out of order relative to this serial wrapper.
For selectables, additional ordering constraints are controlled by the value of the
QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERS. This is set by the propertyQueryTable.serialSelectImplicitBarriers(defaulting to the value ofQueryTable.statelessSelectByDefault).If
QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERSis false, then no additional ordering between selectable expressions is imposed. As with every select or update call, if column B references column A, then the necessary inputs from column A are evaluated before column B is evaluated. To impose further ordering constraints, use barriers.If
QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERSis true, then a serial selectable is an absolute barrier with respect to all other serial selectables. This prohibits serial selectables from being evaluated concurrently, permitting them to access global state. Selectables that are not serial may be reordered with respect to a serial selectable.
- Specified by:
withSerialin interfaceConcurrencyControl<Filter>- Specified by:
withSerialin interfaceFilter- Returns:
- a new instance of T with serial concurrency control applied.
-
getColumns
Get the columns required by this select filter.This filter must already be initialized before calling this method.
- Returns:
- the columns used as input by this select filter.
-
getColumnArrays
Get the array columns required by this select filter.This filter must already be initialized before calling this method.
- Returns:
- the columns used as array input by this select filter.
-
init
Initialize this filter given the table definition. If this filter has already been initialized, this should be a no-op, or optionally validate that the table definition is compatible with previous initialization.- Parameters:
tableDefinition- the definition of the table that will be filtered- ApiNote:
- Any
QueryLibrary,QueryScope, orQueryCompilerusage needs to be resolved within init. Implementations must be idempotent.
-
init
default void init(@NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull QueryCompilerRequestProcessor compilationProcessor) Initialize this select filter given the table definition- Parameters:
tableDefinition- the definition of the table that will be filteredcompilationProcessor- the processor to use for compilation- ApiNote:
- Any
QueryLibrary,QueryScope, orQueryCompilerusage needs to be resolved within init. Implementations must be idempotent.
-
beginOperation
Perform any operation-level initialization necessary using theTablethat will be filtered with this WhereFilter, e.g. gatheringdata indexes. This method will always be called exactly once, before gathering any dependencies or filtering data.- Parameters:
sourceTable- TheTablethat will be filtered with this WhereFilter- Returns:
- A
SafeCloseablethat will beclosedwhen the operation is complete, whether successful or not
-
validateSafeForRefresh
Validate that thisWhereFilteris safe to use in the context of the provided sourceTable.- Parameters:
sourceTable- the source table
-
filter
@NotNull @NotNull WritableRowSet filter(@NotNull @NotNull RowSet selection, @NotNull @NotNull RowSet fullSet, @NotNull @NotNull Table table, boolean usePrev) Filter selection to only matching rows.- Parameters:
selection- the indices that should be filtered. The selection must be a subset of fullSet, and may include rows that the engine determines need not be evaluated to produce the result. Implementations may not mutate orcloseselection.fullSet- the complete RowSet of the table to filter. The fullSet is used for calculating variables like "i" or "ii". Implementations may not mutate orclosefullSet.table- the table to filterusePrev- true if previous values should be used. Implementing previous value filtering is optional, and aWhereFilter.PreviousFilteringNotSupportedexception may be thrown. If a PreviousFiltering exception is thrown, then the caller must acquire the PeriodicUpdateGraph lock.- Returns:
- The subset of selection accepted by this filter; ownership passes to the caller
-
filterInverse
@NotNull default @NotNull WritableRowSet filterInverse(@NotNull @NotNull RowSet selection, @NotNull @NotNull RowSet fullSet, @NotNull @NotNull Table table, boolean usePrev) Filter selection to only non-matching rows.Defaults to
try (final WritableRowSet regular = filter(selection, fullSet, table, usePrev)) { return selection.minus(regular); }Implementations are encouraged to override this when they can provide more efficient implementations.
- Parameters:
selection- the indices that should be filtered. The selection must be a subset of fullSet, and may include rows that the engine determines need not be evaluated to produce the result. Implementations may not mutate orcloseselection.fullSet- the complete RowSet of the table to filter. The fullSet is used for calculating variables like "i" or "ii". Implementations may not mutate orclosefullSet.table- the table to filterusePrev- true if previous values should be used. Implementing previous value filtering is optional, and aWhereFilter.PreviousFilteringNotSupportedexception may be thrown. If a PreviousFiltering exception is thrown, then the caller must acquire the PeriodicUpdateGraph lock.- Returns:
- The subset of selection not accepted by this filter; ownership passes to the caller
-
filter
@FinalDefault default WritableRowSet filter(RowSet selection, RowSet fullSet, Table table, boolean usePrev, boolean invert) Delegates tofilter(RowSet, RowSet, Table, boolean)wheninvert == falseandfilterInverse(RowSet, RowSet, Table, boolean)wheninvert == true.- Parameters:
selection- the indices that should be filtered. The selection must be a subset of fullSet, and may include rows that the engine determines need not be evaluated to produce the result. Implementations may not mutate orcloseselection.fullSet- the complete RowSet of the table to filter. The fullSet is used for calculating variables like "i" or "ii". Implementations may not mutate orclosefullSet.table- the table to filterusePrev- true if previous values should be used. Implementing previous value filtering is optional, and aWhereFilter.PreviousFilteringNotSupportedexception may be thrown. If a PreviousFiltering exception is thrown, then the caller must acquire the PeriodicUpdateGraph lock.invert- if the filter should be inverted- Returns:
- The subset of selection; ownership passes to the caller
-
isSimpleFilter
boolean isSimpleFilter()- Returns:
- true if this is a filter that does not require any code execution, but rather is handled entirely within the database engine.
-
isRefreshing
default boolean isRefreshing()Is this filter refreshing?- Returns:
- if this filter is refreshing
-
permitParallelization
default boolean permitParallelization()- Returns:
- if this filter can be applied in parallel
-
setRecomputeListener
Set theWhereFilter.RecomputeListenerthat should be notified if results based on this WhereFilter must be recomputed.- Parameters:
result- TheWhereFilter.RecomputeListenerto notify
-
isAutomatedFilter
boolean isAutomatedFilter()The database system may automatically generate a filter, for example, when applying an ACL to a table. There are certain operations which may bypass these filters.This function returns whether this filter is automated.
- Returns:
- true if this filter was automatically applied by the database system. False otherwise.
-
setAutomatedFilter
void setAutomatedFilter(boolean value) The database system may automatically generate a filter, for example, when applying an ACL to a table. There are certain operations which may bypass these filters.This function indicates that this filter is automated.
- Parameters:
value- true if this filter was automatically applied by the database system. False otherwise.
-
canMemoize
default boolean canMemoize()Can this filter operation be memoized?- Returns:
- if this filter can be memoized
-
hasVirtualRowVariables
default boolean hasVirtualRowVariables()Returns true if this filter uses row virtual offset columns ofi,iiork. -
copy
WhereFilter copy()Create a copy of this WhereFilter.- Returns:
- an independent copy of this WhereFilter.
-
invert
Description copied from interface:FilterThe logical inversion ofthis. While logically equivalent toFilter.not(this), implementations of this method will return more specifically typed inversions where applicable. -
walk
- Specified by:
walkin interfaceExpression
-
walk
-
walk
This method calls the appropriatevisitormethod based on the type ofthisWhereFilter. This will invoke the most specificWhereFilter.Visitormethod available.- Type Parameters:
T- the return value type- Parameters:
visitor- the visitor- Returns:
- the value
-