-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support Int8Vector in go #38990
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -450,6 +450,29 @@ | |
return status; | ||
} | ||
|
||
CStatus | ||
BuildInt8VecIndex(CIndex index, int64_t int8_value_num, const int8_t* vectors) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we just follow the pattern. But it will be great if we can merge these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because here is C code, we cannot use template here which is only supported in C++ |
||
auto status = CStatus(); | ||
try { | ||
AssertInfo(index, | ||
"failed to build int8 vector index, passed index was null"); | ||
auto real_index = | ||
reinterpret_cast<milvus::indexbuilder::IndexCreatorBase*>(index); | ||
auto cIndex = | ||
dynamic_cast<milvus::indexbuilder::VecIndexCreator*>(real_index); | ||
auto dim = cIndex->dim(); | ||
auto row_nums = int8_value_num / dim; | ||
auto ds = knowhere::GenDataSet(row_nums, dim, vectors); | ||
cIndex->Build(ds); | ||
status.error_code = Success; | ||
status.error_msg = ""; | ||
} catch (std::exception& e) { | ||
status.error_code = UnexpectedError; | ||
status.error_msg = strdup(e.what()); | ||
} | ||
return status; | ||
} | ||
|
||
// field_data: | ||
// 1, serialized proto::schema::BoolArray, if type is bool; | ||
// 2, serialized proto::schema::StringArray, if type is string; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a little bit weird to have this function.
Let's change the metrics check to
vector
andbinary vector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot get your point.
FloatVector and Int8Vector support different metric types, so I use different APIs to handle.