Package org.apache.druid.query
Class TimewarpOperator<T>
- java.lang.Object
-
- org.apache.druid.query.TimewarpOperator<T>
-
- All Implemented Interfaces:
PostProcessingOperator<T>
public class TimewarpOperator<T> extends Object implements PostProcessingOperator<T>
TimewarpOperator is an example post-processing operator that maps current time to the latest period ending withing the specified data interval and truncates the query interval to discard data that would be mapped to the future.
-
-
Constructor Summary
Constructors Constructor Description TimewarpOperator(org.joda.time.Interval dataInterval, org.joda.time.Period period, org.joda.time.DateTime origin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
computeOffset(long t, org.joda.time.DateTimeZone tz)
Map time t into the last `period` ending within `dataInterval`QueryRunner<T>
postProcess(QueryRunner<T> baseQueryRunner)
QueryRunner<T>
postProcess(QueryRunner<T> baseRunner, long now)
-
-
-
Constructor Detail
-
TimewarpOperator
public TimewarpOperator(org.joda.time.Interval dataInterval, org.joda.time.Period period, org.joda.time.DateTime origin)
- Parameters:
dataInterval
- interval containing the actual dataperiod
- time will be offset by a multiple of the given period until there is at least a full period ending within the data intervalorigin
- origin to be used to align time periods (e.g. to determine on what day of the week a weekly period starts)
-
-
Method Detail
-
postProcess
public QueryRunner<T> postProcess(QueryRunner<T> baseQueryRunner)
- Specified by:
postProcess
in interfacePostProcessingOperator<T>
-
postProcess
public QueryRunner<T> postProcess(QueryRunner<T> baseRunner, long now)
-
computeOffset
protected long computeOffset(long t, org.joda.time.DateTimeZone tz)
Map time t into the last `period` ending within `dataInterval`- Parameters:
t
- the current time to be mapped into `dataInterval`- Returns:
- the offset between the mapped time and time t
-
-