Package org.apache.druid.frame.field
Class TransformUtils
java.lang.Object
org.apache.druid.frame.field.TransformUtils
Utility methods to map the primitive numeric types into an equi-wide byte representation, such that the
given byte sequence preserves the ordering of the original type when done byte comparison.
Checkout
FrameReaderUtils.compareMemoryToByteArrayUnsigned(org.apache.datasketches.memory.Memory, long, long, byte[], int, int) for how this byte
comparison is performed.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubledetransformToDouble(long transformedBits, FrameType frameType) Inverse oftransformFromDouble(double, FrameType).static floatdetransformToFloat(int transformedBits, FrameType frameType) Inverse oftransformFromFloat(float, FrameType).static longdetransformToLong(long bits) Reverse thetransformFromLong(long)function.static longtransformFromDouble(double n, FrameType frameType) Transforms a double into a form where it can be compared as unsigned bytes without decoding.static inttransformFromFloat(float n, FrameType frameType) Transforms a float into a form where it can be compared as unsigned bytes without decoding.static longtransformFromLong(long n) Transforms a long into a form where it can be compared as unsigned bytes without decoding.
-
Constructor Details
-
TransformUtils
public TransformUtils()
-
-
Method Details
-
transformFromDouble
Transforms a double into a form where it can be compared as unsigned bytes without decoding.- Parameters:
n- the numberframeType- the output frame type; required because the floating point serialization format changed fromFrameType.ROW_BASED_V1toFrameType.ROW_BASED_V2.
-
detransformToDouble
Inverse oftransformFromDouble(double, FrameType). -
transformFromLong
public static long transformFromLong(long n) Transforms a long into a form where it can be compared as unsigned bytes without decoding. -
detransformToLong
public static long detransformToLong(long bits) Reverse thetransformFromLong(long)function. -
transformFromFloat
Transforms a float into a form where it can be compared as unsigned bytes without decoding.- Parameters:
n- the numberframeType- the output frame type; required because the floating point serialization format changed fromFrameType.ROW_BASED_V1toFrameType.ROW_BASED_V2.
-
detransformToFloat
Inverse oftransformFromFloat(float, FrameType).
-