Class Convert
- java.lang.Object
-
- org.apache.beam.sdk.schemas.transforms.Convert
-
@Experimental(SCHEMAS) public class Convert extends java.lang.Object
A set of utilities for converting between different objects supporting schemas.
-
-
Constructor Summary
Constructors Constructor Description Convert()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <OutputT> PTransform<PCollection<Row>,PCollection<OutputT>>
fromRows(java.lang.Class<OutputT> clazz)
Convert aPCollection
<Row> into aPCollection
<OutputT>.static <OutputT> PTransform<PCollection<Row>,PCollection<OutputT>>
fromRows(TypeDescriptor<OutputT> typeDescriptor)
Convert aPCollection
<Row> into aPCollection
<Row>.static <InputT,OutputT>
PTransform<PCollection<InputT>,PCollection<OutputT>>to(java.lang.Class<OutputT> clazz)
Convert aPCollection
<InputT> to aPCollection
<OutputT>.static <InputT,OutputT>
PTransform<PCollection<InputT>,PCollection<OutputT>>to(TypeDescriptor<OutputT> typeDescriptor)
Convert aPCollection
<InputT> to aPCollection
<OutputT>.static <InputT> PTransform<PCollection<InputT>,PCollection<Row>>
toRows()
Convert aPCollection
<InputT> into aPCollection
<Row>.
-
-
-
Method Detail
-
toRows
public static <InputT> PTransform<PCollection<InputT>,PCollection<Row>> toRows()
Convert aPCollection
<InputT> into aPCollection
<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(java.lang.Class<OutputT> clazz)
Convert aPCollection
<Row> into aPCollection
<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 aPCollection
<Row> into aPCollection
<Row>.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(java.lang.Class<OutputT> clazz)
Convert aPCollection
<InputT> to aPCollection
<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 aPCollection
<InputT> to aPCollection
<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.
-
-