Class ValueLiteralExpression
- java.lang.Object
-
- org.apache.flink.table.expressions.ValueLiteralExpression
-
- All Implemented Interfaces:
Expression,ResolvedExpression
@PublicEvolving public final class ValueLiteralExpression extends Object implements ResolvedExpression
Expression for constant literal values.By design, this class can take any value described by a
DataType. However, it is recommended to use instances with default conversion (seeDataType.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 Summary
Constructors Constructor Description ValueLiteralExpression(Object value)ValueLiteralExpression(Object value, DataType dataType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Raccept(ExpressionVisitor<R> visitor)StringasSerializableString()Returns a string that fully serializes this instance.StringasSummaryString()Returns a string that summarizes this expression for printing to a console.booleanequals(Object o)List<Expression>getChildren()DataTypegetOutputDataType()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.inthashCode()booleanisNull()StringtoString()
-
-
-
Method Detail
-
isNull
public boolean isNull()
-
getValueAs
public <T> Optional<T> getValueAs(Class<T> clazz)
Returns the value (excluding null) as an instance of the given class.It supports conversions to default conversion classes of
LogicalTypesand additionally toBigDecimalfor all types ofLogicalTypeFamily.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).
-
getOutputDataType
public DataType getOutputDataType()
Description copied from interface:ResolvedExpressionReturns the data type of the computation result.- Specified by:
getOutputDataTypein interfaceResolvedExpression
-
getResolvedChildren
public List<ResolvedExpression> getResolvedChildren()
- Specified by:
getResolvedChildrenin interfaceResolvedExpression
-
asSummaryString
public String asSummaryString()
Description copied from interface:ExpressionReturns a string that summarizes this expression for printing to a console. An implementation might skip very specific properties.- Specified by:
asSummaryStringin interfaceExpression- Returns:
- summary string of this expression for debugging purposes
-
asSerializableString
public String asSerializableString()
Description copied from interface:ResolvedExpressionReturns a string that fully serializes this instance. The serialized string can be used for storing the query in, for example, aCatalogas a view.- Specified by:
asSerializableStringin interfaceResolvedExpression- Returns:
- detailed string for persisting in a catalog
-
getChildren
public List<Expression> getChildren()
- Specified by:
getChildrenin interfaceExpression
-
accept
public <R> R accept(ExpressionVisitor<R> visitor)
- Specified by:
acceptin interfaceExpression
-
-