feat: parse vector<T, N> from Custom type class name (Cassandra 5.0)#222
Draft
bkearns wants to merge 1 commit intokrojew:masterfrom
Draft
feat: parse vector<T, N> from Custom type class name (Cassandra 5.0)#222bkearns wants to merge 1 commit intokrojew:masterfrom
bkearns wants to merge 1 commit intokrojew:masterfrom
Conversation
4754ef5 to
647c5e5
Compare
Cassandra 5.0 sends vector columns as Custom (0x0000) with class name:
org.apache.cassandra.db.marshal.VectorType(
org.apache.cassandra.db.marshal.FloatType , 768)
This patch detects VectorType in Custom class name strings and parses
the element type and dimension count into a structured CVector variant.
Changes in cassandra-protocol/src/frame/message_result.rs:
- ColTypeOptionValue::CVector(element_type_name, dimensions)
- parse_vector_class_name() extracts type + dims from class name
- Custom type handler checks for VectorType before falling back to CString
- Serialize CVector back to the Cassandra class name format
- 7 new tests: parsing, compact format, non-vector passthrough,
wire roundtrip for both vector and non-vector Custom types
No new ColType variant needed — vectors stay as ColType::Custom on the
wire, matching the Cassandra native protocol spec (which has no dedicated
vector type ID).
647c5e5 to
502498c
Compare
Owner
|
Thanks for submitting. Is it ready for review? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Parse vector<T, N> column types from the Custom type class name string, matching how Cassandra 5.0 encodes vectors on the wire. Supersedes #221 which incorrectly used a non-standard type ID.
Cassandra has no dedicated type ID for vectors in the native protocol. Vector columns are sent as Custom (0x0000) with class name:
org.apache.cassandra.db.marshal.VectorType(org.apache.cassandra.db.marshal.FloatType , 768)
This is the same approach used by the DataStax Java driver, ScyllaDB Rust driver, and Python driver.
Changes
No new ColType variant — vectors stay as ColType::Custom on the wire.
Tests
7 new tests (182 total, all passing): float4, float768, double, compact format, non-vector passthrough, wire roundtrips.