Interface FunctionTyper

  • All Known Implementing Classes:
    FixedType, ObjectInputTyper, WidestInputTyper

    public interface FunctionTyper
    Determines the upper bound and result type of a ScalarValuedFunction. A number of implementations are provided which cover common use cases.

    A FunctionTyper is used as part of a function description to provide type checking of arguments and to determine the type of the output buffer. Because descriptions are serialized within the framework, implementations of FunctionTyper must also be serializable as JSON.

    See Also:
    ScalarValuedFunction, ScalarFunctionDescriptor
    • Method Detail

      • computeUpperBound

        ScalarTokenType computeUpperBound​(FunctionContext ctx)
        Calculates the upper bound for the function given the provided context.

        The context contains the upper bounds on the types of all arguments to the function. If a argument is not a subclass of ScalarValuedFunction, its type is null.

        Parameters:
        ctx - the context of the function being processed
        Returns:
        the upper bound on the function
      • computeResultType

        ScalarTokenType computeResultType​(FunctionContext ctx)
        Calculates the result type for the function given the provided context.

        The context contains the actual result types of all arguments to the function. If a argument is not a subclass of ScalarValuedFunction, its type is null.

        Parameters:
        ctx - the context of the function being processed
        Returns:
        the result type of the function