@Override public SimplifiedIntervalList apply(DruidAggregationQuery<?> druidAggregationQuery) { LookbackQuery castQuery = (LookbackQuery) druidAggregationQuery; return Stream.concat( castQuery.getIntervals().stream(), castQuery.getIntervals().stream() .flatMap(interval -> castQuery.getLookbackOffsets().stream() .map(lookbackOffset -> getCohortInterval(interval, lookbackOffset)) ) ).collect(SimplifiedIntervalList.getCollector()); }
/** * Build a Map of Class to Function that should be used to get requestedIntervals from the DruidQuery. * * @return A Map that maps Class to a function that computes the requested intervals for a Druid query of * that particular Class */ protected Map<Class, RequestedIntervalsFunction> buildSigningFunctions() { DefaultingDictionary<Class, RequestedIntervalsFunction> signingFunctions = new DefaultingDictionary<>( druidAggregationQuery -> new SimplifiedIntervalList(druidAggregationQuery.getIntervals()) ); signingFunctions.put(LookbackQuery.class, new LookbackQuery.LookbackQueryRequestedIntervalsFunction()); return signingFunctions; }