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 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 data
      period - time will be offset by a multiple of the given period until there is at least a full period ending within the data interval
      origin - 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

      public QueryRunner<T> postProcess(QueryRunner<T> baseQueryRunner)
      Specified by:
      postProcess in interface PostProcessingOperator<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