Class Cast.Widening

java.lang.Object
org.apache.beam.sdk.schemas.transforms.Cast.Widening
All Implemented Interfaces:
Serializable, Cast.Validator
Enclosing class:
Cast<T>

public static class Cast.Widening extends Object implements Cast.Validator
Widening changes to type that can represent any possible value of the original type.

Standard widening conversions:

  • BYTE to INT16, INT32, INT64, FLOAT, DOUBLE, DECIMAL
  • INT16 to INT32, INT64, FLOAT, DOUBLE, DECIMAL
  • INT32 to INT64, FLOAT, DOUBLE, DECIMAL
  • INT64 to FLOAT, DOUBLE, DECIMAL
  • FLOAT to DOUBLE, DECIMAL
  • DOUBLE to DECIMAL

Row widening:

  • wider schema to schema with a subset of fields
  • non-nullable fields to nullable fields

Widening doesn't lose information about the overall magnitude in following cases:

  • integral type to another integral type
  • BYTE or INT16 to FLOAT, DOUBLE or DECIMAL
  • INT32 to DOUBLE

Other conversions to may cause loss of precision.

See Also: