Class BinaryUtil


  • public class BinaryUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.nio.ByteBuffer truncateBinary​(java.nio.ByteBuffer input, int length)
      Truncates the input byte buffer to the given length.
      static Literal<java.nio.ByteBuffer> truncateBinaryMax​(Literal<java.nio.ByteBuffer> input, int length)
      Returns a byte buffer whose length is lesser than or equal to truncateLength and is greater than the given input
      static Literal<java.nio.ByteBuffer> truncateBinaryMin​(Literal<java.nio.ByteBuffer> input, int length)
      Returns a byte buffer whose length is lesser than or equal to truncateLength and is lower than the given input
      static java.nio.ByteBuffer truncateBinaryUnsafe​(java.nio.ByteBuffer value, int width)
      Truncates the input byte buffer to the given length.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • truncateBinary

        public static java.nio.ByteBuffer truncateBinary​(java.nio.ByteBuffer input,
                                                         int length)
        Truncates the input byte buffer to the given length.

        We allow for a length of zero so that rows with empty string can be evaluated. Partition specs still cannot be created with a length of zero due to a constraint when parsing column truncation specs in org.apache.iceberg.MetricsModes.

        Parameters:
        input - The ByteBuffer to be truncated
        length - The non-negative length to truncate input to
      • truncateBinaryUnsafe

        public static java.nio.ByteBuffer truncateBinaryUnsafe​(java.nio.ByteBuffer value,
                                                               int width)
        Truncates the input byte buffer to the given length.

        Unlike truncateBinary(ByteBuffer, int), this skips copying the input data.

        Parameters:
        value - The ByteBuffer to be truncated
        width - The non-negative length to truncate input to
      • truncateBinaryMin

        public static Literal<java.nio.ByteBuffer> truncateBinaryMin​(Literal<java.nio.ByteBuffer> input,
                                                                     int length)
        Returns a byte buffer whose length is lesser than or equal to truncateLength and is lower than the given input
      • truncateBinaryMax

        public static Literal<java.nio.ByteBuffer> truncateBinaryMax​(Literal<java.nio.ByteBuffer> input,
                                                                     int length)
        Returns a byte buffer whose length is lesser than or equal to truncateLength and is greater than the given input