private List<ApplicableFunction> identifyApplicableFunctions(Collection<SqlFunction> candidates, List<TypeSignatureProvider> actualParameters, boolean allowCoercion) { ImmutableList.Builder<ApplicableFunction> applicableFunctions = ImmutableList.builder(); for (SqlFunction function : candidates) { Signature declaredSignature = function.getSignature(); Optional<Signature> boundSignature = new SignatureBinder(typeManager, declaredSignature, allowCoercion) .bind(actualParameters); if (boundSignature.isPresent()) { applicableFunctions.add(new ApplicableFunction(declaredSignature, boundSignature.get())); } } return applicableFunctions.build(); }
private List<ApplicableFunction> identifyApplicableFunctions(Collection<SqlFunction> candidates, List<TypeSignatureProvider> actualParameters, boolean allowCoercion) { ImmutableList.Builder<ApplicableFunction> applicableFunctions = ImmutableList.builder(); for (SqlFunction function : candidates) { Signature declaredSignature = function.getSignature(); Optional<Signature> boundSignature = new SignatureBinder(typeManager, declaredSignature, allowCoercion) .bind(actualParameters); if (boundSignature.isPresent()) { applicableFunctions.add(new ApplicableFunction(declaredSignature, boundSignature.get())); } } return applicableFunctions.build(); }
/** * One method is more specific than another if invocation handled by the first method could be passed on to the other one */ private boolean isMoreSpecificThan(ApplicableFunction left, ApplicableFunction right) { List<TypeSignatureProvider> resolvedTypes = fromTypeSignatures(left.getBoundSignature().getArgumentTypes()); Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, right.getDeclaredSignature(), true) .bindVariables(resolvedTypes); return boundVariables.isPresent(); }
/** * One method is more specific than another if invocation handled by the first method could be passed on to the other one */ private boolean isMoreSpecificThan(ApplicableFunction left, ApplicableFunction right) { List<TypeSignatureProvider> resolvedTypes = fromTypeSignatures(left.getBoundSignature().getArgumentTypes()); Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, right.getDeclaredSignature(), true) .bindVariables(resolvedTypes); return boundVariables.isPresent(); }
private Optional<BoundVariables> bindVariables() { assertNotNull(argumentTypes); SignatureBinder signatureBinder = new SignatureBinder(typeRegistry, function, allowCoercion); if (returnType == null) { return signatureBinder.bindVariables(argumentTypes); } else { return signatureBinder.bindVariables(argumentTypes, returnType); } } }
private Optional<BoundVariables> bindVariables() { assertNotNull(argumentTypes); SignatureBinder signatureBinder = new SignatureBinder(typeRegistry, function, allowCoercion); if (returnType == null) { return signatureBinder.bindVariables(argumentTypes); } else { return signatureBinder.bindVariables(argumentTypes, returnType); } } }
List<TypeSignatureProvider> argumentTypeSignatureProviders = fromTypeSignatures(signature.getArgumentTypes()); for (SqlFunction candidate : candidates) { Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, candidate.getSignature(), false) .bindVariables(argumentTypeSignatureProviders, returnType); if (boundVariables.isPresent()) { SignatureBinder binder = new SignatureBinder(typeManager, candidate.getSignature(), true); Optional<BoundVariables> boundVariables = binder.bindVariables(argumentTypeSignatureProviders, returnType); if (!boundVariables.isPresent()) {
List<TypeSignatureProvider> argumentTypeSignatureProviders = fromTypeSignatures(signature.getArgumentTypes()); for (SqlFunction candidate : candidates) { Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, candidate.getSignature(), false) .bindVariables(argumentTypeSignatureProviders, returnType); if (boundVariables.isPresent()) { SignatureBinder binder = new SignatureBinder(typeManager, candidate.getSignature(), true); Optional<BoundVariables> boundVariables = binder.bindVariables(argumentTypeSignatureProviders, returnType); if (!boundVariables.isPresent()) {