Search in sources :

Example 1 with DummyIdList

use of com.codecademy.eventhub.list.DummyIdList in project EventHub by Codecademy.

the class EventHub method getUserIdsSets.

private List<Set<Integer>> getUserIdsSets(String groupByEventType, DateTime startDate, Filter eventFilter, int numDaysPerCohort, int numCohorts) {
    List<Set<Integer>> rows = Lists.newArrayListWithCapacity(numCohorts);
    for (int i = 0; i < numCohorts; i++) {
        DateTime currentStartDate = startDate.plusDays(i * numDaysPerCohort);
        DateTime currentEndDate = startDate.plusDays((i + 1) * numDaysPerCohort);
        List<Integer> userIdsList = Lists.newArrayList();
        Set<Integer> userIdsSet = Sets.newHashSet();
        EventIndex.Callback aggregateUserIdsCallback = new AggregateUserIds(eventStorage, userStorage, new DummyIdList(), eventFilter, TrueFilter.INSTANCE, userIdsList, userIdsSet);
        shardedEventIndex.enumerateEventIds(groupByEventType, currentStartDate.toString(DATE_TIME_FORMATTER), currentEndDate.toString(DATE_TIME_FORMATTER), aggregateUserIdsCallback);
        rows.add(userIdsSet);
    }
    return rows;
}
Also used : ContiguousSet(com.google.common.collect.ContiguousSet) Set(java.util.Set) DummyIdList(com.codecademy.eventhub.list.DummyIdList) ShardedEventIndex(com.codecademy.eventhub.index.ShardedEventIndex) UserEventIndex(com.codecademy.eventhub.index.UserEventIndex) EventIndex(com.codecademy.eventhub.index.EventIndex) DatedEventIndex(com.codecademy.eventhub.index.DatedEventIndex) DateTime(org.joda.time.DateTime)

Aggregations

DatedEventIndex (com.codecademy.eventhub.index.DatedEventIndex)1 EventIndex (com.codecademy.eventhub.index.EventIndex)1 ShardedEventIndex (com.codecademy.eventhub.index.ShardedEventIndex)1 UserEventIndex (com.codecademy.eventhub.index.UserEventIndex)1 DummyIdList (com.codecademy.eventhub.list.DummyIdList)1 ContiguousSet (com.google.common.collect.ContiguousSet)1 Set (java.util.Set)1 DateTime (org.joda.time.DateTime)1