@Internal public final class OperatorBindingCallContext extends AbstractSqlCallContext
CallContext
backed by SqlOperatorBinding
.AbstractSqlCallContext.LiteralValueAccessor
Constructor and Description |
---|
OperatorBindingCallContext(DataTypeFactory dataTypeFactory,
FunctionDefinition definition,
org.apache.calcite.sql.SqlOperatorBinding binding,
org.apache.calcite.rel.type.RelDataType returnRelDataType) |
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 OperatorBindingCallContext(DataTypeFactory dataTypeFactory, FunctionDefinition definition, org.apache.calcite.sql.SqlOperatorBinding binding, org.apache.calcite.rel.type.RelDataType returnRelDataType)
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.