Skip to content

Vector data type support - #1812

Draft
tsegismont wants to merge 2 commits into
eclipse-vertx:masterfrom
tsegismont:vectors
Draft

tsegismont wants to merge 2 commits into
eclipse-vertx:masterfrom
tsegismont:vectors

Conversation

@tsegismont

@tsegismont tsegismont commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Closes #1526

Introduces vector data type support for the SQL clients.

The change is split into five stages, one commit per stage, so that each commit can be reviewed individually:

  • Core vector types (FloatVector, HalfFloatVector, DoubleVector, ByteVector, BitVector, SparseFloatVector)
  • PostgreSQL (vector, halfvec, sparsevec)
  • MySQL and MariaDB
  • SQL Server
  • Oracle

Add a vector type hierarchy in the `io.vertx.sqlclient.data` package: a `Vector` interface with `FloatVector`, `HalfFloatVector`, `DoubleVector`, `ByteVector`, `BitVector` and `SparseFloatVector` implementations, all with value-based `equals` and `hashCode`.

Expose `NullValue` constants for the new types.

Cover the new types with unit tests.

Assisted-by: Z.ai GLM (rits/zai-org/glm-5-3)
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Add support for the `vector`, `halfvec` and `sparsevec` types of the pgvector extension, mapped to `FloatVector`, `HalfFloatVector` and `SparseFloatVector`, in the binary and text protocols. The `bit` and `varbit` types are decoded to a `Buffer` that includes the bit length header with the binary protocol, and `PgRow.get` converts them to `BitVector`.

Discover the OIDs of the pgvector types, which are members of the extension, when a connection is initialized if `PgConnectOptions#setVectorTypeEnabled` is `true`, an option that can also be set with the `vector_type_enabled` URI parameter and the `PGVECTORTYPEENABLED` environment variable. A warning is logged when a type is not found.

Cover the new types with `PgVectorDataTypeTest` running against a pgvector container, and document the feature in the reference guide and `PgClientExamples`.

Assisted-by: IBM Bob (agent mode)
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for vector types

1 participant