Class Cast<T>
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
Set of utilities for casting rows between schemas.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescribes compatibility errors during casting.static classNarrowing changes type without guarantee to preserve data.static interfaceInterface for statically validating casts.static classWidening changes to type that can represent any possible value of the original type. -
Field Summary
Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NumbercastNumber(Number value, Schema.TypeName input, Schema.TypeName output) static Rowstatic ObjectcastValue(Object inputValue, Schema.FieldType input, Schema.FieldType output) expand(PCollection<T> input) Override this method to specify how thisPTransformshould be expanded on the givenInputT.static booleanisDecimal(Schema.TypeName type) Checks if type is decimal.static booleanisIntegral(Schema.TypeName type) Checks if type is integral.static <T> Cast<T> static <T> Cast<T> of(Schema outputSchema, Cast.Validator validator) abstract Schemaabstract Cast.ValidatorvoidverifyCompatibility(Schema inputSchema) static <T> Cast<T> Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
-
Constructor Details
-
Cast
public Cast()
-
-
Method Details
-
outputSchema
-
validator
-
of
-
widening
-
narrowing
-
isIntegral
Checks if type is integral. -
isDecimal
Checks if type is decimal. -
verifyCompatibility
-
expand
Description copied from class:PTransformOverride this method to specify how thisPTransformshould be expanded on the givenInputT.NOTE: This method should not be called directly. Instead apply the
PTransformshould be applied to theInputTusing theapplymethod.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:
expandin classPTransform<PCollection<T>,PCollection<Row>>
-
castRow
-
castNumber
-
castValue
-