@Override public void execute(Tuple tuple, BasicOutputCollector collector) { System.out.println(tuple); LOG.debug("Got tuple {}", tuple); collector.emit(tuple.getValues()); }
public void execute(Tuple input, BasicOutputCollector collector) { total = total.add(new BigInteger(input.getValues().get(1).toString())); collector.emit(tuple(total.toString())); //prints the total with low probability. if (RANDOM.nextInt(1000) > 995) { LOG.info("Running total = " + total); } }
public void execute(Tuple input, BasicOutputCollector collector) { String word = input.getStringByField("word"); int count; if (wordCounter.containsKey(word)) { count = wordCounter.get(word) + 1; wordCounter.put(word, wordCounter.get(word) + 1); } else { count = 1; } wordCounter.put(word, count); collector.emit(new Values(word, String.valueOf(count))); }
public void execute(Tuple input, BasicOutputCollector collector) { String word = input.getStringByField("word"); int count; if (wordCounter.containsKey(word)) { count = wordCounter.get(word) + 1; wordCounter.put(word, wordCounter.get(word) + 1); } else { count = 1; } wordCounter.put(word, count); collector.emit(new Values(word, String.valueOf(count))); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) { count = 0; } count++; counts.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple input, BasicOutputCollector collector) { String word = input.getStringByField("str"); int count; if (wordCounter.containsKey(word)) { count = wordCounter.get(word) + 1; } else { count = 1; } wordCounter.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) { count = 0; } count++; counts.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) { count = 0; } count++; counts.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) { count = 0; } count++; counts.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) { count = 0; } count++; counts.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String word = tuple.getString(0); Integer count = counts.get(word); if (count == null) { count = 0; } count++; counts.put(word, count); collector.emit(new Values(word, count)); }
@Override public void execute(Tuple input, BasicOutputCollector collector) { String name = input.getString(0); collector.emit(new Values(name, _conf.get(name))); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word, 1)); } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word, 1)); } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { Object id = tuple.getValue(0); String tweeter = tuple.getString(1); List<String> followers = FOLLOWERS_DB.get(tweeter); if (followers != null) { for (String follower : followers) { collector.emit(new Values(id, follower)); } } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { Object id = tuple.getValue(0); String url = tuple.getString(1); List<String> tweeters = TWEETERS_DB.get(url); if (tweeters != null) { for (String tweeter : tweeters) { collector.emit(new Values(id, tweeter)); } } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { sleep.simulateProcessAndExecTime(executorIndex, Time.nanoTime(), null , () -> { String sentence = tuple.getString(0); for (String word: sentence.split("\\s+")) { collector.emit(new Values(word, 1)); } }); }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String input = tuple.getString(1); collector.emit(new Values(tuple.getValue(0), input + "!")); }
@Override public void execute(Tuple input, BasicOutputCollector collector) { for (String word : splitSentence(input.getString(0))) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { String arg = tuple.getString(0); Object retInfo = tuple.getValue(1); collector.emit(new Values(arg + "!!!", retInfo)); }