-
For anyone seeing this in the future: I cannot be bothered to go through publishing a crate for this, but here is the code: Hello, I am trying to write the sqlx encoder/decoder for pgvevcto.rs structures. I'm starting with From "reverse engineering" from existing rows inserted using normal SQL, it seems like it the first two bytes encode the length as LE i16, but the packing of the actual bytes is then unclear, especially at high bvector sizes likes 12345 for instance. It seems like there is some padding or similar happening. Can you point me to the code encoding/decoding (b)vector into bytestreams for Postgresql storage? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Code for binary representation is in https://github.com/tensorchord/pgvecto.rs/blob/main/src/datatype/binary_bvecf32.rs. Code for storage layout is in https://github.com/tensorchord/pgvecto.rs/blob/main/src/datatype/memory_bvecf32.rs. |
Beta Was this translation helpful? Give feedback.
-
I was looking for this exact thing, thank you @zopieux! It would be great also to have this documented by the pgvecto.rs maintainers, given that SQLx is most likely the driver Rust users would use with this extension. |
Beta Was this translation helpful? Give feedback.
Code for binary representation is in https://github.com/tensorchord/pgvecto.rs/blob/main/src/datatype/binary_bvecf32.rs. Code for storage layout is in https://github.com/tensorchord/pgvecto.rs/blob/main/src/datatype/memory_bvecf32.rs.