public abstract class UDFunction extends AbstractFunction implements ScalarFunction, SchemaElement
AssignmentTestable.TestResult
SchemaElement.SchemaElementType
Modifier and Type | Field and Description |
---|---|
protected TypeCodec<java.lang.Object>[] |
argCodecs |
protected java.util.List<ColumnIdentifier> |
argNames |
protected java.lang.String |
body |
protected boolean |
calledOnNullInput |
protected java.lang.String |
language |
protected static org.slf4j.Logger |
logger |
protected TypeCodec<java.lang.Object> |
returnCodec |
protected UDFContext |
udfContext |
argTypes, name, returnType
UNRESOLVED
NAME_COMPARATOR
Modifier | Constructor and Description |
---|---|
protected |
UDFunction(FunctionName name,
java.util.List<ColumnIdentifier> argNames,
java.util.List<AbstractType<?>> argTypes,
AbstractType<?> returnType,
boolean calledOnNullInput,
java.lang.String language,
java.lang.String body) |
protected |
UDFunction(FunctionName name,
java.util.List<ColumnIdentifier> argNames,
java.util.List<AbstractType<?>> argTypes,
DataType[] argDataTypes,
AbstractType<?> returnType,
DataType returnDataType,
boolean calledOnNullInput,
java.lang.String language,
java.lang.String body) |
Modifier and Type | Method and Description |
---|---|
java.util.List<ColumnIdentifier> |
argNames() |
static void |
assertUdfsEnabled(java.lang.String language) |
java.lang.String |
body() |
java.util.Optional<Difference> |
compare(Function function) |
protected java.lang.Object |
compose(ProtocolVersion protocolVersion,
int argIndex,
java.nio.ByteBuffer value)
Used by UDF implementations (both Java code generated by
JavaBasedUDFunction
and script executor ScriptBasedUDFunction ) to convert the C*
serialized representation to the Java object representation. |
protected static java.lang.Object |
compose(TypeCodec<java.lang.Object>[] codecs,
ProtocolVersion protocolVersion,
int argIndex,
java.nio.ByteBuffer value) |
static UDFunction |
create(FunctionName name,
java.util.List<ColumnIdentifier> argNames,
java.util.List<AbstractType<?>> argTypes,
AbstractType<?> returnType,
boolean calledOnNullInput,
java.lang.String language,
java.lang.String body) |
static UDFunction |
createBrokenFunction(FunctionName name,
java.util.List<ColumnIdentifier> argNames,
java.util.List<AbstractType<?>> argTypes,
AbstractType<?> returnType,
boolean calledOnNullInput,
java.lang.String language,
java.lang.String body,
InvalidRequestException reason)
It can happen that a function has been declared (is listed in the scheam) but cannot
be loaded (maybe only on some nodes).
|
protected java.nio.ByteBuffer |
decompose(ProtocolVersion protocolVersion,
java.lang.Object value)
Used by UDF implementations (both Java code generated by
JavaBasedUDFunction
and script executor ScriptBasedUDFunction ) to convert the Java
object representation for the return value to the C* serialized representation. |
protected static java.nio.ByteBuffer |
decompose(TypeCodec<java.lang.Object> codec,
ProtocolVersion protocolVersion,
java.lang.Object value) |
SchemaElement.SchemaElementType |
elementType()
Return the schema element type
|
boolean |
equals(java.lang.Object o) |
java.nio.ByteBuffer |
execute(ProtocolVersion protocolVersion,
java.util.List<java.nio.ByteBuffer> parameters)
Applies this function to the specified parameter.
|
protected abstract java.lang.Object |
executeAggregateUserDefined(ProtocolVersion protocolVersion,
java.lang.Object firstParam,
java.util.List<java.nio.ByteBuffer> parameters) |
java.lang.Object |
executeForAggregate(ProtocolVersion protocolVersion,
java.lang.Object firstParam,
java.util.List<java.nio.ByteBuffer> parameters)
Like
ScalarFunction.execute(ProtocolVersion, List) but the first parameter is already in non-serialized form. |
protected abstract java.nio.ByteBuffer |
executeUserDefined(ProtocolVersion protocolVersion,
java.util.List<java.nio.ByteBuffer> parameters) |
protected abstract java.util.concurrent.ExecutorService |
executor() |
int |
hashCode() |
boolean |
isAggregate()
Checks whether the function is an aggregate function or not.
|
boolean |
isCallableWrtNullable(java.util.List<java.nio.ByteBuffer> parameters) |
boolean |
isCalledOnNullInput() |
boolean |
isNative()
Checks whether the function is a native/hard coded one or not.
|
boolean |
isPure()
Checks whether the function is a pure function (as in doesn't depend on, nor produces side effects) or not.
|
java.lang.String |
language() |
boolean |
referencesUserType(java.nio.ByteBuffer name) |
java.lang.String |
toCqlString(boolean withInternals,
boolean ifNotExists)
Returns a CQL representation of this element
|
static UDFunction |
tryCreate(FunctionName name,
java.util.List<ColumnIdentifier> argNames,
java.util.List<AbstractType<?>> argTypes,
AbstractType<?> returnType,
boolean calledOnNullInput,
java.lang.String language,
java.lang.String body) |
UDFunction |
withUpdatedUserType(UserType udt) |
addFunctionsTo, argTypes, argumentsList, columnName, elementKeyspace, elementName, name, returnType, testAssignment, toCqlString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isMonotonic, partialApplication
addFunctionsTo, argTypes, columnName, name, returnType
testAssignment
elementKeyspace, elementKeyspaceQuotedIfNeeded, elementName, elementNameQuotedIfNeeded
protected static final org.slf4j.Logger logger
protected final java.util.List<ColumnIdentifier> argNames
protected final java.lang.String language
protected final java.lang.String body
protected final TypeCodec<java.lang.Object>[] argCodecs
protected final TypeCodec<java.lang.Object> returnCodec
protected final boolean calledOnNullInput
protected final UDFContext udfContext
protected UDFunction(FunctionName name, java.util.List<ColumnIdentifier> argNames, java.util.List<AbstractType<?>> argTypes, AbstractType<?> returnType, boolean calledOnNullInput, java.lang.String language, java.lang.String body)
protected UDFunction(FunctionName name, java.util.List<ColumnIdentifier> argNames, java.util.List<AbstractType<?>> argTypes, DataType[] argDataTypes, AbstractType<?> returnType, DataType returnDataType, boolean calledOnNullInput, java.lang.String language, java.lang.String body)
public static UDFunction tryCreate(FunctionName name, java.util.List<ColumnIdentifier> argNames, java.util.List<AbstractType<?>> argTypes, AbstractType<?> returnType, boolean calledOnNullInput, java.lang.String language, java.lang.String body)
public static UDFunction create(FunctionName name, java.util.List<ColumnIdentifier> argNames, java.util.List<AbstractType<?>> argTypes, AbstractType<?> returnType, boolean calledOnNullInput, java.lang.String language, java.lang.String body)
public static UDFunction createBrokenFunction(FunctionName name, java.util.List<ColumnIdentifier> argNames, java.util.List<AbstractType<?>> argTypes, AbstractType<?> returnType, boolean calledOnNullInput, java.lang.String language, java.lang.String body, InvalidRequestException reason)
public SchemaElement.SchemaElementType elementType()
SchemaElement
elementType
in interface SchemaElement
public java.lang.String toCqlString(boolean withInternals, boolean ifNotExists)
SchemaElement
toCqlString
in interface SchemaElement
withInternals
- if the internals part of the CQL should be exposed.ifNotExists
- if "IF NOT EXISTS" should be included.public boolean isPure()
Function
public final java.nio.ByteBuffer execute(ProtocolVersion protocolVersion, java.util.List<java.nio.ByteBuffer> parameters)
ScalarFunction
execute
in interface ScalarFunction
protocolVersion
- protocol version used for parameters and return valueparameters
- the input parameterspublic final java.lang.Object executeForAggregate(ProtocolVersion protocolVersion, java.lang.Object firstParam, java.util.List<java.nio.ByteBuffer> parameters)
ScalarFunction.execute(ProtocolVersion, List)
but the first parameter is already in non-serialized form.
Remaining parameters (2nd paramters and all others) are in parameters
.
This is used to prevent superfluous (de)serialization of the state of aggregates.
Means: scalar functions of aggregates are called using this variant.public static void assertUdfsEnabled(java.lang.String language)
protected abstract java.util.concurrent.ExecutorService executor()
public boolean isCallableWrtNullable(java.util.List<java.nio.ByteBuffer> parameters)
protected abstract java.nio.ByteBuffer executeUserDefined(ProtocolVersion protocolVersion, java.util.List<java.nio.ByteBuffer> parameters)
protected abstract java.lang.Object executeAggregateUserDefined(ProtocolVersion protocolVersion, java.lang.Object firstParam, java.util.List<java.nio.ByteBuffer> parameters)
public boolean isAggregate()
Function
isAggregate
in interface Function
true
if the function is an aggregate function, false
otherwise.public boolean isNative()
Function
public boolean isCalledOnNullInput()
isCalledOnNullInput
in interface ScalarFunction
public java.util.List<ColumnIdentifier> argNames()
public java.lang.String body()
public java.lang.String language()
protected java.lang.Object compose(ProtocolVersion protocolVersion, int argIndex, java.nio.ByteBuffer value)
JavaBasedUDFunction
and script executor ScriptBasedUDFunction
) to convert the C*
serialized representation to the Java object representation.protocolVersion
- the native protocol version used for serializationargIndex
- index of the UDF input argumentprotected static java.lang.Object compose(TypeCodec<java.lang.Object>[] codecs, ProtocolVersion protocolVersion, int argIndex, java.nio.ByteBuffer value)
protected java.nio.ByteBuffer decompose(ProtocolVersion protocolVersion, java.lang.Object value)
JavaBasedUDFunction
and script executor ScriptBasedUDFunction
) to convert the Java
object representation for the return value to the C* serialized representation.protocolVersion
- the native protocol version used for serializationprotected static java.nio.ByteBuffer decompose(TypeCodec<java.lang.Object> codec, ProtocolVersion protocolVersion, java.lang.Object value)
public boolean referencesUserType(java.nio.ByteBuffer name)
referencesUserType
in interface Function
referencesUserType
in class AbstractFunction
public UDFunction withUpdatedUserType(UserType udt)
public boolean equals(java.lang.Object o)
equals
in class AbstractFunction
public java.util.Optional<Difference> compare(Function function)
public int hashCode()
hashCode
in class AbstractFunction
Copyright © 2009- The Apache Software Foundation