Class DownsampledWhereFilter
java.lang.Object
io.deephaven.engine.table.impl.select.WhereFilterImpl
io.deephaven.engine.table.impl.select.DownsampledWhereFilter
- All Implemented Interfaces:
ConcurrencyControl<Filter>,Expression,Filter,WhereFilter,Serializable
Utilities for downsampling non-ticking time series data within a query. The input table must be sorted by the
Instant column to be used for binning rows.
Usage is of the form:
downsampledX = x.where(new DownsampledWhereFilter("Timestamp", 5 * DateTimeUtils.MINUTE));
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum to use when selecting downsampling behavior:Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.select.WhereFilter
WhereFilter.PreviousFilteringNotSupported, WhereFilter.RecomputeListener, WhereFilter.Visitor<T> -
Field Summary
Fields inherited from interface io.deephaven.engine.table.impl.select.WhereFilter
ZERO_LENGTH_WHERE_FILTER_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionDownsampledWhereFilter(String column, long binSize) Creates aDownsampledWhereFilterwhich can be used in a .where clause to downsample time series rows.DownsampledWhereFilter(String column, long binSize, DownsampledWhereFilter.SampleOrder order) Creates aDownsampledWhereFilterwhich can be used in a .where clause to downsample time series rows. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Create a copy of this WhereFilter.@NotNull WritableRowSetFilter selection to only matching rows.Get the array columns required by this select filter.Get the columns required by this select filter.voidinit(@NotNull TableDefinition tableDefinition) Initialize this filter given the table definition.booleanbooleanReturns true if this filter permits parallelism.voidSet theWhereFilter.RecomputeListenerthat should be notified if results based on this WhereFilter must be recomputed.Methods inherited from class io.deephaven.engine.table.impl.select.WhereFilterImpl
isAutomatedFilter, setAutomatedFilterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.engine.table.impl.select.WhereFilter
beginOperation, canMemoize, filter, filterInverse, hasVirtualRowVariables, init, invert, isRefreshing, isSerial, validateSafeForRefresh, walk, walk, walk, withDeclaredBarriers, withRespectedBarriers, withSerial
-
Constructor Details
-
DownsampledWhereFilter
public DownsampledWhereFilter(String column, long binSize, DownsampledWhereFilter.SampleOrder order) Creates aDownsampledWhereFilterwhich can be used in a .where clause to downsample time series rows.- Parameters:
column-Instantcolumn to use for filtering.binSize- Size in nanoseconds for the time bins. Constants likeDateTimeUtils.MINUTEare typically used.order-DownsampledWhereFilter.SampleOrderto set desired behavior.
-
DownsampledWhereFilter
Creates aDownsampledWhereFilterwhich can be used in a .where clause to downsample time series rows.- Parameters:
column-Instantcolumn to use for filtering.binSize- Size in nanoseconds for the time bins. Constants likeDateTimeUtils.MINUTEare typically used.
-
-
Method Details
-
getColumns
Description copied from interface:WhereFilterGet 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
Description copied from interface:WhereFilterGet 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
Description copied from interface:WhereFilterInitialize 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
-
filter
@NotNull public @NotNull WritableRowSet filter(@NotNull @NotNull RowSet selection, @NotNull @NotNull RowSet fullSet, @NotNull @NotNull Table table, boolean usePrev) Description copied from interface:WhereFilterFilter 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
-
isSimpleFilter
public 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.
-
setRecomputeListener
Description copied from interface:WhereFilterSet theWhereFilter.RecomputeListenerthat should be notified if results based on this WhereFilter must be recomputed.- Parameters:
listener- TheWhereFilter.RecomputeListenerto notify
-
copy
Description copied from interface:WhereFilterCreate a copy of this WhereFilter.- Returns:
- an independent copy of this WhereFilter.
-
permitParallelization
public boolean permitParallelization()Description copied from interface:WhereFilterReturns 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 arestateless by default.- Returns:
- if this filter can be applied in parallel
-