Class OrderedNumeric

java.lang.Object
org.apache.hadoop.hbase.types.OrderedBytesBase<Number>
org.apache.hadoop.hbase.types.OrderedNumeric
All Implemented Interfaces:
DataType<Number>

@Public public class OrderedNumeric extends OrderedBytesBase<Number>
An Number of arbitrary precision and variable-length encoding. The resulting length of encoded values is determined by the numerical (base 100) precision, not absolute value. Use this data type anywhere you would expect to use a DECIMAL type, a BigDecimal, a BigInteger, or any time you've parsed floating precision values from text. Built on OrderedBytes.encodeNumeric(PositionedByteRange, BigDecimal, Order).
  • Field Details

  • Constructor Details

    • OrderedNumeric

      public OrderedNumeric(Order order)
      Creates a new Number of arbitrary precision and variable-length encoding.
      Parameters:
      order - the Order to use
  • Method Details

    • encodedLength

      public int encodedLength(Number val)
      Description copied from interface: DataType
      Inform consumers how long the encoded byte[] will be.
      Parameters:
      val - The value to check.
      Returns:
      the number of bytes required to encode val.a
    • encodedClass

      Description copied from interface: DataType
      Inform consumers over what type this DataType operates. Useful when working with bare DataType instances.
    • decode

      Description copied from interface: DataType
      Read an instance of T from the buffer src.
      Parameters:
      src - the buffer containing the encoded value.
    • encode

      public int encode(PositionedByteRange dst, Number val)
      Description copied from interface: DataType
      Write instance val into buffer dst.
      Parameters:
      dst - the buffer containing the encoded value.
      val - the value to encode onto dst.
      Returns:
      number of bytes written.
    • decodeLong

      public long decodeLong(PositionedByteRange src)
      Read a long value from the buffer src.
      Parameters:
      src - the PositionedByteRange to read the long from
      Returns:
      the long read from the buffer
    • encodeLong

      public int encodeLong(PositionedByteRange dst, long val)
      Write instance val into buffer dst.
      Parameters:
      dst - the PositionedByteRange to write to
      val - the value to write to dst
      Returns:
      the number of bytes written
    • decodeDouble

      public double decodeDouble(PositionedByteRange src)
      Read a double value from the buffer src.
      Parameters:
      src - the PositionedByteRange to read the double from
      Returns:
      the double read from the buffer
    • encodeDouble

      public int encodeDouble(PositionedByteRange dst, double val)
      Write instance val into buffer dst.
      Parameters:
      dst - the PositionedByteRange to write to
      val - the value to write to dst
      Returns:
      the number of bytes written