Java Code Examples for org.apache.beam.sdk.io.GenerateSequence#from()

The following examples show how to use org.apache.beam.sdk.io.GenerateSequence#from() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SdkComponentsTest.java    From beam with Apache License 2.0 6 votes vote down vote up
/** Tests that trying to register a transform which has unregistered children throws. */
@Test
public void registerTransformWithUnregisteredChildren() throws IOException {
  Create.Values<Long> create = Create.of(1L, 2L, 3L);
  GenerateSequence createChild = GenerateSequence.from(0);

  PCollection<Long> pt = pipeline.apply(create);
  String userName = "my_transform";
  String childUserName = "my_transform/my_nesting";
  AppliedPTransform<?, ?, ?> transform =
      AppliedPTransform.of(userName, pipeline.begin().expand(), pt.expand(), create, pipeline);
  AppliedPTransform<?, ?, ?> childTransform =
      AppliedPTransform.of(
          childUserName, pipeline.begin().expand(), pt.expand(), createChild, pipeline);

  thrown.expect(IllegalArgumentException.class);
  thrown.expectMessage(childTransform.toString());
  components.registerPTransform(transform, Collections.singletonList(childTransform));
}
 
Example 2
Source File: BeamIOWrappingTest.java    From component-runtime with Apache License 2.0 4 votes vote down vote up
public BeamUnboundedSource(@Option("from") final long from) {
    super(GenerateSequence.from(from));
}
 
Example 3
Source File: PTransformTranslationTest.java    From beam with Apache License 2.0 4 votes vote down vote up
private static AppliedPTransform<?, ?, ?> generateSequence(Pipeline pipeline) {
  GenerateSequence sequence = GenerateSequence.from(0);
  PCollection<Long> pcollection = pipeline.apply(sequence);
  return AppliedPTransform.of(
      "Count", pipeline.begin().expand(), pcollection.expand(), sequence, pipeline);
}