Class SlidingSizeWindowAccessStrategy
- java.lang.Object
-
- org.apache.iotdb.udf.api.customizer.strategy.SlidingSizeWindowAccessStrategy
-
- All Implemented Interfaces:
AccessStrategy
public class SlidingSizeWindowAccessStrategy extends java.lang.Object implements AccessStrategy
Used inUDTF.beforeStart(UDFParameters, UDTFConfigurations).When the access strategy of a UDTF is set to an instance of this class, the method
UDTF.transform(RowWindow, PointCollector)of the UDTF will be called to transform the original data. You need to override the method in your own UDTF class.Sliding size window is a kind of size-based window. Except for the last call, each call of the method
UDTF.transform(RowWindow, PointCollector)processes a window withwindowSizerows (aligned by time) of the original data and can generate any number of data points.Sample code:
{@code- See Also:
UDTF,UDTFConfigurations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.iotdb.udf.api.customizer.strategy.AccessStrategy
AccessStrategy.AccessStrategyType
-
-
Constructor Summary
Constructors Constructor Description SlidingSizeWindowAccessStrategy(int windowSize)Constructor.SlidingSizeWindowAccessStrategy(int windowSize, int slidingStep)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheck()Used by the system to check the access strategy.AccessStrategy.AccessStrategyTypegetAccessStrategyType()Returns the actual access strategy type.intgetSlidingStep()intgetWindowSize()
-
-
-
Constructor Detail
-
SlidingSizeWindowAccessStrategy
public SlidingSizeWindowAccessStrategy(int windowSize, int slidingStep)Constructor. You need to specify the number of rows in each sliding size window (except for the last window) and the sliding step to the next window.Example
Original data points (time, s1, s2):
- (1, 100, null )
- (2, 100, null )
- (3, 100, null )
- (4, 100, 'error')
- (5, 100, null )
- (6, 101, 'error')
- (7, 102, 'error')
- Parameters:
windowSize- the number of rows in each sliding size window (0 < windowSize)slidingStep- the number of rows between the first point of the next window and the first point of the current window (0 < slidingStep)
-
SlidingSizeWindowAccessStrategy
public SlidingSizeWindowAccessStrategy(int windowSize)
Constructor. You need to specify the number of rows in each sliding size window (except for the last window). The sliding step will be set to the same as the window size.- Parameters:
windowSize- the number of rows in each sliding size window (0 < windowSize)
-
-
Method Detail
-
check
public void check()
Description copied from interface:AccessStrategyUsed by the system to check the access strategy.- Specified by:
checkin interfaceAccessStrategy
-
getWindowSize
public int getWindowSize()
-
getSlidingStep
public int getSlidingStep()
-
getAccessStrategyType
public AccessStrategy.AccessStrategyType getAccessStrategyType()
Description copied from interface:AccessStrategyReturns the actual access strategy type.- Specified by:
getAccessStrategyTypein interfaceAccessStrategy- Returns:
- the actual access strategy type
-
-