5455565758596061
return j.join(input.first(), j.join(input.second())); } }, strings()).materialize(); assertEquals(ImmutableList.of("one,[-5,10],[1,1],[2,-3]", "three,[0,-1]", "two,[1,7],[2,6],[4,5]"), ImmutableList.copyOf(lines)); p.done(); } }
4950515253545556575859
assertTrue(Iterables.isEmpty(p.emptyPCollection(Writables.strings()) .parallelDo(new SplitFn(), Writables.tableOf(Writables.strings(), Writables.longs())) .groupByKey() .combineValues(Aggregators.SUM_LONGS()) .materialize())); p.done(); } @Test public void testUnionWithEmptyMR() throws Exception { Pipeline p = new SparkPipeline("local", "empty");
6364656667686970717273
p.read(From.textFile(tempDir.copyResourceFileName("shakes.txt"))) .parallelDo(new SplitFn(), Writables.tableOf(Writables.strings(), Writables.longs()))) .groupByKey() .combineValues(Aggregators.SUM_LONGS()) .materialize())); p.done(); } @Test public void testUnionTableWithEmptyMR() throws Exception { Pipeline p = new SparkPipeline("local", "empty");
7677787980818283
p.read(From.textFile(tempDir.copyResourceFileName("shakes.txt"))) .parallelDo(new SplitFn(), Writables.tableOf(Writables.strings(), Writables.longs()))) .groupByKey() .combineValues(Aggregators.SUM_LONGS()) .materialize())); p.done(); } }