private static RelDataType bestMatch(List<SqlFunction> sqlFunctions, int i, RelDataTypePrecedenceList precList) { RelDataType bestMatch = null; for (SqlFunction function : sqlFunctions) { List<RelDataType> paramTypes = function.getParamTypes(); if (paramTypes == null) { continue; } final RelDataType paramType = paramTypes.get(i); if (bestMatch == null) { bestMatch = paramType; } else { int c = precList.compareTypePrecedence( bestMatch, paramType); if (c < 0) { bestMatch = paramType; } } } return bestMatch; }
private static RelDataType bestMatch(List<SqlFunction> sqlFunctions, int i, RelDataTypePrecedenceList precList) { RelDataType bestMatch = null; for (SqlFunction function : sqlFunctions) { List<RelDataType> paramTypes = function.getParamTypes(); if (paramTypes == null) { continue; } final RelDataType paramType = paramTypes.get(i); if (bestMatch == null) { bestMatch = paramType; } else { int c = precList.compareTypePrecedence( bestMatch, paramType); if (c < 0) { bestMatch = paramType; } } } return bestMatch; }
sqlFunctions = sqlFunctions.stream() .filter(function -> { final List<RelDataType> paramTypes = function.getParamTypes(); if (paramTypes == null) { return false;
sqlFunctions = sqlFunctions.stream() .filter(function -> { final List<RelDataType> paramTypes = function.getParamTypes(); if (paramTypes == null) { return false;
/** Returns the operands to a call permuted into the same order as the * formal parameters of the function. */ public List<SqlNode> operands() { if (hasAssignment() && !(call.getOperator() instanceof SqlUnresolvedFunction)) { return permutedOperands(call); } else { final List<SqlNode> operandList = call.getOperandList(); if (call.getOperator() instanceof SqlFunction) { final List<RelDataType> paramTypes = ((SqlFunction) call.getOperator()).getParamTypes(); if (paramTypes != null && operandList.size() < paramTypes.size()) { final List<SqlNode> list = Lists.newArrayList(operandList); while (list.size() < paramTypes.size()) { list.add(DEFAULT_CALL); } return list; } } return operandList; } }
/** Returns the operands to a call permuted into the same order as the * formal parameters of the function. */ public List<SqlNode> operands() { if (hasAssignment() && !(call.getOperator() instanceof SqlUnresolvedFunction)) { return permutedOperands(call); } else { final List<SqlNode> operandList = call.getOperandList(); if (call.getOperator() instanceof SqlFunction) { final List<RelDataType> paramTypes = ((SqlFunction) call.getOperator()).getParamTypes(); if (paramTypes != null && operandList.size() < paramTypes.size()) { final List<SqlNode> list = Lists.newArrayList(operandList); while (list.size() < paramTypes.size()) { list.add(DEFAULT_CALL); } return list; } } return operandList; } }
function -> { List<RelDataType> paramTypes = Objects.requireNonNull(function).getParamTypes(); if (paramTypes == null) {
function -> { List<RelDataType> paramTypes = Objects.requireNonNull(function).getParamTypes(); if (paramTypes == null) {
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; }