Class TruncateUtil
- java.lang.Object
-
- org.apache.iceberg.util.TruncateUtil
-
public class TruncateUtil extends java.lang.Object
Contains the logic for varioustruncate
transformations for various types.This utility class allows for the logic to be reused in different scenarios where input validation is done at different times either in org.apache.iceberg.transforms.Truncate and within defined SQL functions for different compute engines for usage in SQL.
In general, the inputs to the functions should have already been validated by the calling code, as different classes use truncate with different preprocessing. This generally means that the truncation width is positive and the value to truncate is non-null.
Thus, none of these utility functions validate their input. It is the responsibility of the calling code to validate input.
See also UnicodeUtil.truncateString(CharSequence, int) and
BinaryUtil.truncateBinaryUnsafe(ByteBuffer, int)
for similar methods for Strings and ByteBuffers.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte
truncateByte(int width, byte value)
static java.math.BigDecimal
truncateDecimal(java.math.BigInteger unscaledWidth, java.math.BigDecimal value)
static int
truncateInt(int width, int value)
static long
truncateLong(int width, long value)
static short
truncateShort(int width, short value)
-
-
-
Method Detail
-
truncateByte
public static byte truncateByte(int width, byte value)
-
truncateShort
public static short truncateShort(int width, short value)
-
truncateInt
public static int truncateInt(int width, int value)
-
truncateLong
public static long truncateLong(int width, long value)
-
truncateDecimal
public static java.math.BigDecimal truncateDecimal(java.math.BigInteger unscaledWidth, java.math.BigDecimal value)
-
-