Class WhereFilterDelegatingBase

All Implemented Interfaces:
ConcurrencyControl<Filter>, Expression, Filter, LogOutputAppendable, LivenessManager, LivenessNode, LivenessReferent, DependencyStreamProvider, WhereFilter, WhereFilterDelegating, Serializable
Direct Known Subclasses:
WhereFilterInvertedImpl, WhereFilterSerialImpl, WhereFilterWithDeclaredBarriersImpl, WhereFilterWithRespectedBarriersImpl

public abstract class WhereFilterDelegatingBase extends WhereFilterLivenessArtifactImpl implements WhereFilterDelegating, DependencyStreamProvider
See Also:
  • Field Details

  • Constructor Details

    • WhereFilterDelegatingBase

      protected WhereFilterDelegatingBase(WhereFilter filter)
  • Method Details

    • getDependencyStream

      public Stream<NotificationQueue.Dependency> getDependencyStream()
      Description copied from interface: DependencyStreamProvider
      Return a stream of dependencies for this object.
      Specified by:
      getDependencyStream in interface DependencyStreamProvider
    • getWrappedFilter

      public WhereFilter getWrappedFilter()
      Description copied from interface: WhereFilterDelegating
      Returns the filter to which this filter delegates.
      Specified by:
      getWrappedFilter in interface WhereFilterDelegating
    • getColumns

      public List<String> getColumns()
      Description copied from interface: WhereFilter
      Get the columns required by this select filter.

      This filter must already be initialized before calling this method.

      Specified by:
      getColumns in interface WhereFilter
      Returns:
      the columns used as input by this select filter.
    • getColumnArrays

      public List<String> getColumnArrays()
      Description copied from interface: WhereFilter
      Get the array columns required by this select filter.

      This filter must already be initialized before calling this method.

      Specified by:
      getColumnArrays in interface WhereFilter
      Returns:
      the columns used as array input by this select filter.
    • init

      public void init(@NotNull @NotNull TableDefinition tableDefinition)
      Description copied from interface: WhereFilter
      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.
      Specified by:
      init in interface WhereFilter
      Parameters:
      tableDefinition - the definition of the table that will be filtered
    • init

      public void init(@NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull QueryCompilerRequestProcessor compilationProcessor)
      Description copied from interface: WhereFilter
      Initialize this select filter given the table definition
      Specified by:
      init in interface WhereFilter
      Parameters:
      tableDefinition - the definition of the table that will be filtered
      compilationProcessor - the processor to use for compilation
    • beginOperation

      public SafeCloseable beginOperation(@NotNull @NotNull Table sourceTable)
      Description copied from interface: WhereFilter
      Perform any operation-level initialization necessary using the Table that will be filtered with this WhereFilter, e.g. gathering data indexes. This method will always be called exactly once, before gathering any dependencies or filtering data.
      Specified by:
      beginOperation in interface WhereFilter
      Parameters:
      sourceTable - The Table that will be filtered with this WhereFilter
      Returns:
      A SafeCloseable that will be closed when the operation is complete, whether successful or not
    • validateSafeForRefresh

      public void validateSafeForRefresh(BaseTable<?> sourceTable)
      Description copied from interface: WhereFilter
      Validate that this WhereFilter is safe to use in the context of the provided sourceTable.
      Specified by:
      validateSafeForRefresh in interface WhereFilter
      Parameters:
      sourceTable - the source table
    • filter

      @NotNull public @NotNull WritableRowSet filter(@NotNull @NotNull RowSet selection, @NotNull @NotNull RowSet fullSet, @NotNull @NotNull Table table, boolean usePrev)
      Description copied from interface: WhereFilter
      Filter selection to only matching rows.
      Specified by:
      filter in interface WhereFilter
      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 or close selection.
      fullSet - the complete RowSet of the table to filter. The fullSet is used for calculating variables like "i" or "ii". Implementations may not mutate or close fullSet.
      table - the table to filter
      usePrev - true if previous values should be used. Implementing previous value filtering is optional, and a WhereFilter.PreviousFilteringNotSupported exception 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 public @NotNull WritableRowSet filterInverse(@NotNull @NotNull RowSet selection, @NotNull @NotNull RowSet fullSet, @NotNull @NotNull Table table, boolean usePrev)
      Description copied from interface: WhereFilter
      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.

      Specified by:
      filterInverse in interface WhereFilter
      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 or close selection.
      fullSet - the complete RowSet of the table to filter. The fullSet is used for calculating variables like "i" or "ii". Implementations may not mutate or close fullSet.
      table - the table to filter
      usePrev - true if previous values should be used. Implementing previous value filtering is optional, and a WhereFilter.PreviousFilteringNotSupported exception 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
    • isSimpleFilter

      public boolean isSimpleFilter()
      Specified by:
      isSimpleFilter in interface WhereFilter
      Returns:
      true if this is a filter that does not require any code execution, but rather is handled entirely within the database engine.
    • isRefreshing

      public boolean isRefreshing()
      Description copied from interface: WhereFilter
      Is this filter refreshing?
      Specified by:
      isRefreshing in interface WhereFilter
      Returns:
      if this filter is refreshing
    • setRecomputeListener

      public void setRecomputeListener(WhereFilter.RecomputeListener result)
      Description copied from interface: WhereFilter
      Set the WhereFilter.RecomputeListener that should be notified if results based on this WhereFilter must be recomputed.
      Specified by:
      setRecomputeListener in interface WhereFilter
      Parameters:
      result - The WhereFilter.RecomputeListener to notify
    • isAutomatedFilter

      public boolean isAutomatedFilter()
      Description copied from interface: WhereFilter
      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.

      Specified by:
      isAutomatedFilter in interface WhereFilter
      Overrides:
      isAutomatedFilter in class WhereFilterLivenessArtifactImpl
      Returns:
      true if this filter was automatically applied by the database system. False otherwise.
    • setAutomatedFilter

      public void setAutomatedFilter(boolean value)
      Description copied from interface: WhereFilter
      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.

      Specified by:
      setAutomatedFilter in interface WhereFilter
      Overrides:
      setAutomatedFilter in class WhereFilterLivenessArtifactImpl
      Parameters:
      value - true if this filter was automatically applied by the database system. False otherwise.
    • canMemoize

      public boolean canMemoize()
      Description copied from interface: WhereFilter
      Can this filter operation be memoized?
      Specified by:
      canMemoize in interface WhereFilter
      Returns:
      if this filter can be memoized
    • permitParallelization

      public boolean permitParallelization()
      Description copied from interface: WhereFilter
      Returns true if this filter permits parallelism.

      No serial filters permit parallelization. A filter may not permit parallelism if the internal implementation does not support multiple WhereFilter.filter(RowSet, RowSet, Table, boolean) calls (e.g., some special filters that operate only on a rowset or have external state). ConditionFilters automatically determine whether they permit parallelization based on whether filters are stateless by default.

      Specified by:
      permitParallelization in interface WhereFilter
      Returns:
      if this filter can be applied in parallel
    • isSerial

      public boolean isSerial()
      Description copied from interface: WhereFilter
      Return true if this filter is a serial filter.

      A filter only returns true if the user explicitly marked the filter (or a filter that it wraps) as serial. A serial filter must not permit parallelism (as being executed in parallel would violate the contract of a serial filter).

      Specified by:
      isSerial in interface WhereFilter
      Returns:
      true if this filter is a serial filter.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object