Class AggregateMetadata
- java.lang.Object
-
- com.datastax.driver.core.AggregateMetadata
-
public class AggregateMetadata extends Object
Describes a CQL aggregate function (created withCREATE AGGREGATE...).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringasCQLQuery()Returns a CQL query representing this function.booleanequals(Object other)StringexportAsString()Returns a CQL query representing this function in human readable form.List<DataType>getArgumentTypes()Returns the types of this aggregate's arguments.FunctionMetadatagetFinalFunc()Returns the final function of this aggregate.ObjectgetInitCond()Returns the initial state value of this aggregate.KeyspaceMetadatagetKeyspace()Returns the keyspace this aggregate belongs to.DataTypegetReturnType()Returns the return type of this aggregate.StringgetSignature()Returns the CQL signature of this aggregate.StringgetSimpleName()Returns the simple name of this aggregate.FunctionMetadatagetStateFunc()Returns the state function of this aggregate.DataTypegetStateType()Returns the state type of this aggregate.inthashCode()StringtoString()
-
-
-
Method Detail
-
exportAsString
public String exportAsString()
Returns a CQL query representing this function in human readable form.This method is equivalent to
asCQLQuery()but the output is formatted.- Returns:
- the CQL query representing this function.
-
asCQLQuery
public String asCQLQuery()
Returns a CQL query representing this function.This method returns a single 'CREATE FUNCTION' query corresponding to this function definition.
- Returns:
- the 'CREATE FUNCTION' query corresponding to this function.
-
getKeyspace
public KeyspaceMetadata getKeyspace()
Returns the keyspace this aggregate belongs to.- Returns:
- the keyspace metadata of the keyspace this aggregate belongs to.
-
getSignature
public String getSignature()
Returns the CQL signature of this aggregate.This is the name of the aggregate, followed by the names of the argument types between parentheses, like it was specified in the
CREATE AGGREGATE...statement, for examplesum(int).Note that the returned signature is not qualified with the keyspace name.
- Returns:
- the signature of this aggregate.
-
getSimpleName
public String getSimpleName()
Returns the simple name of this aggregate.This is the name of the aggregate, without arguments. Note that aggregates can be overloaded with different argument lists, therefore the simple name may not be unique. For example,
sum(int)andsum(int,int)both have the simple namesum.- Returns:
- the simple name of this aggregate.
- See Also:
getSignature()
-
getArgumentTypes
public List<DataType> getArgumentTypes()
Returns the types of this aggregate's arguments.- Returns:
- the types.
-
getFinalFunc
public FunctionMetadata getFinalFunc()
Returns the final function of this aggregate.This is the function specified with
FINALFUNCin theCREATE AGGREGATE...statement. It transforms the final value after the aggregation is complete.- Returns:
- the metadata of the final function, or
nullif there is none.
-
getInitCond
public Object getInitCond()
Returns the initial state value of this aggregate.This is the value specified with
INITCONDin theCREATE AGGREGATE...statement. It's passed to the initial invocation of the state function (if that function does not accept null arguments).The actual type of the returned object depends on the aggregate's
state typeand on thecodecused toparsetheINITCONDliteral.If, for some reason, the
INITCONDliteral cannot be parsed, a warning will be logged and the returned object will be the originalINITCONDliteral in its textual, non-parsed form.- Returns:
- the initial state, or
nullif there is none.
-
getReturnType
public DataType getReturnType()
Returns the return type of this aggregate.This is the final type of the value computed by this aggregate; in other words, the return type of the final function if it is defined, or the state type otherwise.
- Returns:
- the return type.
-
getStateFunc
public FunctionMetadata getStateFunc()
Returns the state function of this aggregate.This is the function specified with
SFUNCin theCREATE AGGREGATE...statement. It aggregates the current state with each row to produce a new state.- Returns:
- the metadata of the state function.
-
getStateType
public DataType getStateType()
Returns the state type of this aggregate.This is the type specified with
STYPEin theCREATE AGGREGATE...statement. It defines the type of the value that is accumulated as the aggregate iterates through the rows.- Returns:
- the state type.
-
-