@Test public void testBuild_ImplicitName() { Flow flow = Flow.create("TEST"); Dataset<String> dataset = Util.createMockDataset(flow, 3); Dataset<String> uniq = Distinct.of(dataset).output(); Distinct distinct = (Distinct) flow.operators().iterator().next(); assertEquals("Distinct", distinct.getName()); }
@Test public void testDistinctOnBatchWithoutWindowingLabels() throws Exception { Flow flow = Flow.create("Test"); Dataset<String> lines = flow.createInput(ListDataSource.bounded( asList("one two three four", "one two three", "one two", "one"))); // expand it to words Dataset<String> words = FlatMap.of(lines) .using(toWords(w -> w)) .output(); Dataset<String> output = Distinct.of(words).output(); ListDataSink<String> out = ListDataSink.get(); output.persist(out); executor.submit(flow).get(); DatasetAssert.unorderedEquals( out.getOutputs(), "four", "one", "three", "two"); }
public Dataset<T> distinct() { return new Dataset<>(Distinct.of(this.wrap).output()); }
@Override protected Dataset<Integer> getOutput(Dataset<Integer> input) { return Distinct.of(input).output(); }
@Override protected Dataset<Integer> getOutput(Dataset<Integer> input) { return Distinct.of(input).output(); }