public AliasedOperatorConversion(final SqlOperatorConversion baseConversion, final String name) { if (!SqlKind.FUNCTION.contains(baseConversion.calciteOperator().getKind())) { throw new IAE("Base operator must be a function but was[%s]", baseConversion.calciteOperator().getKind()); } final SqlFunction baseFunction = (SqlFunction) baseConversion.calciteOperator(); this.baseConversion = baseConversion; this.name = name; this.operator = new SqlFunction( name, baseFunction.getKind(), baseFunction.getReturnTypeInference(), baseFunction.getOperandTypeInference(), baseFunction.getOperandTypeChecker(), baseFunction.getFunctionType() ); }
public void validateCall( SqlCall call, SqlValidatorScope scope) { final SqlOperator operator = call.getOperator(); if ((call.operandCount() == 0) && (operator.getSyntax() == SqlSyntax.FUNCTION_ID) && !call.isExpanded() && !conformance.allowNiladicParentheses()) { // For example, "LOCALTIME()" is illegal. (It should be // "LOCALTIME", which would have been handled as a // SqlIdentifier.) throw handleUnresolvedFunction(call, (SqlFunction) operator, ImmutableList.of(), null); } SqlValidatorScope operandScope = scope.getOperandScope(call); if (operator instanceof SqlFunction && ((SqlFunction) operator).getFunctionType() == SqlFunctionCategory.MATCH_RECOGNIZE && !(operandScope instanceof MatchRecognizeScope)) { throw newValidationError(call, Static.RESOURCE.functionMatchRecognizeOnly(call.toString())); } // Delegate validation to the operator. operator.validateCall(call, this, scope, operandScope); }
protected static SqlFunctionCategory category(SqlOperator operator) { if (operator instanceof SqlFunction) { return ((SqlFunction) operator).getFunctionType(); } else { return SqlFunctionCategory.SYSTEM; } }
protected static SqlFunctionCategory category(SqlOperator operator) { if (operator instanceof SqlFunction) { return ((SqlFunction) operator).getFunctionType(); } else { return SqlFunctionCategory.SYSTEM; } }
@Override public Void visitCall(RexCall call) { SqlOperator operator = call.getOperator(); if (operator instanceof SqlFunction && ((SqlFunction) operator).getFunctionType().isUserDefined()) { containsUsedDefinedFunction |= true; } return super.visitCall(call); }
@Override public Void visitCall(RexCall call) { SqlOperator operator = call.getOperator(); if (operator instanceof SqlFunction && ((SqlFunction) operator).getFunctionType().isUserDefined()) { containsUsedDefinedFunction |= true; } return super.visitCall(call); }
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; }
if (((SqlFunction) call.getOperator()).getFunctionType().isUserDefined()) { map.put("class", call.getOperator().getClass().getName());
if (((SqlFunction) call.getOperator()).getFunctionType().isUserDefined()) { map.put("class", call.getOperator().getClass().getName());
public AliasedOperatorConversion(final SqlOperatorConversion baseConversion, final String name) { if (!SqlKind.FUNCTION.contains(baseConversion.calciteOperator().getKind())) { throw new IAE("Base operator must be a function but was[%s]", baseConversion.calciteOperator().getKind()); } final SqlFunction baseFunction = (SqlFunction) baseConversion.calciteOperator(); this.baseConversion = baseConversion; this.name = name; this.operator = new SqlFunction( name, baseFunction.getKind(), baseFunction.getReturnTypeInference(), baseFunction.getOperandTypeInference(), baseFunction.getOperandTypeChecker(), baseFunction.getFunctionType() ); }
public RexNode convertFunction( SqlRexContext cx, SqlFunction fun, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final List<RexNode> exprs = convertExpressionList(cx, operands, SqlOperandTypeChecker.Consistency.NONE); if (fun.getFunctionType() == SqlFunctionCategory.USER_DEFINED_CONSTRUCTOR) { return makeConstructorCall(cx, fun, exprs); } RelDataType returnType = cx.getValidator().getValidatedNodeTypeIfKnown(call); if (returnType == null) { returnType = cx.getRexBuilder().deriveReturnType(fun, exprs); } return cx.getRexBuilder().makeCall(returnType, fun, exprs); }
public void validateCall( SqlCall call, SqlValidatorScope scope) { final SqlOperator operator = call.getOperator(); if ((call.operandCount() == 0) && (operator.getSyntax() == SqlSyntax.FUNCTION_ID) && !call.isExpanded() && !conformance.allowNiladicParentheses()) { // For example, "LOCALTIME()" is illegal. (It should be // "LOCALTIME", which would have been handled as a // SqlIdentifier.) throw handleUnresolvedFunction(call, (SqlFunction) operator, ImmutableList.of(), null); } SqlValidatorScope operandScope = scope.getOperandScope(call); if (operator instanceof SqlFunction && ((SqlFunction) operator).getFunctionType() == SqlFunctionCategory.MATCH_RECOGNIZE && !(operandScope instanceof MatchRecognizeScope)) { throw newValidationError(call, Static.RESOURCE.functionMatchRecognizeOnly(call.toString())); } // Delegate validation to the operator. operator.validateCall(call, this, scope, operandScope); }
public RexNode convertFunction( SqlRexContext cx, SqlFunction fun, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final List<RexNode> exprs = convertExpressionList(cx, operands, SqlOperandTypeChecker.Consistency.NONE); if (fun.getFunctionType() == SqlFunctionCategory.USER_DEFINED_CONSTRUCTOR) { return makeConstructorCall(cx, fun, exprs); } RelDataType returnType = cx.getValidator().getValidatedNodeTypeIfKnown(call); if (returnType == null) { returnType = cx.getRexBuilder().deriveReturnType(fun, exprs); } return cx.getRexBuilder().makeCall(returnType, fun, exprs); }
public void validateCall( SqlCall call, SqlValidatorScope scope) { final SqlOperator operator = call.getOperator(); if ((call.operandCount() == 0) && (operator.getSyntax() == SqlSyntax.FUNCTION_ID) && !call.isExpanded() && !conformance.allowNiladicParentheses()) { // For example, "LOCALTIME()" is illegal. (It should be // "LOCALTIME", which would have been handled as a // SqlIdentifier.) throw handleUnresolvedFunction(call, (SqlFunction) operator, ImmutableList.of(), null); } SqlValidatorScope operandScope = scope.getOperandScope(call); if (operator instanceof SqlFunction && ((SqlFunction) operator).getFunctionType() == SqlFunctionCategory.MATCH_RECOGNIZE && !(operandScope instanceof MatchRecognizeScope)) { throw newValidationError(call, Static.RESOURCE.functionMatchRecognizeOnly(call.toString())); } // Delegate validation to the operator. operator.validateCall(call, this, scope, operandScope); }
if (sqlFunction.getFunctionType().isUserDefinedNotSpecificFunction()) { final List<SqlOperator> list = new ArrayList<>(); opTab.lookupOperatorOverloads(sqlFunction.getSqlIdentifier(), sqlFunction.getFunctionType(), SqlSyntax.FUNCTION, list); for (SqlOperator operator2 : list) { if (operator2.isAggregator() && !operator2.requiresOver()) {
if (sqlFunction.getFunctionType().isUserDefinedNotSpecificFunction()) { final List<SqlOperator> list = new ArrayList<>(); opTab.lookupOperatorOverloads(sqlFunction.getSqlIdentifier(), sqlFunction.getFunctionType(), SqlSyntax.FUNCTION, list); for (SqlOperator operator2 : list) { if (operator2.isAggregator() && !operator2.requiresOver()) {
getNameAsId(), argTypes, argNames, getFunctionType(), SqlSyntax.FUNCTION, getKind()); try { && SqlUtil.matchRoutinesByParameterCount( validator.getOperatorTable(), getNameAsId(), argTypes, getFunctionType())) { if (getFunctionType() == SqlFunctionCategory.USER_DEFINED_CONSTRUCTOR) { return validator.deriveConstructorType(scope, call, this, function, argTypes);
getNameAsId(), argTypes, argNames, getFunctionType(), SqlSyntax.FUNCTION, getKind()); try { && SqlUtil.matchRoutinesByParameterCount( validator.getOperatorTable(), getNameAsId(), argTypes, getFunctionType())) { if (getFunctionType() == SqlFunctionCategory.USER_DEFINED_CONSTRUCTOR) { return validator.deriveConstructorType(scope, call, this, function, argTypes);
SqlFunction function = (SqlFunction) operator; if (function.getFunctionType().isSpecific()) { writer.keyword("SPECIFIC");
SqlFunction function = (SqlFunction) operator; if (function.getFunctionType().isSpecific()) { writer.keyword("SPECIFIC");