Class VectorCodec<E>
- Type Parameters:
E- The type of the vector elements.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.cql3.functions.types.TypeCodec
TypeCodec.AbstractCollectionCodec<E,C extends Collection<E>>, TypeCodec.AbstractMapCodec<K, V>, TypeCodec.AbstractTupleCodec<T>, TypeCodec.AbstractUDTCodec<T>, TypeCodec.PrimitiveBooleanCodec, TypeCodec.PrimitiveByteCodec, TypeCodec.PrimitiveDoubleCodec, TypeCodec.PrimitiveFloatCodec, TypeCodec.PrimitiveIntCodec, TypeCodec.PrimitiveLongCodec, TypeCodec.PrimitiveShortCodec -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionFormat the given value as a valid CQL literal according to the CQL type handled by this codec.static <E> VectorCodec<E>of(VectorType type, TypeCodec<E> subtypeCodec) Parse the given CQL literal into an instance of the Java type handled by this codec.Methods inherited from class org.apache.cassandra.cql3.functions.types.TypeCodec
accepts, accepts, accepts, accepts, ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, deserialize, duration, getCqlType, getJavaType, inet, isSerializedSizeFixed, list, map, serialize, serializedSize, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varint, vector
-
Field Details
-
type
-
subtypeCodec
-
-
Method Details
-
of
-
parse
Description copied from class:TypeCodecParse the given CQL literal into an instance of the Java type handled by this codec.Implementors should take care of unquoting and unescaping the given CQL string where applicable. Null values and empty Strings should be accepted, as well as the string
"NULL"; in most cases, implementations should interpret these inputs has equivalent to anullreference.Implementing this method is not strictly mandatory: internally, the driver only uses it to parse the INITCOND when building the metadata of an aggregate function (and in most cases it will use a built-in codec, unless the INITCOND has a custom type).
- Specified by:
parsein classTypeCodec<List<E>>- Parameters:
value- The CQL string to parse, may benullor empty.- Returns:
- An instance of T; may be
nullon anull input. - Throws:
InvalidTypeException- if the given value cannot be parsed into the expected type
-
format
Description copied from class:TypeCodecFormat the given value as a valid CQL literal according to the CQL type handled by this codec.Implementors should take care of quoting and escaping the resulting CQL literal where applicable. Null values should be accepted; in most cases, implementations should return the CQL keyword
"NULL"fornullinputs.Implementing this method is not strictly mandatory. It is used:
- in the query builder, when values are inlined in the query string (see
querybuilder.BuiltStatementfor a detailed explanation of when this happens); - in the
QueryLogger, if parameter logging is enabled; - to format the INITCOND in
AggregateMetadata#asCQLQuery(boolean); - in the
toString()implementation of some objects (UDTValue,TupleValue, and the internal representation of aROWSresponse), which may appear in driver logs.
If you choose not to implement this method, you should not throw an exception but instead return a constant string (for example "XxxCodec.format not implemented").
- Specified by:
formatin classTypeCodec<List<E>>- Parameters:
value- An instance of T; may benull.- Returns:
- CQL string
- Throws:
InvalidTypeException- if the given value does not have the expected type
- in the query builder, when values are inlined in the query string (see
-