Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Pipeline p = Pipeline.create(options);
  2.  
  3. p.apply("read", HBaseIO.read().withConfiguration(configuration).withTableId(HBASE_TABLE))
  4. .apply(ParDo.of(new DoFn<Result, String>() {
  5. @ProcessElement
  6. public void processElement(ProcessContext c) {
  7. Result result = c.element();
  8. String rowkey = Bytes.toString(result.getRow());
  9. System.out.println("row key: " + rowkey);
  10. c.output(rowkey);
  11. }
  12. }))
  13. .apply(Count.<String>globally())
  14. .apply("FormatResults", MapElements.via(new SimpleFunction<Long, String>() {
  15. public String apply(Long element) {
  16. System.out.println("result: " + element.toString());
  17. return element.toString();
  18. }
  19. }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement