Class SqlFunction
- Direct Known Subclasses:
MockSqlOperatorTable.BadTableFunction,MockSqlOperatorTable.CompareStringsOrNumericValues,MockSqlOperatorTable.CompositeFunction,MockSqlOperatorTable.DedupFunction,MockSqlOperatorTable.DynamicTypeFunction,MockSqlOperatorTable.InvalidTableFunction,MockSqlOperatorTable.MapFunction,MockSqlOperatorTable.MyFunction,MockSqlOperatorTable.NotATableFunction,MockSqlOperatorTable.RampFunction,MockSqlOperatorTable.RowFunction,MockSqlOperatorTable.ScoreTableFunction,MockSqlOperatorTable.SimilarlityTableFunction,MockSqlOperatorTable.SplitFunction,MockSqlOperatorTable.StructuredFunction,MockSqlOperatorTable.TableFunctionReturnTableFunction,MockSqlOperatorTable.TopNTableFunction,SqlAbstractTimeFunction,SqlAggFunction,SqlBaseContextVariable,SqlBasicFunction,SqlCastFunction,SqlCoalesceFunction,SqlConvertFunction,SqlCurrentDateFunction,SqlDatePartFunction,SqlExtractFunction,SqlGroupedWindowFunction,SqlJdbcFunctionCall,SqlJsonArrayFunction,SqlJsonDepthFunction,SqlJsonExistsFunction,SqlJsonKeysFunction,SqlJsonLengthFunction,SqlJsonModifyFunction,SqlJsonObjectFunction,SqlJsonPrettyFunction,SqlJsonQueryFunction,SqlJsonRemoveFunction,SqlJsonStorageSizeFunction,SqlJsonTypeFunction,SqlJsonValueFunction,SqlMatchFunction,SqlMonotonicUnaryFunction,SqlNullifFunction,SqlOverlayFunction,SqlPositionFunction,SqlRandIntegerFunction,SqlSubstringFunction,SqlTimestampAddFunction,SqlTranslate3Function,SqlTrimFunction,SqlTypeConstructorFunction,SqlUnresolvedFunction,SqlUserDefinedFunction,SqlUserDefinedTableMacro,SqlWindowTableFunction
SqlFunction is a type of operator which has conventional
function-call syntax.-
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSqlFunction(String name, @Nullable SqlIdentifier sqlIdentifier, SqlKind kind, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, @Nullable List<RelDataType> paramTypes, SqlFunctionCategory category) Deprecated.protectedSqlFunction(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.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. -
Method Summary
Modifier and TypeMethodDescriptionderiveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) Derives the type of a call to this operator.Return function category.Returns the fully-qualified name of this operator.Deprecated.@Nullable List<RelDataType>Deprecated.@Nullable SqlIdentifierReturns the fully-qualified name of function, or null for a built-in function.Returns the syntactic type of this operator, never null.booleanReturns whether this function allows aDISTINCTorALLquantifier.voidWrites a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.voidvalidateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) Validates a call to this operator.protected voidvalidateQuantifier(SqlValidator validator, SqlCall call) Throws a validation error if a DISTINCT or ALL quantifier is present but not allowed.Methods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getSqlCallFactory, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
-
Constructor Details
-
SqlFunction
public 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.- Parameters:
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 function
-
SqlFunction
public 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. This name must be resolved into either a built-in function or a user-defined function.- Parameters:
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
-
SqlFunction
@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) Deprecated. -
SqlFunction
protected SqlFunction(String name, @Nullable SqlIdentifier sqlIdentifier, SqlKind kind, @Nullable SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory category) Internal constructor.
-
-
Method Details
-
getSyntax
Description copied from class:SqlOperatorReturns the syntactic type of this operator, never null.- Specified by:
getSyntaxin classSqlOperator
-
getSqlIdentifier
Returns the fully-qualified name of function, or null for a built-in function. -
getNameAsId
Description copied from class:SqlOperatorReturns the fully-qualified name of this operator.- Overrides:
getNameAsIdin classSqlOperator
-
getParamTypes
Deprecated.UseSqlOperandMetadata.paramTypes(RelDataTypeFactory)on the result ofSqlOperator.getOperandTypeChecker(). -
getParamNames
Deprecated.UseSqlOperandMetadata.paramNames()on the result ofSqlOperator.getOperandTypeChecker(). -
unparse
Description copied from class:SqlOperatorWrites a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.The 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).- Overrides:
unparsein classSqlOperator
-
getFunctionType
Return function category. -
isQuantifierAllowed
@Pure public boolean isQuantifierAllowed()Returns whether this function allows aDISTINCTorALLquantifier. The default isfalse; some aggregate functions returntrue. -
validateCall
public void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) Description copied from class:SqlOperatorValidates a call to this operator.This 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 ofSqlCallnever call this method.- Overrides:
validateCallin classSqlOperator- Parameters:
call- 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 scopes- See Also:
-
validateQuantifier
Throws a validation error if a DISTINCT or ALL quantifier is present but not allowed. -
deriveType
Description copied from class:SqlOperatorDerives the type of a call to this operator.This 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.- Overrides:
deriveTypein classSqlOperator- Parameters:
validator- Validatorscope- Scope of validationcall- Call to this operator- Returns:
- Type of call
-