hasSideInput = sideInputs != null && !sideInputs.isEmpty(); } else if (transform instanceof Combine.Globally) { List<PCollectionView<?>> sideInputs = ((Combine.Globally<?, ?>) transform).getSideInputs(); hasSideInput = sideInputs != null && !sideInputs.isEmpty();
@Test public void testWithFanoutPreservesSideInputs() { final PCollectionView<Integer> view = pipeline.apply(Create.of(1)).apply(Sum.integersGlobally().asSingletonView()); Combine.Globally<Integer, String> combine = Combine.globally(new TestCombineFnWithContext(view)).withSideInputs(view).withFanout(1); assertEquals(Collections.singletonList(view), combine.getSideInputs()); } }
@Test public void testWithDefaultsPreservesSideInputs() { final PCollectionView<Integer> view = pipeline.apply(Create.of(1)).apply(Sum.integersGlobally().asSingletonView()); Combine.Globally<Integer, String> combine = Combine.globally(new TestCombineFnWithContext(view)) .withSideInputs(view) .withoutDefaults(); assertEquals(Collections.singletonList(view), combine.getSideInputs()); }