java.lang.Object
org.apache.beam.sdk.schemas.transforms.Convert

public class Convert extends Object
A set of utilities for converting between different objects supporting schemas.
  • Constructor Details

    • Convert

      public Convert()
  • Method Details

    • toRows

      public static <InputT> PTransform<PCollection<InputT>,PCollection<Row>> toRows()
      Convert a PCollection<InputT> into a PCollection<Row>.

      The input PCollection must have a schema attached. The output collection will have the same schema as the input.

    • fromRows

      public static <OutputT> PTransform<PCollection<Row>,PCollection<OutputT>> fromRows(Class<OutputT> clazz)
      Convert a PCollection<Row> into a PCollection<OutputT>.

      The output schema will be inferred using the schema registry. A schema must be registered for this type, or the conversion will fail.

    • fromRows

      public static <OutputT> PTransform<PCollection<Row>,PCollection<OutputT>> fromRows(TypeDescriptor<OutputT> typeDescriptor)
      Convert a PCollection<Row> into a PCollection<OutputT>.

      The output schema will be inferred using the schema registry. A schema must be registered for this type, or the conversion will fail.

    • to

      public static <InputT, OutputT> PTransform<PCollection<InputT>,PCollection<OutputT>> to(Class<OutputT> clazz)
      Convert a PCollection<InputT> to a PCollection<OutputT>.

      This function allows converting between two types as long as the two types have compatible schemas. Two schemas are said to be compatible if they recursively have fields with the same names, but possibly different orders. If the source schema can be unboxed to match the target schema (i.e. the source schema contains a single field that is compatible with the target schema), then conversion also succeeds.

    • to

      public static <InputT, OutputT> PTransform<PCollection<InputT>,PCollection<OutputT>> to(TypeDescriptor<OutputT> typeDescriptor)
      Convert a PCollection<InputT> to a PCollection<OutputT>.

      This function allows converting between two types as long as the two types have compatible schemas. Two schemas are said to be compatible if they recursively have fields with the same names, but possibly different orders. If the source schema can be unboxed to match the target schema (i.e. the source schema contains a single field that is compatible with the target schema), then conversion also succeeds.