Package org.apache.calcite.sql.validate
Class SqlUserDefinedTableMacro
- java.lang.Object
-
- org.apache.calcite.sql.SqlOperator
-
- org.apache.calcite.sql.SqlFunction
-
- org.apache.calcite.sql.validate.SqlUserDefinedTableMacro
-
public class SqlUserDefinedTableMacro extends SqlFunction
User-defined table macro.Created by the validator, after resolving a function call to a function defined in a Calcite schema.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SqlUserDefinedTableMacro.NonLiteralException
Thrown when a non-literal occurs in an argument to a user-defined table macro.
-
Field Summary
Fields Modifier and Type Field Description private TableMacro
tableMacro
-
Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
-
Constructor Summary
Constructors Constructor Description SqlUserDefinedTableMacro(SqlIdentifier opName, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, java.util.List<RelDataType> paramTypes, TableMacro tableMacro)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.Object
coerce(java.lang.Object o, RelDataType type)
static java.util.List<java.lang.Object>
convertArguments(RelDataTypeFactory typeFactory, java.util.List<SqlNode> operandList, Function function, SqlIdentifier opName, boolean failOnNonLiteral)
Converts arguments fromSqlNode
to java object format.java.util.List<java.lang.String>
getParamNames()
Returns a list of parameter names.TranslatableTable
getTable(RelDataTypeFactory typeFactory, java.util.List<SqlNode> operandList)
Returns the table in this UDF, or null if there is no table.private static java.lang.Object
getValue(SqlNode right)
-
Methods inherited from class org.apache.calcite.sql.SqlFunction
deriveType, getFunctionType, getNameAsId, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, unparse, validateCall, validateQuantifier
-
Methods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
-
-
-
-
Field Detail
-
tableMacro
private final TableMacro tableMacro
-
-
Constructor Detail
-
SqlUserDefinedTableMacro
public SqlUserDefinedTableMacro(SqlIdentifier opName, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, java.util.List<RelDataType> paramTypes, TableMacro tableMacro)
-
-
Method Detail
-
getParamNames
public java.util.List<java.lang.String> getParamNames()
Description copied from class:SqlFunction
Returns a list of parameter names.The default implementation returns
[arg0, arg1, ..., argN]
.- Overrides:
getParamNames
in classSqlFunction
-
getTable
public TranslatableTable getTable(RelDataTypeFactory typeFactory, java.util.List<SqlNode> operandList)
Returns the table in this UDF, or null if there is no table.
-
convertArguments
public static java.util.List<java.lang.Object> convertArguments(RelDataTypeFactory typeFactory, java.util.List<SqlNode> operandList, Function function, SqlIdentifier opName, boolean failOnNonLiteral)
Converts arguments fromSqlNode
to java object format.- Parameters:
typeFactory
- type factory used to convert the argumentsoperandList
- input argumentsfunction
- target function to get parameter types fromopName
- name of the operator to use in error messagefailOnNonLiteral
- true when conversion should fail on non-literal- Returns:
- converted list of arguments
-
getValue
private static java.lang.Object getValue(SqlNode right) throws SqlUserDefinedTableMacro.NonLiteralException
-
coerce
private static java.lang.Object coerce(java.lang.Object o, RelDataType type)
-
-