Beispiel #1
0
  protected void run(Pipeline pipeline, PTypeFamily typeFamily) throws IOException {
    String shakesInputPath = FileHelper.createTempCopyOf("shakes.txt");
    String maughamInputPath = FileHelper.createTempCopyOf("maugham.txt");

    PCollection<String> shakespeare = pipeline.readTextFile(shakesInputPath);
    PCollection<String> maugham = pipeline.readTextFile(maughamInputPath);
    PTable<String, Long> joined = join(shakespeare, maugham, typeFamily);
    Iterable<Pair<String, Long>> lines = joined.materialize();

    assertPassed(lines);

    pipeline.done();
  }
Beispiel #2
0
  public void run(Pipeline pipeline, PTypeFamily typeFamily) throws IOException {
    String shakesInputPath = FileHelper.createTempCopyOf("shakes.txt");

    PCollection<String> shakespeare = pipeline.readTextFile(shakesInputPath);
    Iterable<Pair<String, Collection<String>>> lines =
        listOfCharcters(shakespeare, typeFamily).materialize();

    boolean passed = false;
    for (Pair<String, Collection<String>> line : lines) {
      if (line.first().startsWith("yellow")) {
        passed = true;
        break;
      }
    }
    pipeline.done();
    assertTrue(passed);
  }