Package org.apache.druid.query
Class TimewarpOperator<T>
java.lang.Object
org.apache.druid.query.TimewarpOperator<T>
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionTimewarpOperator(org.joda.time.Interval dataInterval, org.joda.time.Period period, org.joda.time.DateTime origin) -
Method Summary
Modifier and TypeMethodDescriptionprotected longcomputeOffset(long t, org.joda.time.DateTimeZone tz) Map time t into the last `period` ending within `dataInterval`postProcess(QueryRunner<T> baseQueryRunner) postProcess(QueryRunner<T> baseRunner, long now)
-
Constructor Details
-
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 Details
-
postProcess
- Specified by:
postProcessin interfacePostProcessingOperator<T>
-
postProcess
-
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
-