Search in sources :

Example 1 with BoundVariables

use of io.crate.metadata.functions.BoundVariables in project crate by crate.

the class Functions method isMoreSpecificThan.

/**
 * One method is more specific than another if invocation handled by the first method
 * could be passed on to the other one.
 * Additionally possible variadic type signatures are taken into account,
 * an exact amount of declared type signatures is more specific than expanded variadic type signatures.
 */
private static boolean isMoreSpecificThan(ApplicableFunction left, ApplicableFunction right) {
    List<TypeSignature> resolvedTypes = left.getBoundSignature().getArgumentTypes();
    BoundVariables boundVariables = SignatureBinder.withPrecedenceOnly(right.getDeclaredSignature()).bindVariables(resolvedTypes);
    if (boundVariables == null) {
        return false;
    }
    int leftArgsCount = left.getDeclaredSignature().getArgumentTypes().size();
    int rightArgsCount = right.getDeclaredSignature().getArgumentTypes().size();
    return leftArgsCount >= rightArgsCount;
}
Also used : TypeSignature(io.crate.types.TypeSignature) BoundVariables(io.crate.metadata.functions.BoundVariables)

Aggregations

BoundVariables (io.crate.metadata.functions.BoundVariables)1 TypeSignature (io.crate.types.TypeSignature)1