Create (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

Class Create<T>

  • Type Parameters:
    T - the type of the elements of the resulting PCollection

    public class Create<T>
    extends Object
    Create<T> takes a collection of elements of type T known when the pipeline is constructed and returns a PCollection<T> containing the elements.

    Example of use:

     Pipeline p = ...;
     PCollection<Integer> pc = p.apply(Create.of(3, 4, 5).withCoder(BigEndianIntegerCoder.of()));
     Map<String, Integer> map = ...;
     PCollection<KV<String, Integer>> pt =

    Create can automatically determine the Coder to use if all elements have the same run-time class, and a default coder is registered for that class. See CoderRegistry for details on how defaults are determined.

    If a coder can not be inferred, Create.Values.withCoder(<T>) must be called explicitly to set the encoding of the resulting PCollection.

    A good use for Create is when a PCollection needs to be created without dependencies on files or other external entities. This is especially useful during testing.

    Caveat: Create only supports small in-memory datasets, particularly when submitting jobs to the Google Cloud Dataflow service.