Search in sources :

Example 1 with Pair

use of org.apache.heron.api.Pair in project heron by twitter.

the class JoinOperator method execute.

@SuppressWarnings("unchecked")
@Override
public void execute(TupleWindow inputWindow) {
    Map<K, Pair<List<V1>, List<V2>>> joinMap = new HashMap<>();
    for (Tuple tuple : inputWindow.get()) {
        if (tuple.getSourceComponent().equals(leftComponent)) {
            V1 tup = (V1) tuple.getValue(0);
            if (tup != null) {
                addMapLeft(joinMap, tup);
            }
        } else {
            V2 tup = (V2) tuple.getValue(0);
            if (tup != null) {
                addMapRight(joinMap, tup);
            }
        }
    }
    evaluateJoinMap(joinMap, inputWindow);
}
Also used : HashMap(java.util.HashMap) Tuple(org.apache.heron.api.tuple.Tuple) Pair(org.apache.heron.api.Pair)

Example 2 with Pair

use of org.apache.heron.api.Pair in project heron by twitter.

the class InstanceUtils method prepareTimerEvents.

@SuppressWarnings("unchecked")
public static void prepareTimerEvents(ExecutorLooper looper, PhysicalPlanHelper helper) {
    Map<String, Pair<Duration, Runnable>> timerEvents = (Map<String, Pair<Duration, Runnable>>) helper.getTopologyContext().getTopologyConfig().get(Config.TOPOLOGY_TIMER_EVENTS);
    if (timerEvents != null) {
        for (Map.Entry<String, Pair<Duration, Runnable>> entry : timerEvents.entrySet()) {
            Duration duration = entry.getValue().getFirst();
            Runnable task = entry.getValue().getSecond();
            looper.registerPeriodicEvent(duration, task);
        }
    }
}
Also used : Duration(java.time.Duration) Map(java.util.Map) Pair(org.apache.heron.api.Pair)

Aggregations

Pair (org.apache.heron.api.Pair)2 Duration (java.time.Duration)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Tuple (org.apache.heron.api.tuple.Tuple)1