Interface ScalarFunction
- All Superinterfaces:
AssignmentTestable,Function
- All Known Subinterfaces:
PartialScalarFunction
- All Known Implementing Classes:
BytesConversionFcts.FromBlobFunction,BytesConversionFcts.ToBlobFunction,DefaultMaskingFunction,FromJsonFct,HashMaskingFunction,JavaBasedUDFunction,MaskingFunction,NativeScalarFunction,NullMaskingFunction,PartialMaskingFunction,ReplaceMaskingFunction,TimeFcts.FloorDateFunction,TimeFcts.FloorTimestampFunction,TimeFcts.FloorTimeUuidFunction,TimeFcts.TemporalConversionFunction,ToJsonFct,TokenFct,UDFunction
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
Modifier and TypeMethodDescriptionApplies this function to the specified arguments.booleandefault booleanChecks if the function is monotonic.default ScalarFunctionpartialApplication(ProtocolVersion protocolVersion, List<ByteBuffer> partialArguments) Does a partial application of the function.Methods inherited from interface org.apache.cassandra.cql3.AssignmentTestable
getCompatibleTypeIfKnown, testAssignmentMethods inherited from interface org.apache.cassandra.cql3.functions.Function
addFunctionsTo, argTypes, columnName, compare, isAggregate, isNative, isPure, name, newArguments, referencesUserType, returnType
-
Method Details
-
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
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, List<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)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 argumentspartialArguments- a list of input arguments for the function where some arguments can beFunction.UNRESOLVED. The input must be of sizethis.argsType().size(). For convenience, it is allowed both to pass a list with all arguments 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 arguments of
partialArgumentsthat are notFunction.UNRESOLVED.
-