[type] Add native VectorType to the type system (#410 PR 1)#411
Open
JunRuiLee wants to merge 2 commits into
Open
[type] Add native VectorType to the type system (#410 PR 1)#411JunRuiLee wants to merge 2 commits into
JunRuiLee wants to merge 2 commits into
Conversation
abe629c to
31bcc4d
Compare
QuakeWang
reviewed
Jun 26, 2026
|
|
||
| impl Display for VectorType { | ||
| fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
| write!(f, "VECTOR<{}, {}>", self.element_sql_name(), self.length)?; |
Member
There was a problem hiding this comment.
Display drops the element type nullability. For example, a VECTOR<FLOAT NOT NULL, 4>-like type would render as VECTOR<FLOAT, 4>, while serde preserves the element nullability. Please either render element_type with its SQL string or reject/normalize non-null vector element types.
Author
There was a problem hiding this comment.
Fixed — Display now renders the element's nullability too (e.g. VECTOR<FLOAT NOT NULL, 4>), matching elementType.asSQLString() and the serde form.
31bcc4d to
730842b
Compare
Add VectorType (VECTOR<element, length>) as a standalone fixed-size dense vector type: u32 length validated to [1, i32::MAX], element type restricted to BOOLEAN/TINYINT/SMALLINT/INT/BIGINT/FLOAT/DOUBLE, JSON serde matching the Java wire shape, and a VECTOR<ELEM, N> Display.
Add the DataType::Vector variant and fill every exhaustive match: type-system semantics (is_nullable, copy_with_nullable, contains_row_type) implemented, and IO/integration sites returning explicit Unsupported (PR 1 supports the type in schemas; vector data IO lands in a later PR). Deserialize is hand-written to compose with the untagged DataType enum.
730842b to
e8478dd
Compare
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.
PR 1 of reading Paimon
VECTORcolumns in paimon-rust, tracked in #410. Adds the type-system foundation; reading vector data is deferred to later PRs.Roadmap (#410): PR 1 (this) type system → PR 2 Arrow conversion + inlined reads → PR 3 dedicated
.vector.files.Changes
VectorTypemirroring upstreamorg.apache.paimon.types.VectorType:u32length in[1, i32::MAX], element type restricted toBOOLEAN/TINYINT/SMALLINT/INT/BIGINT/FLOAT/DOUBLE; JSON serde matching the Java wire shape;DisplayasVECTOR<FLOAT, 128>.DataType::Vectorvariant threaded through all exhaustive matches: type-system semantics (is_nullable,copy_with_nullable,contains_row_type) implemented; IO/integration sites return explicitUnsupported; BTree key comparator rejectsVECTORrather than falling back to byte comparison.After this PR a
VECTORcolumn deserializes/validates/serializes/renders correctly; vector data IO returnsUnsupported— the intended PR 1 boundary.Testing
cargo test -p paimon --lib895 passed;cargo clippy -p paimon --all-targetsclean;cargo checkpasses forpaimon-datafusionandpaimon-c.