Class SpecialValueTransformer

  • All Implemented Interfaces:
    Serializable, RecordTransformer

    public class SpecialValueTransformer
    extends Object
    implements RecordTransformer
    The SpecialValueTransformer class will transform special values according to the following rules:
    • Negative zero (-0.0) should be converted to 0.0
    • NaN should be converted to default null

    NOTE: should put this after the DataTypeTransformer so that we already have the values complying with the schema before handling special values and before NullValueTransformer so that it transforms all the null values properly.

    See Also:
    Serialized Form
    • Constructor Detail

      • SpecialValueTransformer

        public SpecialValueTransformer​(Schema schema)
    • Method Detail

      • isNoOp

        public boolean isNoOp()
        Description copied from interface: RecordTransformer
        Returns true if the transformer is no-op (can be skipped), false otherwise.
        Specified by:
        isNoOp in interface RecordTransformer
      • transform

        public GenericRow transform​(GenericRow record)
        Description copied from interface: RecordTransformer
        Transforms a record based on some custom rules.
        Specified by:
        transform in interface RecordTransformer
        Parameters:
        record - Record to transform
        Returns:
        Transformed record, or null if the record does not follow certain rules.