JingsongLi commented on code in PR #411:
URL: https://github.com/apache/paimon-rust/pull/411#discussion_r3485018694
##########
crates/paimon/src/btree/key_serde.rs:
##########
@@ -109,6 +109,12 @@ pub fn make_key_comparator(data_type: &DataType) ->
KeyComparator {
let bv = i64::from_le_bytes(b[..8].try_into().unwrap());
av.cmp(&bv)
}),
+ // VECTOR is not a valid key type. Fail loudly rather than letting it
fall
+ // into the lexicographic byte comparator below, which would silently
sort
+ // vectors incorrectly.
+ DataType::Vector(_) => {
Review Comment:
Schema validation still allows a VECTOR column to be used as a primary key,
but this path later panics when the global index/BTree code asks for a key
comparator. For example, `Schema::builder().column("embedding",
DataType::Vector(...)).primary_key(["embedding"]).build()` succeeds and
normalizes the field to NOT NULL, then `make_key_comparator` reaches this
`panic!`. Could we reject VECTOR primary keys during schema validation, or
change the comparator construction to return `Unsupported` instead of panicking?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]