@PublicEvolving public final class ValueLiteralExpression extends Object implements ResolvedExpression
By design, this class can take any value described by a DataType
. However, it is
recommended to use instances with default conversion (see DataType.getConversionClass()
.
Equals/hashCode support of this expression depends on the equals/hashCode support of the value.
The data type can be extracted automatically from non-null values using value-based extraction
(see ValueDataTypeConverter
).
Symbols (enums extending from TableSymbol
) are considered as literal values.
Constructor and Description |
---|
ValueLiteralExpression(Object value) |
ValueLiteralExpression(Object value,
DataType dataType) |
Modifier and Type | Method and Description |
---|---|
<R> R |
accept(ExpressionVisitor<R> visitor) |
String |
asSummaryString()
Returns a string that summarizes this expression for printing to a console.
|
boolean |
equals(Object o) |
List<Expression> |
getChildren() |
DataType |
getOutputDataType()
Returns the data type of the computation result.
|
List<ResolvedExpression> |
getResolvedChildren() |
<T> Optional<T> |
getValueAs(Class<T> clazz)
Returns the value (excluding null) as an instance of the given class.
|
int |
hashCode() |
boolean |
isNull() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asSerializableString
public boolean isNull()
public <T> Optional<T> getValueAs(Class<T> clazz)
It supports conversions to default conversion classes of LogicalTypes
and additionally to BigDecimal
for all types of LogicalTypeFamily.NUMERIC
.
This method should not be called with other classes.
Note to implementers: Whenever we add a new class here, make sure to also update the
planner for supporting the class via CallContext.getArgumentValue(int, Class)
.
public DataType getOutputDataType()
ResolvedExpression
getOutputDataType
in interface ResolvedExpression
public List<ResolvedExpression> getResolvedChildren()
getResolvedChildren
in interface ResolvedExpression
public String asSummaryString()
Expression
asSummaryString
in interface Expression
public List<Expression> getChildren()
getChildren
in interface Expression
public <R> R accept(ExpressionVisitor<R> visitor)
accept
in interface Expression
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.