Class TransformUtils

java.lang.Object
org.apache.druid.frame.field.TransformUtils

public class TransformUtils extends Object
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 Details

    • TransformUtils

      public TransformUtils()
  • Method Details

    • transformFromDouble

      public static long transformFromDouble(double n, FrameType frameType)
      Transforms a double into a form where it can be compared as unsigned bytes without decoding.
      Parameters:
      n - the number
      frameType - the output frame type; required because the floating point serialization format changed from FrameType.ROW_BASED_V1 to FrameType.ROW_BASED_V2.
    • detransformToDouble

      public static double detransformToDouble(long transformedBits, FrameType 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 the transformFromLong(long) function.
    • transformFromFloat

      public static int transformFromFloat(float n, FrameType frameType)
      Transforms a float into a form where it can be compared as unsigned bytes without decoding.
      Parameters:
      n - the number
      frameType - the output frame type; required because the floating point serialization format changed from FrameType.ROW_BASED_V1 to FrameType.ROW_BASED_V2.
    • detransformToFloat

      public static float detransformToFloat(int transformedBits, FrameType frameType)