|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.sql.SqlOperator org.eigenbase.sql.SqlFunction
public class SqlFunction
A SqlFunction
is a type of operator which has conventional
function-call syntax.
Field Summary | |
---|---|
private SqlFunctionCategory |
functionType
|
private RelDataType[] |
paramTypes
|
private SqlIdentifier |
sqlIdentifier
|
Fields inherited from class org.eigenbase.sql.SqlOperator |
---|
MaxPrec, NL |
Constructor Summary | |
---|---|
SqlFunction(SqlIdentifier sqlIdentifier,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker,
RelDataType[] paramTypes,
SqlFunctionCategory funcType)
Creates a placeholder SqlFunction for an invocation of a function with a possibly qualified name. |
|
SqlFunction(String name,
SqlKind kind,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker,
SqlFunctionCategory funcType)
Creates a new SqlFunction for a call to a builtin function. |
Method Summary | |
---|---|
RelDataType |
deriveType(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call)
Derives the type of a call to this operator. |
private RelDataType |
deriveType(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call,
boolean convertRowArgToColumnList)
|
SqlFunctionCategory |
getFunctionType()
|
SqlIdentifier |
getNameAsId()
|
RelDataType[] |
getParamTypes()
|
SqlIdentifier |
getSqlIdentifier()
|
SqlSyntax |
getSyntax()
Returns the syntactic type of this operator. |
boolean |
isQuantifierAllowed()
Returns whether this function allows a DISTINCT or
ALL quantifier. |
void |
unparse(SqlWriter writer,
SqlNode[] operands,
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final SqlFunctionCategory functionType
private final SqlIdentifier sqlIdentifier
private final RelDataType[] paramTypes
Constructor Detail |
---|
public SqlFunction(String name, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory funcType)
name
- of builtin 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 checkingfuncType
- categorization for functionpublic SqlFunction(SqlIdentifier sqlIdentifier, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, 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 categoryMethod Detail |
---|
public SqlSyntax getSyntax()
SqlOperator
getSyntax
in class SqlOperator
public SqlIdentifier getSqlIdentifier()
public SqlIdentifier getNameAsId()
public RelDataType[] getParamTypes()
public void unparse(SqlWriter writer, SqlNode[] operands, int leftPrec, int rightPrec)
SqlOperator
The default implementation of this method delegates to SqlSyntax.unparse(org.eigenbase.sql.SqlWriter, org.eigenbase.sql.SqlOperator, org.eigenbase.sql.SqlNode[], int, int)
.
unparse
in class SqlOperator
public SqlFunctionCategory getFunctionType()
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)
SqlOperator
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.eigenbase.sql.validate.SqlValidator, org.eigenbase.sql.validate.SqlValidatorScope)
;
but note that some sub-classes of SqlCall
never call this method.
validateCall
in class SqlOperator
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 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)
SqlOperator
This method is an intrinsic part of the validation process so, unlike
SqlOperator.inferReturnType(org.eigenbase.sql.SqlOperatorBinding)
, specific operators would not typically override
this method.
deriveType
in class SqlOperator
validator
- Validatorscope
- Scope of validationcall
- Call to this operator
private RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call, boolean convertRowArgToColumnList)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |