Interface Literal<T>
- Type Parameters:
T
- The Java type of the value wrapped by aLiteral
- All Superinterfaces:
Serializable
-
Method Summary
Modifier and TypeMethodDescriptionReturn aComparator
for values.of
(boolean value) static Literal<ByteBuffer>
of
(byte[] value) of
(double value) of
(float value) of
(int value) of
(long value) static Literal<CharSequence>
of
(CharSequence value) static Literal<BigDecimal>
of
(BigDecimal value) static Literal<ByteBuffer>
of
(ByteBuffer value) <X> Literal<X>
Converts this literal to a literal of the given type.default ByteBuffer
Serializes the value wrapped by this literal to binary using the single-value serialization format described in the Iceberg table specification.value()
Returns the value wrapped by this literal.
-
Method Details
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
value
T value()Returns the value wrapped by this literal. -
to
Converts this literal to a literal of the given type.When a predicate is bound to a concrete data column, literals are converted to match the bound column's type. This conversion process is more narrow than a cast and is only intended for cases where substituting one type is a common mistake (e.g. 34 instead of 34L) or where this API avoids requiring a concrete class (e.g., dates).
If conversion to a target type is not supported, this method returns null.
This method may return
Literals.aboveMax()
orLiterals.belowMin()
when the target type is not as wide as the original type. These values indicate that the containing predicate can be simplified. For example, Integer.MAX_VALUE+1 converted to an int will result inaboveMax
and can simplify a < Integer.MAX_VALUE+1 toExpressions.alwaysTrue()
- Type Parameters:
X
- The Java type of value the new literal contains- Parameters:
type
- A primitiveType
- Returns:
- A literal of the given type or null if conversion was not valid
-
comparator
Comparator<T> comparator()Return aComparator
for values.- Returns:
- a comparator for T objects
-
toByteBuffer
Serializes the value wrapped by this literal to binary using the single-value serialization format described in the Iceberg table specification.- Returns:
- a ByteBuffer that contains the serialized literal value.
-