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
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.ByteBuffer
execute(Arguments arguments)
Applies this function to the specified arguments.boolean
isCalledOnNullInput()
default boolean
isMonotonic()
Checks if the function is monotonic.default ScalarFunction
partialApplication(ProtocolVersion protocolVersion, java.util.List<java.nio.ByteBuffer> partialArguments)
Does a partial application of the function.-
Methods inherited from interface org.apache.cassandra.cql3.AssignmentTestable
getCompatibleTypeIfKnown, testAssignment
-
Methods inherited from interface org.apache.cassandra.cql3.functions.Function
addFunctionsTo, argTypes, columnName, compare, isAggregate, isNative, isPure, name, newArguments, 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:
true
if the function is monotonicfalse
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)
thenfoo.partialApplication([3, <ommitted>, 'bar', <omitted>])
will return a functionbar
of signature:text bar(text b, int d)
and such that for any value ofb
andd
,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
partialArguments
that are notFunction.UNRESOLVED
.
-
-