Interface ScalarFunction
-
- All Superinterfaces:
AssignmentTestable,Function
- All Known Subinterfaces:
PartialScalarFunction
- All Known Implementing Classes:
FromJsonFct,JavaBasedUDFunction,NativeScalarFunction,TimeFcts.FloorDateFunction,TimeFcts.FloorTimestampFunction,TimeFcts.FloorTimeUuidFunction,ToJsonFct,TokenFct,UDFunction
public interface ScalarFunction extends Function
Determines a single output value based on any number of input values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable
AssignmentTestable.TestResult
-
-
Field Summary
-
Fields inherited from interface org.apache.cassandra.cql3.functions.Function
UNRESOLVED
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.nio.ByteBufferexecute(ProtocolVersion protocolVersion, java.util.List<java.nio.ByteBuffer> parameters)Applies this function to the specified parameter.booleanisCalledOnNullInput()default booleanisMonotonic()Checks if the function is monotonic.default ScalarFunctionpartialApplication(ProtocolVersion protocolVersion, java.util.List<java.nio.ByteBuffer> partialParameters)Does a partial application of the function.-
Methods inherited from interface org.apache.cassandra.cql3.AssignmentTestable
testAssignment
-
Methods inherited from interface org.apache.cassandra.cql3.functions.Function
addFunctionsTo, argTypes, columnName, compare, isAggregate, isNative, isPure, name, referencesUserType, returnType
-
-
-
-
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:
trueif the function is monotonicfalseotherwise.
-
execute
java.nio.ByteBuffer execute(ProtocolVersion protocolVersion, java.util.List<java.nio.ByteBuffer> parameters) throws InvalidRequestException
Applies this function to the specified parameter.- Parameters:
protocolVersion- protocol version used for parameters and return valueparameters- the input parameters- Returns:
- the result of applying this function to the parameter
- Throws:
InvalidRequestException- if this function cannot not be applied to the parameter
-
partialApplication
default ScalarFunction partialApplication(ProtocolVersion protocolVersion, java.util.List<java.nio.ByteBuffer> partialParameters)
Does a partial application of the function. That is, given only some of the parameters of the function provided, return a new function that only expect the parameters not provided.To take an example, if you consider the function
text foo(int a, text b, text c, int d)thenfoo.partialApplication([3, <ommitted>, 'bar', <omitted>])will return a functionbarof signature:text bar(text b, int d)and such that for any value ofbandd,bar(b, d) == foo(3, b, 'bar', d).- Parameters:
protocolVersion- protocol version used for parameterspartialParameters- a list of input parameters for the function where some parameters can beFunction.UNRESOLVED. The input must be of sizethis.argsType().size(). For convenience, it is allowed both to pass a list with all parameters beingFunction.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 parameters of
partialParametersthat are notFunction.UNRESOLVED.
-
-