Interface ScalarFunction

    • Method Detail

      • isCalledOnNullInput

        boolean isCalledOnNullInput()
      • isMonotonic

        default boolean isMonotonic()
        Checks if the function is monotonic.

        A function is monotonic if it is either entirely nonincreasing or nondecreasing given an ordered set of inputs.

        Returns:
        true if the function is monotonic false otherwise.
      • execute

        java.nio.ByteBuffer execute​(Arguments arguments)
                             throws InvalidRequestException
        Applies this function to the specified arguments.
        Parameters:
        arguments - the input arguments for the function
        Returns:
        the result of applying this function to the arguments
        Throws:
        InvalidRequestException - if this function cannot not be applied to the arguments
      • partialApplication

        default ScalarFunction partialApplication​(ProtocolVersion protocolVersion,
                                                  java.util.List<java.nio.ByteBuffer> partialArguments)
        Does a partial application of the function. That is, given only some of the arguments of the function provided, return a new function that only expect the arguments not provided.

        To take an example, if you consider the function

             text foo(int a, text b, text c, int d)
         
        then foo.partialApplication([3, <ommitted>, 'bar', <omitted>]) will return a function bar of signature:
             text bar(text b, int d)
         
        and such that for any value of b and d, bar(b, d) == foo(3, b, 'bar', d).
        Parameters:
        protocolVersion - protocol version used for arguments
        partialArguments - a list of input arguments for the function where some arguments can be Function.UNRESOLVED. The input must be of size this.argsType().size(). For convenience, it is allowed both to pass a list with all arguments being Function.UNRESOLVED (the function is then returned directly) and with none of them unresolved (in which case, if the function is pure, it is computed and a dummy no-arg function returning the result is returned).
        Returns:
        a function corresponding to the partial application of this function to the arguments of partialArguments that are not Function.UNRESOLVED.