public class SqlFunction extends SqlOperator
SqlFunction is a type of operator which has conventional
function-call syntax.kind, MDX_PRECEDENCE, NL| Modifier | Constructor and Description |
|---|---|
|
SqlFunction(SqlIdentifier sqlIdentifier,
@Nullable SqlReturnTypeInference returnTypeInference,
@Nullable SqlOperandTypeInference operandTypeInference,
@Nullable SqlOperandTypeChecker operandTypeChecker,
@Nullable List<RelDataType> paramTypes,
SqlFunctionCategory funcType)
Creates a placeholder SqlFunction for an invocation of a function with a
possibly qualified name.
|
protected |
SqlFunction(String name,
@Nullable SqlIdentifier sqlIdentifier,
SqlKind kind,
@Nullable SqlReturnTypeInference returnTypeInference,
@Nullable SqlOperandTypeInference operandTypeInference,
@Nullable SqlOperandTypeChecker operandTypeChecker,
@Nullable List<RelDataType> paramTypes,
SqlFunctionCategory category)
Deprecated.
|
protected |
SqlFunction(String name,
@Nullable SqlIdentifier sqlIdentifier,
SqlKind kind,
@Nullable SqlReturnTypeInference returnTypeInference,
@Nullable SqlOperandTypeInference operandTypeInference,
@Nullable SqlOperandTypeChecker operandTypeChecker,
SqlFunctionCategory category)
Internal constructor.
|
|
SqlFunction(String name,
SqlKind kind,
@Nullable SqlReturnTypeInference returnTypeInference,
@Nullable SqlOperandTypeInference operandTypeInference,
@Nullable SqlOperandTypeChecker operandTypeChecker,
SqlFunctionCategory category)
Creates a new SqlFunction for a call to a built-in function.
|
| Modifier and Type | Method and Description |
|---|---|
RelDataType |
deriveType(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call)
Derives the type of a call to this operator.
|
SqlFunctionCategory |
getFunctionType()
Return function category.
|
SqlIdentifier |
getNameAsId()
Returns the fully-qualified name of this operator.
|
List<String> |
getParamNames()
Deprecated.
|
@Nullable List<RelDataType> |
getParamTypes()
Deprecated.
|
@Nullable SqlIdentifier |
getSqlIdentifier()
Returns the fully-qualified name of function, or null for a built-in
function.
|
SqlSyntax |
getSyntax()
Returns the syntactic type of this operator, never null.
|
boolean |
isQuantifierAllowed()
Returns whether this function allows a
DISTINCT or
ALL quantifier. |
void |
unparse(SqlWriter writer,
SqlCall call,
int leftPrec,
int rightPrec)
Writes a SQL representation of a call to this operator to a writer,
including parentheses if the operators on either side are of greater
precedence.
|
void |
validateCall(SqlCall call,
SqlValidator validator,
SqlValidatorScope scope,
SqlValidatorScope operandScope)
Validates a call to this operator.
|
protected void |
validateQuantifier(SqlValidator validator,
SqlCall call)
Throws a validation error if a DISTINCT or ALL quantifier is present but
not allowed.
|
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperandspublic SqlFunction(String name, SqlKind kind, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory category)
name - Name of built-in functionkind - kind of operator implemented by functionreturnTypeInference - strategy to use for return type inferenceoperandTypeInference - strategy to use for parameter type inferenceoperandTypeChecker - strategy to use for parameter type checkingcategory - categorization for functionpublic SqlFunction(SqlIdentifier sqlIdentifier, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, @Nullable List<RelDataType> paramTypes, SqlFunctionCategory funcType)
sqlIdentifier - possibly qualified identifier for functionreturnTypeInference - strategy to use for return type inferenceoperandTypeInference - strategy to use for parameter type inferenceoperandTypeChecker - strategy to use for parameter type checkingparamTypes - array of parameter typesfuncType - function category@Deprecated protected SqlFunction(String name, @Nullable SqlIdentifier sqlIdentifier, SqlKind kind, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, @Nullable List<RelDataType> paramTypes, SqlFunctionCategory category)
protected SqlFunction(String name, @Nullable SqlIdentifier sqlIdentifier, SqlKind kind, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory category)
public SqlSyntax getSyntax()
SqlOperatorgetSyntax in class SqlOperatorpublic @Nullable SqlIdentifier getSqlIdentifier()
public SqlIdentifier getNameAsId()
SqlOperatorgetNameAsId in class SqlOperator@Deprecated public @Nullable List<RelDataType> getParamTypes()
SqlOperandMetadata.paramTypes(RelDataTypeFactory) on the
result of SqlOperator.getOperandTypeChecker().@Deprecated public List<String> getParamNames()
SqlOperandMetadata.paramNames() on the result of
SqlOperator.getOperandTypeChecker().public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
SqlOperatorThe default implementation of this method delegates to
SqlSyntax.unparse(org.apache.calcite.sql.SqlWriter, org.apache.calcite.sql.SqlOperator, org.apache.calcite.sql.SqlCall, int, int).
unparse in class SqlOperatorpublic SqlFunctionCategory getFunctionType()
@Pure public boolean isQuantifierAllowed()
DISTINCT or
ALL quantifier. The default is false; some aggregate
functions return true.public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope)
SqlOperatorThis method should not perform type-derivation or perform validation
related related to types. That is done later, by
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall). This method
should focus on structural validation.
A typical implementation of this method first validates the operands, then performs some operator-specific logic. The default implementation just validates the operands.
This method is the default implementation of SqlCall.validate(org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorScope);
but note that some sub-classes of SqlCall never call this method.
validateCall in class SqlOperatorcall - the call to this operatorvalidator - the active validatorscope - validator scopeoperandScope - validator scope in which to validate operands to this
call; usually equal to scope, but not always because
some operators introduce new scopesSqlNode.validateExpr(SqlValidator, SqlValidatorScope),
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall)protected void validateQuantifier(SqlValidator validator, SqlCall call)
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call)
SqlOperatorThis method is an intrinsic part of the validation process so, unlike
SqlOperator.inferReturnType(org.apache.calcite.sql.SqlOperatorBinding), specific operators would not typically override
this method.
deriveType in class SqlOperatorvalidator - Validatorscope - Scope of validationcall - Call to this operatorCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.