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 class
Describes compatibility errors during casting.static class
Narrowing changes type without guarantee to preserve data.static interface
Interface for statically validating casts.static class
Widening 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 Number
castNumber
(Number value, Schema.TypeName input, Schema.TypeName output) static Row
static Object
castValue
(Object inputValue, Schema.FieldType input, Schema.FieldType output) expand
(PCollection<T> input) Override this method to specify how thisPTransform
should be expanded on the givenInputT
.static boolean
isDecimal
(Schema.TypeName type) Checks if type is decimal.static boolean
isIntegral
(Schema.TypeName type) Checks if type is integral.static <T> Cast
<T> static <T> Cast
<T> of
(Schema outputSchema, Cast.Validator validator) abstract Schema
abstract Cast.Validator
void
verifyCompatibility
(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:PTransform
Override this method to specify how thisPTransform
should be expanded on the givenInputT
.NOTE: This method should not be called directly. Instead apply the
PTransform
should be applied to theInputT
using theapply
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 classPTransform<PCollection<T>,
PCollection<Row>>
-
castRow
-
castNumber
-
castValue
-