Search in sources :

Example 1 with Pair

use of com.twitter.heron.api.Pair in project incubator-heron by apache.

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(com.twitter.heron.api.tuple.Tuple) Pair(com.twitter.heron.api.Pair)

Example 2 with Pair

use of com.twitter.heron.api.Pair in project incubator-heron by apache.

the class InstanceUtils method prepareTimerEvents.

@SuppressWarnings("unchecked")
public static void prepareTimerEvents(SlaveLooper 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(com.twitter.heron.api.Pair)

Aggregations

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