Repository navigation
GH-430: [Format] Add FINITE_VECTOR logical type with LIST storage - #624
Conversation
Thanks for the question @HuaHuaY ! Option B requires changes to physical layout of data - either via new repetition level or another mechanism. As logical and physical changes are somewhat independent and should likely both be done, we decided to propose them separately. So in short Option B is not eliminated, only delayed until logical type for vectors is settled. Apologies this was not clear from my communication. |
alamb
left a comment
There was a problem hiding this comment.
The proposal seems pretty good to me -- I think there are some places where we could reduce its size and make it more concise, but the high level idea looks good
divjotarora
left a comment
There was a problem hiding this comment.
Small wording comments, but overall LGTM. Thanks for driving this @rok!
Co-authored-by: Rok Mihevc <rok@mihevc.org>
Co-authored-by: Rok Mihevc <rok@mihevc.org>
Co-authored-by: Rok Mihevc <rok@mihevc.org>
Co-authored-by: Rok Mihevc <rok@mihevc.org>
ac3438d to
2bdc543
Compare
268ab40 to
daac474
Compare
97fb091 to
6c9f73e
Compare
|
Hey @JigaoLuo thanks for reviewing! Discussion on points you raise would better fit the discusson on the ML (1, 2). I'll still try to reply here, but if you want to push this further the dev@parquet ML is the platform you should use.
I am not an embeddings or vector DB expert, but wouldn't distance metric always an operation acting on pairs of vectors? It feels more like an application level concern and parquet already has a file-level metadata key-value metadata where such information could be stored. Or am I missing something here that could not be captured there?
Agreed that this is important information, but I'm not sure it's something that should live in the type. It would make parquet more self-contained, but it would require agreement on model identity between embedding producers which is out of reach for parquet. If you feel strongly about this, please sketch out how you imagine this would look like. |
|
Hi @rok Thanks for sharing these. I'll go through the two discussions.
On point 1, I think this is a good place for it. |
7c67461 to
81bc323
Compare
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
81bc323 to
70b3023
Compare
| } | ||
| ``` | ||
|
|
||
| ### Finite Vectors |
| * unannotated `BOOLEAN`, `FLOAT` or `DOUBLE` | ||
| * `INT32` or `INT64`, either unannotated or annotated with `INTEGER` or | ||
| `DECIMAL` | ||
| * `FIXED_LEN_BYTE_ARRAY` annotated with `FLOAT16` or `DECIMAL`. |
There was a problem hiding this comment.
Just curious if BYTE_ARRAY annotated with DECIMAL should be supported.
There was a problem hiding this comment.
For completeness, it could be added, but I'd leave it out. Every supported element type is fixed width. Any decimal precision can already be stored as FIXED_LEN_BYTE_ARRAY, so excluding BYTE_ARRAY loses nothing.
There was a problem hiding this comment.
Fixed width allows for some optimizations that variable width doesn't. I believe allowing variable-width types would make writers more complex as they'd have to enable or disable these optimizations at write time.
If it turns out there's a need for this we can revisit later too!
| * unannotated `BOOLEAN`, `FLOAT` or `DOUBLE` | ||
| * `INT32` or `INT64`, either unannotated or annotated with `INTEGER` or | ||
| `DECIMAL` | ||
| * `FIXED_LEN_BYTE_ARRAY` annotated with `FLOAT16` or `DECIMAL`. |
There was a problem hiding this comment.
For completeness, it could be added, but I'd leave it out. Every supported element type is fixed width. Any decimal precision can already be stored as FIXED_LEN_BYTE_ARRAY, so excluding BYTE_ARRAY loses nothing.
Rationale for this change
Discussion on the ML led to a decision to split the logical annotation proposal from the original proposal, which also aimed to provide a physical representation. This PR proposes the logical annotation only, to address the need for a logical vector type.
Naming: the annotation is called
FINITE_VECTOR(previouslyVECTORin this PR) so that the name carries the contract: fixed length, non-null and finite elements. This leavesVECTORavailable should a future proposal introduce a more general vector type or a dedicated physical representation.This adds a
FINITE_VECTORlogical type stored as a canonical 3-level LIST structure. This is a contract on top of LIST, not a new physical representation:num_elementselements.required(non-null) and finite (no NaN, +Inf or -Inf).ConvertedType.LISTalongsideLogicalType.FINITE_VECTOR. Readers that fall back to the converted type read an ordinary LIST; readers that ignore both annotations see an unannotated group with a single repeated child group.Trade-offs:
FLBA(num_elements * type_width)storage would decouple this, at the cost of element-level encodings.Out of scope:
FiniteVectorType.What changes are included in this PR?
Specifies the
FINITE_VECTORlogical type, its LIST representation, writer/reader requirements and element-level requirements.Do these changes have PoC implementations?