Package io.debezium.data.vector
Class SparseDoubleVector
java.lang.Object
io.debezium.data.vector.SparseDoubleVector
A semantic type to represent a double-precision sparse vector.
The vector data type commonly consists of a collection of values in which each index of the
underlying vector has a value; however, this can be memory intensive and wasteful when only
a subset of indices is populated. In such cases, a "sparse vector" can be used, defining
a map of key/value pairs for only the indices that are populated.
An example is PostgreSQL's
sparsevec
data type.- Author:
- Mincong Huang
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilder
builder()
Returns aSchemaBuilder
for a float64 sparse vector field.static org.apache.kafka.connect.data.Struct
fromLogical
(org.apache.kafka.connect.data.Schema schema, String value) Converts a value from its logical format -String
of{i1: v1, i2: v2, ...}/dimensions
to its encoded format - aStruct
with a number of dimensions and a map of index to valuestatic org.apache.kafka.connect.data.Schema
schema()
Returns aSchemaBuilder
for a float64 sparse vector field, with all other default Schema settings.
-
Field Details
-
LOGICAL_NAME
- See Also:
-
DIMENSIONS_FIELD
- See Also:
-
VECTOR_FIELD
- See Also:
-
SCHEMA_VERSION
public static int SCHEMA_VERSION
-
-
Constructor Details
-
SparseDoubleVector
public SparseDoubleVector()
-
-
Method Details
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()Returns aSchemaBuilder
for a float64 sparse vector field. You can use the resulting SchemaBuilder to set additional schema settings such as required/optional, default value, and documentation.- Returns:
- the schema builder
-
schema
public static org.apache.kafka.connect.data.Schema schema()Returns aSchemaBuilder
for a float64 sparse vector field, with all other default Schema settings.- Returns:
- the schema
- See Also:
-
fromLogical
public static org.apache.kafka.connect.data.Struct fromLogical(org.apache.kafka.connect.data.Schema schema, String value) Converts a value from its logical format -String
of{i1: v1, i2: v2, ...}/dimensions
to its encoded format - aStruct
with a number of dimensions and a map of index to value- Parameters:
schema
- of the encoded valuevalue
- the value of the vector- Returns:
- the encoded value
-