@Override
 public void processElement(ProcessContext c) {
   String row =
       c.element().getKey() + " - " + c.element().getValue() + " @ " + c.timestamp().toString();
   System.out.println(row);
   c.output(row);
 }
Exemplo n.º 2
0
    @Override
    public void processElement(ProcessContext c) {
      KV<K, Iterable<InputT>> kv = c.element();
      K key = kv.getKey();

      c.output(KV.of(key, this.combineFn.apply(key, kv.getValue())));
    }
Exemplo n.º 3
0
    @Override
    public void processElement(ProcessContext c) {
      KV<K, AccumT> kv = c.element();
      K key = kv.getKey();
      OutputT output = this.combineFn.extractOutput(key, kv.getValue());

      c.output(KV.of(key, output));
    }
Exemplo n.º 4
0
    @Override
    public void processElement(ProcessContext c) {
      KV<K, Iterable<AccumT>> kv = c.element();
      K key = kv.getKey();
      AccumT accum = this.combineFn.mergeAccumulators(key, kv.getValue());

      c.output(KV.of(key, accum));
    }
Exemplo n.º 5
0
    @Override
    public void processElement(ProcessContext c) {
      KV<K, Iterable<InputT>> kv = c.element();
      K key = kv.getKey();
      AccumT accum = this.combineFn.createAccumulator(key);
      for (InputT input : kv.getValue()) {
        accum = this.combineFn.addInput(key, accum, input);
      }

      c.output(KV.of(key, accum));
    }
    @Override
    public void processElement(ProcessContext c) {
      if (c.element().trim().isEmpty()) {
        emptyLines.addValue(1L);
      }

      // Split the line into words.
      String[] words = c.element().split("[^a-zA-Z']+");

      // Output each word encountered into the output PCollection.
      for (String word : words) {
        if (!word.isEmpty()) {
          c.output(word);
        }
      }
    }
 @Override
 public void processElement(ProcessContext c) throws Exception {
   c.output(c.element());
 }
 @Override
 public void processElement(ProcessContext c) {
   KV<K, Iterable<RawUnionValue>> e = c.element();
   c.output(KV.of(e.getKey(), new CoGbkResult(schema, e.getValue())));
 }
 @Override
 public void processElement(ProcessContext c) {
   KV<K, ?> e = c.element();
   c.output(KV.of(e.getKey(), new RawUnionValue(index, e.getValue())));
 }
 @Override
 public void output(OutputT output) {
   synchronized (MultiThreadedIntraBundleProcessingDoFn.this) {
     context.output(output);
   }
 }