Class AbstractFunction
java.lang.Object
org.apache.cassandra.cql3.functions.AbstractFunction
- All Implemented Interfaces:
AssignmentTestable,Function
- Direct Known Subclasses:
NativeFunction,UserFunction
Base class for our native/hardcoded functions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable
AssignmentTestable.TestResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<AbstractType<?>>protected final FunctionNameprotected final AbstractType<?>Fields inherited from interface org.apache.cassandra.cql3.functions.Function
UNRESOLVED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFunction(FunctionName name, List<AbstractType<?>> argTypes, AbstractType<?> returnType) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFunctionsTo(List<Function> functions) List<AbstractType<?>>argTypes()columnName(List<String> columnNames) Returns the name of the function to use within a ResultSet.booleanAbstractType<?>getCompatibleTypeIfKnown(String keyspace) inthashCode()name()booleanreferencesUserType(ByteBuffer name) AbstractType<?>testAssignment(String keyspace, ColumnSpecification receiver) protected StringtoCqlString(AbstractType<?> type) Converts the specified type into its CQL representation.toString()booleantypesMatch(List<AbstractType<?>> types) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.cassandra.cql3.functions.Function
compare, isAggregate, isNative, isPure, newArguments
-
Field Details
-
name
-
argTypes
-
returnType
-
-
Constructor Details
-
AbstractFunction
protected AbstractFunction(FunctionName name, List<AbstractType<?>> argTypes, AbstractType<?> returnType)
-
-
Method Details
-
name
-
argTypes
-
returnType
- Specified by:
returnTypein interfaceFunction
-
argumentsList
-
equals
-
addFunctionsTo
- Specified by:
addFunctionsToin interfaceFunction
-
referencesUserType
- Specified by:
referencesUserTypein interfaceFunction
-
hashCode
public int hashCode() -
testAssignment
public final AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification receiver) - Specified by:
testAssignmentin interfaceAssignmentTestable- Returns:
- whether this object can be assigned to the provided receiver. We distinguish between 3 values: - EXACT_MATCH if this object is exactly of the type expected by the receiver - WEAKLY_ASSIGNABLE if this object is not exactly the expected type but is assignable nonetheless - NOT_ASSIGNABLE if it's not assignable Most caller should just call the isAssignable() method on the result, though functions have a use for testing "strong" equality to decide the most precise overload to pick when multiple could match.
-
getCompatibleTypeIfKnown
- Specified by:
getCompatibleTypeIfKnownin interfaceAssignmentTestable- Returns:
- A data type that can represent this, or
nullif we can't determine that type. The returned type won't necessarely be the exact type, but one that is compatible with it.
-
toString
-
elementKeyspace
-
elementName
-
toCqlString
Converts the specified type into its CQL representation.For user function and aggregates tuples need to be handle in a special way as they are frozen by nature but the frozen keyword should not appear in their CQL definition.
- Parameters:
type- the type- Returns:
- the CQL representation of the specified type
-
columnName
Description copied from interface:FunctionReturns the name of the function to use within a ResultSet.- Specified by:
columnNamein interfaceFunction- Parameters:
columnNames- the names of the columns used to call the function- Returns:
- the name of the function to use within a ResultSet
-
typesMatch
-