public class SqlCallBinding extends SqlOperatorBinding
SqlCallBinding
implements SqlOperatorBinding
by
analyzing to the operands of a SqlCall
with a SqlValidator
.Modifier and Type | Field and Description |
---|---|
private SqlCall |
call |
private static SqlCall |
DEFAULT_CALL |
private SqlValidatorScope |
scope |
private SqlValidator |
validator |
typeFactory
Constructor and Description |
---|
SqlCallBinding(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call)
Creates a call binding.
|
Modifier and Type | Method and Description |
---|---|
SqlCall |
getCall()
Returns the call node.
|
java.lang.String |
getColumnListParamInfo(int ordinal,
java.lang.String paramName,
java.util.List<java.lang.String> columnList)
Retrieves information about a column list parameter.
|
RelDataType |
getCursorOperand(int ordinal)
Returns the rowtype of the
ordinal th operand, which is a
cursor. |
int |
getGroupCount()
If the operator call occurs in an aggregate query, returns the number of
columns in the GROUP BY clause.
|
int |
getIntLiteralOperand(int ordinal)
Gets the integer value of a numeric literal operand.
|
int |
getOperandCount() |
<T> T |
getOperandLiteralValue(int ordinal,
java.lang.Class<T> clazz)
Gets the value of a literal operand.
|
SqlMonotonicity |
getOperandMonotonicity(int ordinal)
Gets the monotonicity of a bound operand.
|
RelDataType |
getOperandType(int ordinal)
Gets the type of a bound operand.
|
SqlValidatorScope |
getScope()
Returns the scope of the call.
|
java.lang.String |
getStringLiteralOperand(int ordinal)
Gets the string value of a string literal operand.
|
SqlValidator |
getValidator()
Returns the validator.
|
private boolean |
hasAssignment()
Returns whether arguments have name assignment.
|
boolean |
isOperandLiteral(int ordinal,
boolean allowCast)
Determines whether an operand is a literal.
|
boolean |
isOperandNull(int ordinal,
boolean allowCast)
Determines whether a bound operand is NULL.
|
CalciteException |
newError(Resources.ExInst<SqlValidatorException> e)
Wraps a validation error with context appropriate to this operator call.
|
CalciteException |
newValidationError(Resources.ExInst<SqlValidatorException> ex)
Constructs a new validation error for the call.
|
CalciteException |
newValidationSignatureError()
Constructs a new validation signature error for the call.
|
SqlNode |
operand(int i)
Returns a particular operand.
|
java.util.List<SqlNode> |
operands()
Returns the operands to a call permuted into the same order as the
formal parameters of the function.
|
SqlCall |
permutedCall()
Returns a call that is equivalent except that arguments have been
permuted into the logical order.
|
private java.util.List<SqlNode> |
permutedOperands(SqlCall call)
Returns the operands to a call permuted into the same order as the
formal parameters of the function.
|
collectOperandTypes, getOperandLiteralValue, getOperator, getTypeFactory, hasFilter
private static final SqlCall DEFAULT_CALL
private final SqlValidator validator
private final SqlValidatorScope scope
private final SqlCall call
public SqlCallBinding(SqlValidator validator, SqlValidatorScope scope, SqlCall call)
validator
- Validatorscope
- Scope of callcall
- Call nodepublic int getGroupCount()
SqlOperatorBinding
Returns 0 if the query is implicitly "GROUP BY ()" because of an aggregate expression. For example, "SELECT sum(sal) FROM emp".
Returns -1 if the query is not an aggregate query.
getGroupCount
in class SqlOperatorBinding
public SqlValidator getValidator()
public SqlValidatorScope getScope()
public SqlCall getCall()
public java.util.List<SqlNode> operands()
private boolean hasAssignment()
private java.util.List<SqlNode> permutedOperands(SqlCall call)
public SqlNode operand(int i)
public SqlCall permutedCall()
public SqlMonotonicity getOperandMonotonicity(int ordinal)
SqlOperatorBinding
getOperandMonotonicity
in class SqlOperatorBinding
ordinal
- zero-based ordinal of operand of interestpublic java.lang.String getStringLiteralOperand(int ordinal)
SqlOperatorBinding
getStringLiteralOperand
in class SqlOperatorBinding
ordinal
- zero-based ordinal of operand of interestpublic int getIntLiteralOperand(int ordinal)
SqlOperatorBinding
getIntLiteralOperand
in class SqlOperatorBinding
ordinal
- zero-based ordinal of operand of interestpublic <T> T getOperandLiteralValue(int ordinal, java.lang.Class<T> clazz)
SqlOperatorBinding
Cases:
NlsString
.
BigDecimal
.
SqlIntervalQualifier
getOperandLiteralValue
in class SqlOperatorBinding
ordinal
- zero-based ordinal of operand of interestclazz
- Desired valued typepublic boolean isOperandNull(int ordinal, boolean allowCast)
SqlOperatorBinding
This is only relevant for SQL validation.
isOperandNull
in class SqlOperatorBinding
ordinal
- zero-based ordinal of operand of interestallowCast
- whether to regard CAST(constant) as a constantpublic boolean isOperandLiteral(int ordinal, boolean allowCast)
SqlOperatorBinding
isOperandLiteral
in class SqlOperatorBinding
ordinal
- zero-based ordinal of operand of interestallowCast
- whether to regard CAST(literal) as a literalpublic int getOperandCount()
getOperandCount
in class SqlOperatorBinding
public RelDataType getOperandType(int ordinal)
SqlOperatorBinding
getOperandType
in class SqlOperatorBinding
ordinal
- zero-based ordinal of operand of interestpublic RelDataType getCursorOperand(int ordinal)
SqlOperatorBinding
ordinal
th operand, which is a
cursor.
This is only implemented for SqlCallBinding
.
getCursorOperand
in class SqlOperatorBinding
ordinal
- Ordinal of the operandpublic java.lang.String getColumnListParamInfo(int ordinal, java.lang.String paramName, java.util.List<java.lang.String> columnList)
SqlOperatorBinding
getColumnListParamInfo
in class SqlOperatorBinding
ordinal
- ordinal position of the column list parameterparamName
- name of the column list parametercolumnList
- returns a list of the column names that are referenced
in the column list parameterpublic CalciteException newError(Resources.ExInst<SqlValidatorException> e)
SqlOperatorBinding
newError
in class SqlOperatorBinding
e
- Validation error, not nullpublic CalciteException newValidationSignatureError()
public CalciteException newValidationError(Resources.ExInst<SqlValidatorException> ex)
ex
- underlying exceptionCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.