use of edu.iu.dsc.tws.tset.sets.batch.KeyedCachedTSet in project twister2 by DSC-SPIDAL.
the class KeyedOperationsExample method execute.
@Override
public void execute(WorkerEnvironment workerEnv) {
BatchEnvironment env = TSetEnvironment.initBatch(workerEnv);
KeyedSourceTSet<String, Integer> kSource = dummyKeyedSource(env, COUNT, PARALLELISM);
KeyedDirectTLink<String, Integer> kDirect = kSource.keyedDirect();
kDirect.forEach(i -> LOG.info("d_fe: " + i.toString()));
KeyedCachedTSet<String, Integer> cache = kDirect.cache();
cache.keyedDirect().forEach(i -> LOG.info("c_d_fe: " + i.toString()));
cache.keyedReduce(Integer::sum).forEach(i -> LOG.info("c_r_fe: " + i.toString()));
cache.keyedGather().forEach((ApplyFunc<Tuple<String, Iterator<Integer>>>) data -> {
StringBuilder sb = new StringBuilder();
sb.append("c_g_fe: key ").append(data.getKey()).append("->");
while (data.getValue().hasNext()) {
sb.append(" ").append(data.getValue().next());
}
LOG.info(sb.toString());
});
}
Aggregations