Package io.trino.metadata
Class SignatureBinder
java.lang.Object
io.trino.metadata.SignatureBinder
Determines whether, and how, a callsite matches a generic function signature.
Which is equivalent to finding assignments for the variables in the generic signature,
such that all of the function's declared parameters are super types of the corresponding
arguments, and also satisfy the declared constraints (such as a given type parameter must
bind to an orderable type)
This implementation has made assumptions. When any of the assumptions is not satisfied, it will fail loudly.
- A type cannot have both type parameter and literal parameter.
- A literal parameter cannot be used across types. see
checkNoLiteralVariableUsageAcrossTypes(TypeSignature, Map).
Here are some known implementation limitations:
- Binding signature
(decimal(x,2))booleanwith argumentsdecimal(1,0)fails. It should producedecimal(3,1).
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic SignatureapplyBoundVariables(Signature signature, FunctionBinding functionBinding, int arity) static TypeSignatureapplyBoundVariables(TypeSignature typeSignature, FunctionBinding functionBinding) static List<TypeSignature> applyBoundVariables(List<TypeSignature> typeSignatures, FunctionBinding functionBinding) bind(List<? extends TypeSignatureProvider> actualArgumentTypes) bind(List<? extends TypeSignatureProvider> actualArgumentTypes, Type actualReturnType) static FunctionBindingbindFunction(FunctionId functionId, Signature declaredSignature, BoundSignature boundSignature) booleancanBind(List<? extends TypeSignatureProvider> actualArgumentTypes) booleancanBind(List<? extends TypeSignatureProvider> actualArgumentTypes, TypeSignature actualReturnType)
-
Method Details
-
bind
-
bind
public Optional<Signature> bind(List<? extends TypeSignatureProvider> actualArgumentTypes, Type actualReturnType) -
canBind
-
canBind
public boolean canBind(List<? extends TypeSignatureProvider> actualArgumentTypes, TypeSignature actualReturnType) -
applyBoundVariables
public static Signature applyBoundVariables(Signature signature, FunctionBinding functionBinding, int arity) -
applyBoundVariables
public static List<TypeSignature> applyBoundVariables(List<TypeSignature> typeSignatures, FunctionBinding functionBinding) -
applyBoundVariables
public static TypeSignature applyBoundVariables(TypeSignature typeSignature, FunctionBinding functionBinding) -
bindFunction
public static FunctionBinding bindFunction(FunctionId functionId, Signature declaredSignature, BoundSignature boundSignature)
-