本文整理汇总了Java中org.apache.calcite.sql.SqlFunction.getKind方法的典型用法代码示例。如果您正苦于以下问题:Java SqlFunction.getKind方法的具体用法?Java SqlFunction.getKind怎么用?Java SqlFunction.getKind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.sql.SqlFunction
的用法示例。
在下文中一共展示了SqlFunction.getKind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DrillCalciteSqlFunctionWrapper
import org.apache.calcite.sql.SqlFunction; //导入方法依赖的package包/类
public DrillCalciteSqlFunctionWrapper(
final SqlFunction wrappedFunction,
final List<DrillFuncHolder> functions) {
super(wrappedFunction.getName(),
wrappedFunction.getSqlIdentifier(),
wrappedFunction.getKind(),
TypeInferenceUtils.getDrillSqlReturnTypeInference(
wrappedFunction.getName(),
functions),
wrappedFunction.getOperandTypeInference(),
Checker.ANY_CHECKER,
wrappedFunction.getParamTypes(),
wrappedFunction.getFunctionType());
this.operator = wrappedFunction;
}
示例2: visitCall
import org.apache.calcite.sql.SqlFunction; //导入方法依赖的package包/类
@Override
public RexNode visitCall(final RexCall call) {
RexNode newCall;
boolean[] update = {false};
List<RexNode> clonedOperands = visitList(call.operands, update);
if (update[0]) {
SqlOperator operator = call.getOperator();
boolean isSpecialCast = false;
if (operator instanceof SqlFunction) {
SqlFunction function = (SqlFunction) operator;
if (function.getKind() == SqlKind.CAST) {
if (call.operands.size() < 2) {
isSpecialCast = true;
}
}
}
final RelDataType newType;
if (!isSpecialCast) {
// TODO: ideally this only needs to be called if the result
// type will also change. However, since that requires
// support from type inference rules to tell whether a rule
// decides return type based on input types, for now all
// operators will be recreated with new type if any operand
// changed, unless the operator has "built-in" type.
newType = rexBuilder.deriveReturnType(operator, clonedOperands);
} else {
// Use the current return type when creating a new call, for
// operators with return type built into the operator
// definition, and with no type inference rules, such as
// cast function with less than 2 operands.
// TODO: Comments in RexShuttle.visitCall() mention other
// types in this category. Need to resolve those together
// and preferably in the base class RexShuttle.
newType = call.getType();
}
newCall = rexBuilder.makeCall(newType, operator, clonedOperands);
} else {
newCall = call;
}
if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) {
return createCaseExpression(nullIndicator, rexBuilder.constantNull(), newCall);
}
return newCall;
}
示例3: visitCall
import org.apache.calcite.sql.SqlFunction; //导入方法依赖的package包/类
@Override public RexNode visitCall(final RexCall call) {
RexNode newCall;
boolean[] update = {false};
List<RexNode> clonedOperands = visitList(call.operands, update);
if (update[0]) {
SqlOperator operator = call.getOperator();
boolean isSpecialCast = false;
if (operator instanceof SqlFunction) {
SqlFunction function = (SqlFunction) operator;
if (function.getKind() == SqlKind.CAST) {
if (call.operands.size() < 2) {
isSpecialCast = true;
}
}
}
final RelDataType newType;
if (!isSpecialCast) {
// TODO: ideally this only needs to be called if the result
// type will also change. However, since that requires
// support from type inference rules to tell whether a rule
// decides return type based on input types, for now all
// operators will be recreated with new type if any operand
// changed, unless the operator has "built-in" type.
newType = rexBuilder.deriveReturnType(operator, clonedOperands);
} else {
// Use the current return type when creating a new call, for
// operators with return type built into the operator
// definition, and with no type inference rules, such as
// cast function with less than 2 operands.
// TODO: Comments in RexShuttle.visitCall() mention other
// types in this category. Need to resolve those together
// and preferably in the base class RexShuttle.
newType = call.getType();
}
newCall =
rexBuilder.makeCall(
newType,
operator,
clonedOperands);
} else {
newCall = call;
}
if (projectPulledAboveLeftCorrelator && (nullIndicator != null)) {
return createCaseExpression(
nullIndicator,
rexBuilder.constantNull(),
newCall);
}
return newCall;
}