Check ScalarIndex deserialization (#21724)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
pull/21750/head
Xiaofan 2023-01-16 17:29:43 +08:00 committed by GitHub
parent 836773f1a0
commit e7f947ed0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -67,7 +67,8 @@ inline void
ScalarIndex<std::string>::BuildWithRawData(size_t n, const void* values, const Config& config) {
// TODO :: use arrow
proto::schema::StringArray arr;
arr.ParseFromArray(values, n);
auto ok = arr.ParseFromArray(values, n);
Assert(ok);
// TODO :: optimize here. avoid memory copy.
std::vector<std::string> vecs{arr.data().begin(), arr.data().end()};
@ -78,7 +79,8 @@ template <>
inline void
ScalarIndex<bool>::BuildWithRawData(size_t n, const void* values, const Config& config) {
proto::schema::BoolArray arr;
arr.ParseFromArray(values, n);
auto ok = arr.ParseFromArray(values, n);
Assert(ok);
Build(arr.data_size(), arr.data().data());
}