@Internal public final class CallBindingCallContext extends AbstractSqlCallContext
CallContext
backed by SqlCallBinding
. Compared to OperatorBindingCallContext
, this class is able to reorder arguments.AbstractSqlCallContext.LiteralValueAccessor
Constructor and Description |
---|
CallBindingCallContext(DataTypeFactory dataTypeFactory,
FunctionDefinition definition,
org.apache.calcite.sql.SqlCallBinding binding,
org.apache.calcite.rel.type.RelDataType outputType) |
Modifier and Type | Method and Description |
---|---|
List<DataType> |
getArgumentDataTypes()
Returns a resolved list of the call's argument types.
|
<T> Optional<T> |
getArgumentValue(int pos,
Class<T> clazz)
Returns the literal value of the argument at the given position, given that the argument is a
literal, is not null, and can be expressed as an instance of the provided class.
|
Optional<DataType> |
getOutputDataType()
Returns the inferred output data type of the function call.
|
boolean |
isArgumentLiteral(int pos)
Returns whether the argument at the given position is a value literal.
|
boolean |
isArgumentNull(int pos)
Returns
true if the argument at the given position is a literal and null ,
false otherwise. |
getDataTypeFactory, getFunctionDefinition, getLiteralValueAs, getName, isGroupedAggregation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fail, newValidationError
public CallBindingCallContext(DataTypeFactory dataTypeFactory, FunctionDefinition definition, org.apache.calcite.sql.SqlCallBinding binding, @Nullable org.apache.calcite.rel.type.RelDataType outputType)
public boolean isArgumentLiteral(int pos)
CallContext
public boolean isArgumentNull(int pos)
CallContext
true
if the argument at the given position is a literal and null
,
false
otherwise.
Use CallContext.isArgumentLiteral(int)
before to check if the argument is actually a literal.
public <T> Optional<T> getArgumentValue(int pos, Class<T> clazz)
CallContext
It supports conversions to default conversion classes of LogicalTypes
.
This method should not be called with other classes.
Use CallContext.isArgumentLiteral(int)
before to check if the argument is actually a literal.
public List<DataType> getArgumentDataTypes()
CallContext
public Optional<DataType> getOutputDataType()
CallContext
It does this by inferring the input argument data type using ArgumentTypeStrategy.inferArgumentType(CallContext, int, boolean)
of a wrapping call (if
available) where this function call is an argument. For example, takes_string(this_function(NULL))
would lead to a DataTypes.STRING()
because the
wrapping call expects a string argument.
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.