java.lang.Object
org.apache.beam.sdk.transforms.PTransform<PCollection<T>,PCollection<Row>>
org.apache.beam.sdk.schemas.transforms.Cast<T>
All Implemented Interfaces:
Serializable, HasDisplayData

public abstract class Cast<T> extends PTransform<PCollection<T>,PCollection<Row>>
Set of utilities for casting rows between schemas.
See Also:
  • Constructor Details

    • Cast

      public Cast()
  • Method Details

    • outputSchema

      public abstract Schema outputSchema()
    • validator

      public abstract Cast.Validator validator()
    • of

      public static <T> Cast<T> of(Schema outputSchema, Cast.Validator validator)
    • widening

      public static <T> Cast<T> widening(Schema outputSchema)
    • narrowing

      public static <T> Cast<T> narrowing(Schema outputSchema)
    • isIntegral

      public static boolean isIntegral(Schema.TypeName type)
      Checks if type is integral.
    • isDecimal

      public static boolean isDecimal(Schema.TypeName type)
      Checks if type is decimal.
    • verifyCompatibility

      public void verifyCompatibility(Schema inputSchema)
    • expand

      public PCollection<Row> expand(PCollection<T> input)
      Description copied from class: PTransform
      Override this method to specify how this PTransform should be expanded on the given InputT.

      NOTE: This method should not be called directly. Instead apply the PTransform should be applied to the InputT using the apply method.

      Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).

      Specified by:
      expand in class PTransform<PCollection<T>,PCollection<Row>>
    • castRow

      public static Row castRow(Row input, Schema inputSchema, Schema outputSchema)
    • castNumber

      public static Number castNumber(Number value, Schema.TypeName input, Schema.TypeName output)
    • castValue

      public static Object castValue(Object inputValue, Schema.FieldType input, Schema.FieldType output)