mirror of https://github.com/milvus-io/milvus.git
dont modify grpc generated code
parent
76c71ea00c
commit
661a60374e
|
@ -1321,8 +1321,7 @@ class RowRecord :
|
|||
void clear_vector_data();
|
||||
float vector_data(int index) const;
|
||||
void set_vector_data(int index, float value);
|
||||
// void add_vector_data(float value);
|
||||
void add_vector_data(std::vector<float>::const_iterator begin, std::vector<float>::const_iterator end);
|
||||
void add_vector_data(float value);
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >&
|
||||
vector_data() const;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedField< float >*
|
||||
|
@ -1474,9 +1473,7 @@ class InsertParam :
|
|||
void clear_row_id_array();
|
||||
::PROTOBUF_NAMESPACE_ID::int64 row_id_array(int index) const;
|
||||
void set_row_id_array(int index, ::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
// void add_row_id_array(::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
void add_row_id_array(std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator begin,
|
||||
std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator end);
|
||||
void add_row_id_array(::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >&
|
||||
row_id_array() const;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >*
|
||||
|
@ -2139,9 +2136,7 @@ class TopKQueryResult :
|
|||
void clear_ids();
|
||||
::PROTOBUF_NAMESPACE_ID::int64 ids(int index) const;
|
||||
void set_ids(int index, ::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
// void add_ids(::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
void add_ids(std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator begin,
|
||||
std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator end);
|
||||
void add_ids(::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >&
|
||||
ids() const;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >*
|
||||
|
@ -2152,8 +2147,7 @@ class TopKQueryResult :
|
|||
void clear_distances();
|
||||
float distances(int index) const;
|
||||
void set_distances(int index, float value);
|
||||
// void add_distances(float value);
|
||||
void add_distances(std::vector<float>::const_iterator begin, std::vector<float>::const_iterator end);
|
||||
void add_distances(float value);
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >&
|
||||
distances() const;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedField< float >*
|
||||
|
@ -3928,14 +3922,9 @@ inline void RowRecord::set_vector_data(int index, float value) {
|
|||
vector_data_.Set(index, value);
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.RowRecord.vector_data)
|
||||
}
|
||||
//inline void RowRecord::add_vector_data(float value) {
|
||||
// vector_data_.Add(value);
|
||||
// // @@protoc_insertion_point(field_add:milvus.grpc.RowRecord.vector_data)
|
||||
//}
|
||||
inline void RowRecord::add_vector_data(std::vector<float>::const_iterator begin,
|
||||
std::vector<float>::const_iterator end) {
|
||||
vector_data_.Add(begin, end);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.RowRecord.vector_data)
|
||||
inline void RowRecord::add_vector_data(float value) {
|
||||
vector_data_.Add(value);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.RowRecord.vector_data)
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >&
|
||||
RowRecord::vector_data() const {
|
||||
|
@ -4048,14 +4037,9 @@ inline void InsertParam::set_row_id_array(int index, ::PROTOBUF_NAMESPACE_ID::in
|
|||
row_id_array_.Set(index, value);
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.InsertParam.row_id_array)
|
||||
}
|
||||
//inline void InsertParam::add_row_id_array(::PROTOBUF_NAMESPACE_ID::int64 value) {
|
||||
// row_id_array_.Add(value);
|
||||
// // @@protoc_insertion_point(field_add:milvus.grpc.InsertParam.row_id_array)
|
||||
//}
|
||||
inline void InsertParam::add_row_id_array(std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator begin,
|
||||
std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator end) {
|
||||
row_id_array_.Add(begin, end);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.InsertParam.row_id_array)
|
||||
inline void InsertParam::add_row_id_array(::PROTOBUF_NAMESPACE_ID::int64 value) {
|
||||
row_id_array_.Add(value);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.InsertParam.row_id_array)
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >&
|
||||
InsertParam::row_id_array() const {
|
||||
|
@ -4604,14 +4588,9 @@ inline void TopKQueryResult::set_ids(int index, ::PROTOBUF_NAMESPACE_ID::int64 v
|
|||
ids_.Set(index, value);
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.TopKQueryResult.ids)
|
||||
}
|
||||
//inline void TopKQueryResult::add_ids(::PROTOBUF_NAMESPACE_ID::int64 value) {
|
||||
// ids_.Add(value);
|
||||
// // @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.ids)
|
||||
//}
|
||||
inline void TopKQueryResult::add_ids(std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator begin,
|
||||
std::vector<::PROTOBUF_NAMESPACE_ID::int64>::const_iterator end) {
|
||||
ids_.Add(begin,end);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.ids)
|
||||
inline void TopKQueryResult::add_ids(::PROTOBUF_NAMESPACE_ID::int64 value) {
|
||||
ids_.Add(value);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.ids)
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >&
|
||||
TopKQueryResult::ids() const {
|
||||
|
@ -4639,13 +4618,9 @@ inline void TopKQueryResult::set_distances(int index, float value) {
|
|||
distances_.Set(index, value);
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.TopKQueryResult.distances)
|
||||
}
|
||||
//inline void TopKQueryResult::add_distances(float value) {
|
||||
// distances_.Add(value);
|
||||
// // @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.distances)
|
||||
//}
|
||||
inline void TopKQueryResult::add_distances(std::vector<float>::const_iterator begin, std::vector<float>::const_iterator end) {
|
||||
distances_.Add(begin, end);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.distances)
|
||||
inline void TopKQueryResult::add_distances(float value) {
|
||||
distances_.Add(value);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.TopKQueryResult.distances)
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >&
|
||||
TopKQueryResult::distances() const {
|
||||
|
|
|
@ -32,6 +32,13 @@ UriCheck(const std::string& uri) {
|
|||
return (index != std::string::npos);
|
||||
}
|
||||
|
||||
void
|
||||
CopyRowRecord(::milvus::grpc::RowRecord* target, const RowRecord& src) {
|
||||
auto vector_data = target->mutable_vector_data();
|
||||
vector_data->Resize(static_cast<int>(src.data.size()), 0.0);
|
||||
memcpy(vector_data->mutable_data(), src.data.data(), src.data.size() * sizeof(float));
|
||||
}
|
||||
|
||||
Status
|
||||
ClientProxy::Connect(const ConnectParam& param) {
|
||||
std::string uri = param.ip_address + ":" + param.port;
|
||||
|
@ -189,14 +196,16 @@ ClientProxy::Insert(const std::string& table_name, const std::string& partition_
|
|||
|
||||
for (auto& record : record_array) {
|
||||
::milvus::grpc::RowRecord* grpc_record = insert_param.add_row_record_array();
|
||||
grpc_record->add_vector_data(record.data.begin(), record.data.end());
|
||||
CopyRowRecord(grpc_record, record);
|
||||
}
|
||||
|
||||
// Single thread
|
||||
::milvus::grpc::VectorIds vector_ids;
|
||||
if (!id_array.empty()) {
|
||||
/* set user's ids */
|
||||
insert_param.add_row_id_array(id_array.begin(), id_array.end());
|
||||
auto row_ids = insert_param.mutable_row_id_array();
|
||||
row_ids->Resize(static_cast<int>(id_array.size()), -1);
|
||||
memcpy(row_ids->mutable_data(), id_array.data(), id_array.size() * sizeof(int64_t));
|
||||
client_ptr_->Insert(vector_ids, insert_param, status);
|
||||
} else {
|
||||
client_ptr_->Insert(vector_ids, insert_param, status);
|
||||
|
@ -226,7 +235,7 @@ ClientProxy::Search(const std::string& table_name, const std::vector<std::string
|
|||
}
|
||||
for (auto& record : query_record_array) {
|
||||
::milvus::grpc::RowRecord* row_record = search_param.add_query_record_array();
|
||||
row_record->add_vector_data(record.data.begin(), record.data.end());
|
||||
CopyRowRecord(row_record, record);
|
||||
}
|
||||
|
||||
// step 2: convert range array
|
||||
|
|
|
@ -167,7 +167,7 @@ SearchRequest::OnExecute() {
|
|||
|
||||
// step 7: construct result array
|
||||
topk_result_->set_row_num(record_count);
|
||||
topk_result_->mutable_ids()->Resize(static_cast<int>(result_ids.size()), 0);
|
||||
topk_result_->mutable_ids()->Resize(static_cast<int>(result_ids.size()), -1);
|
||||
memcpy(topk_result_->mutable_ids()->mutable_data(), result_ids.data(), result_ids.size() * sizeof(int64_t));
|
||||
topk_result_->mutable_distances()->Resize(static_cast<int>(result_distances.size()), 0.0);
|
||||
memcpy(topk_result_->mutable_distances()->mutable_data(), result_distances.data(),
|
||||
|
|
Loading…
Reference in New Issue