提交 476d2192 编写于 作者: S starlord

MS-245 Improve search result transfer performance


Former-commit-id: 77ce402c5ab2c851afa11cb2d637acb69d9ad737
上级 8e5e50e4
......@@ -29,7 +29,8 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-208 - Add buildinde interface for C++ SDK
- MS-212 - Support Inner product metric type
- MS-241 - Build Faiss with MKL if using Intel CPU; else build with OpenBlas
- MS-242 - clean up cmake and change MAKE_BUILD_ARGS to be user defined variable
- MS-242 - Clean up cmake and change MAKE_BUILD_ARGS to be user defined variable
- MS-245 - Improve search result transfer performance
## New Feature
- MS-180 - Add new mem manager
......
......@@ -209,17 +209,25 @@ ClientProxy::SearchVector(const std::string &table_name,
}
//step 3: search vectors
std::vector<thrift::TopKQueryResult> result_array;
ClientPtr()->interface()->SearchVector(result_array, table_name, thrift_records, thrift_ranges, topk);
std::vector<thrift::TopKQueryBinResult> result_array;
ClientPtr()->interface()->SearchVector2(result_array, table_name, thrift_records, thrift_ranges, topk);
//step 4: convert result array
for(auto& thrift_topk_result : result_array) {
TopKQueryResult result;
for(auto& thrift_query_result : thrift_topk_result.query_result_arrays) {
size_t id_count = thrift_topk_result.id_array.size()/sizeof(int64_t);
size_t dist_count = thrift_topk_result.distance_array.size()/ sizeof(double);
if(id_count != dist_count) {
return Status(StatusCode::UnknownError, "illegal result");
}
int64_t* id_ptr = (int64_t*)thrift_topk_result.id_array.data();
double* dist_ptr = (double*)thrift_topk_result.distance_array.data();
for(size_t i = 0; i < id_count; i++) {
QueryResult query_result;
query_result.id = thrift_query_result.id;
query_result.distance = thrift_query_result.distance;
query_result.id = id_ptr[i];
query_result.distance = dist_ptr[i];
result.query_result_arrays.emplace_back(query_result);
}
......
......@@ -60,11 +60,22 @@ RequestHandler::SearchVector(std::vector<thrift::TopKQueryResult> &_return,
const std::vector<thrift::Range> &query_range_array,
const int64_t topk) {
// SERVER_LOG_DEBUG << "Entering RequestHandler::SearchVector";
BaseTaskPtr task_ptr = SearchVectorTask::Create(table_name, std::vector<std::string>(), query_record_array,
BaseTaskPtr task_ptr = SearchVectorTask1::Create(table_name, std::vector<std::string>(), query_record_array,
query_range_array, topk, _return);
RequestScheduler::ExecTask(task_ptr);
}
void
RequestHandler::SearchVector2(std::vector<thrift::TopKQueryBinResult> & _return,
const std::string& table_name,
const std::vector<thrift::RowRecord> & query_record_array,
const std::vector<thrift::Range> & query_range_array,
const int64_t topk) {
BaseTaskPtr task_ptr = SearchVectorTask2::Create(table_name, std::vector<std::string>(), query_record_array,
query_range_array, topk, _return);
RequestScheduler::ExecTask(task_ptr);
}
void
RequestHandler::SearchVectorInFiles(std::vector<::milvus::thrift::TopKQueryResult> &_return,
const std::string& table_name,
......@@ -73,7 +84,7 @@ RequestHandler::SearchVectorInFiles(std::vector<::milvus::thrift::TopKQueryResul
const std::vector<::milvus::thrift::Range> &query_range_array,
const int64_t topk) {
// SERVER_LOG_DEBUG << "Entering RequestHandler::SearchVectorInFiles. file_id_array size = " << std::to_string(file_id_array.size());
BaseTaskPtr task_ptr = SearchVectorTask::Create(table_name, file_id_array, query_record_array,
BaseTaskPtr task_ptr = SearchVectorTask1::Create(table_name, file_id_array, query_record_array,
query_range_array, topk, _return);
RequestScheduler::ExecTask(task_ptr);
}
......
......@@ -106,6 +106,29 @@ public:
const std::vector<::milvus::thrift::Range> & query_range_array,
const int64_t topk);
/**
* @brief Query vector
*
* This method is used to query vector in table.
*
* @param table_name, table_name is queried.
* @param query_record_array, all vector are going to be queried.
* @param query_range_array, optional ranges for conditional search. If not specified, search whole table
* @param topk, how many similarity vectors will be searched.
*
* @return query binary result array.
*
* @param table_name
* @param query_record_array
* @param query_range_array
* @param topk
*/
void SearchVector2(std::vector<::milvus::thrift::TopKQueryBinResult> & _return,
const std::string& table_name,
const std::vector<::milvus::thrift::RowRecord> & query_record_array,
const std::vector<::milvus::thrift::Range> & query_range_array,
const int64_t topk);
/**
* @brief Internal use query interface
*
......
......@@ -466,33 +466,21 @@ ServerError AddVectorTask::OnExecute() {
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SearchVectorTask::SearchVectorTask(const std::string &table_name,
const std::vector<std::string>& file_id_array,
const std::vector<thrift::RowRecord> &query_record_array,
const std::vector<thrift::Range> &query_range_array,
const int64_t top_k,
std::vector<thrift::TopKQueryResult> &result_array)
SearchVectorTaskBase::SearchVectorTaskBase(const std::string &table_name,
const std::vector<std::string>& file_id_array,
const std::vector<thrift::RowRecord> &query_record_array,
const std::vector<thrift::Range> &query_range_array,
const int64_t top_k)
: BaseTask(DQL_TASK_GROUP),
table_name_(table_name),
file_id_array_(file_id_array),
record_array_(query_record_array),
range_array_(query_range_array),
top_k_(top_k),
result_array_(result_array) {
}
top_k_(top_k) {
BaseTaskPtr SearchVectorTask::Create(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<thrift::RowRecord> & query_record_array,
const std::vector<thrift::Range> & query_range_array,
const int64_t top_k,
std::vector<thrift::TopKQueryResult>& result_array) {
return std::shared_ptr<BaseTask>(new SearchVectorTask(table_name, file_id_array,
query_record_array, query_range_array, top_k, result_array));
}
ServerError SearchVectorTask::OnExecute() {
ServerError SearchVectorTaskBase::OnExecute() {
try {
TimeRecorder rc("SearchVectorTask");
......@@ -570,26 +558,106 @@ ServerError SearchVectorTask::OnExecute() {
rc.Record("do search");
//step 5: construct result array
for(uint64_t i = 0; i < record_count; i++) {
auto& result = results[i];
const auto& record = record_array_[i];
ConstructResult(results);
rc.Record("construct result");
rc.Elapse("total cost");
thrift::TopKQueryResult thrift_topk_result;
for(auto& pair : result) {
thrift::QueryResult thrift_result;
thrift_result.__set_id(pair.first);
thrift_result.__set_distance(pair.second);
} catch (std::exception& ex) {
return SetError(SERVER_UNEXPECTED_ERROR, ex.what());
}
thrift_topk_result.query_result_arrays.emplace_back(thrift_result);
}
return SERVER_SUCCESS;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SearchVectorTask1::SearchVectorTask1(const std::string &table_name,
const std::vector<std::string>& file_id_array,
const std::vector<thrift::RowRecord> &query_record_array,
const std::vector<thrift::Range> &query_range_array,
const int64_t top_k,
std::vector<thrift::TopKQueryResult> &result_array)
: SearchVectorTaskBase(table_name, file_id_array, query_record_array, query_range_array, top_k),
result_array_(result_array) {
}
BaseTaskPtr SearchVectorTask1::Create(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<thrift::RowRecord> & query_record_array,
const std::vector<thrift::Range> & query_range_array,
const int64_t top_k,
std::vector<thrift::TopKQueryResult>& result_array) {
return std::shared_ptr<BaseTask>(new SearchVectorTask1(table_name, file_id_array,
query_record_array, query_range_array, top_k, result_array));
}
ServerError SearchVectorTask1::ConstructResult(engine::QueryResults& results) {
for(uint64_t i = 0; i < results.size(); i++) {
auto& result = results[i];
const auto& record = record_array_[i];
thrift::TopKQueryResult thrift_topk_result;
for(auto& pair : result) {
thrift::QueryResult thrift_result;
thrift_result.__set_id(pair.first);
thrift_result.__set_distance(pair.second);
thrift_topk_result.query_result_arrays.emplace_back(thrift_result);
}
result_array_.emplace_back(thrift_topk_result);
}
return SERVER_SUCCESS;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SearchVectorTask2::SearchVectorTask2(const std::string &table_name,
const std::vector<std::string>& file_id_array,
const std::vector<thrift::RowRecord> &query_record_array,
const std::vector<thrift::Range> &query_range_array,
const int64_t top_k,
std::vector<thrift::TopKQueryBinResult> &result_array)
: SearchVectorTaskBase(table_name, file_id_array, query_record_array, query_range_array, top_k),
result_array_(result_array) {
}
BaseTaskPtr SearchVectorTask2::Create(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<thrift::RowRecord> & query_record_array,
const std::vector<thrift::Range> & query_range_array,
const int64_t top_k,
std::vector<thrift::TopKQueryBinResult>& result_array) {
return std::shared_ptr<BaseTask>(new SearchVectorTask2(table_name, file_id_array,
query_record_array, query_range_array, top_k, result_array));
}
ServerError SearchVectorTask2::ConstructResult(engine::QueryResults& results) {
for(size_t i = 0; i < results.size(); i++) {
auto& result = results[i];
thrift::TopKQueryBinResult thrift_topk_result;
if(result.empty()) {
result_array_.emplace_back(thrift_topk_result);
continue;
}
rc.Record("construct result");
rc.Elapse("total cost");
} catch (std::exception& ex) {
return SetError(SERVER_UNEXPECTED_ERROR, ex.what());
std::string str_ids, str_distances;
str_ids.resize(sizeof(engine::IDNumber)*result.size());
str_distances.resize(sizeof(double)*result.size());
engine::IDNumber* ids_ptr = (engine::IDNumber*)str_ids.data();
double* distance_ptr = (double*)str_distances.data();
for(size_t k = 0; k < results.size(); k++) {
auto& pair = result[k];
ids_ptr[k] = pair.first;
distance_ptr[k] = pair.second;
}
thrift_topk_result.__set_id_array(str_ids);
thrift_topk_result.__set_distance_array(str_distances);
result_array_.emplace_back(thrift_topk_result);
}
return SERVER_SUCCESS;
......
......@@ -129,7 +129,28 @@ private:
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class SearchVectorTask : public BaseTask {
class SearchVectorTaskBase : public BaseTask {
protected:
SearchVectorTaskBase(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<::milvus::thrift::RowRecord> & query_record_array,
const std::vector<::milvus::thrift::Range> & query_range_array,
const int64_t top_k);
ServerError OnExecute() override;
virtual ServerError ConstructResult(engine::QueryResults& results) = 0;
protected:
std::string table_name_;
std::vector<std::string> file_id_array_;
int64_t top_k_;
const std::vector<::milvus::thrift::RowRecord>& record_array_;
const std::vector<::milvus::thrift::Range>& range_array_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class SearchVectorTask1 : public SearchVectorTaskBase {
public:
static BaseTaskPtr Create(const std::string& table_name,
const std::vector<std::string>& file_id_array,
......@@ -139,24 +160,43 @@ public:
std::vector<::milvus::thrift::TopKQueryResult>& result_array);
protected:
SearchVectorTask(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<::milvus::thrift::RowRecord> & query_record_array,
const std::vector<::milvus::thrift::Range> & query_range_array,
const int64_t top_k,
SearchVectorTask1(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<::milvus::thrift::RowRecord> & query_record_array,
const std::vector<::milvus::thrift::Range> & query_range_array,
const int64_t top_k,
std::vector<::milvus::thrift::TopKQueryResult>& result_array);
ServerError OnExecute() override;
ServerError ConstructResult(engine::QueryResults& results) override;
private:
std::string table_name_;
std::vector<std::string> file_id_array_;
int64_t top_k_;
const std::vector<::milvus::thrift::RowRecord>& record_array_;
const std::vector<::milvus::thrift::Range>& range_array_;
std::vector<::milvus::thrift::TopKQueryResult>& result_array_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class SearchVectorTask2 : public SearchVectorTaskBase {
public:
static BaseTaskPtr Create(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<::milvus::thrift::RowRecord> & query_record_array,
const std::vector<::milvus::thrift::Range> & query_range_array,
const int64_t top_k,
std::vector<::milvus::thrift::TopKQueryBinResult>& result_array);
protected:
SearchVectorTask2(const std::string& table_name,
const std::vector<std::string>& file_id_array,
const std::vector<::milvus::thrift::RowRecord> & query_record_array,
const std::vector<::milvus::thrift::Range> & query_range_array,
const int64_t top_k,
std::vector<::milvus::thrift::TopKQueryBinResult>& result_array);
ServerError ConstructResult(engine::QueryResults& results) override;
private:
std::vector<::milvus::thrift::TopKQueryBinResult>& result_array_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class GetTableRowCountTask : public BaseTask {
public:
......
......@@ -814,14 +814,14 @@ uint32_t MilvusService_AddVector_args::read(::apache::thrift::protocol::TProtoco
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->record_array.clear();
uint32_t _size19;
::apache::thrift::protocol::TType _etype22;
xfer += iprot->readListBegin(_etype22, _size19);
this->record_array.resize(_size19);
uint32_t _i23;
for (_i23 = 0; _i23 < _size19; ++_i23)
uint32_t _size21;
::apache::thrift::protocol::TType _etype24;
xfer += iprot->readListBegin(_etype24, _size21);
this->record_array.resize(_size21);
uint32_t _i25;
for (_i25 = 0; _i25 < _size21; ++_i25)
{
xfer += this->record_array[_i23].read(iprot);
xfer += this->record_array[_i25].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -854,10 +854,10 @@ uint32_t MilvusService_AddVector_args::write(::apache::thrift::protocol::TProtoc
xfer += oprot->writeFieldBegin("record_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->record_array.size()));
std::vector<RowRecord> ::const_iterator _iter24;
for (_iter24 = this->record_array.begin(); _iter24 != this->record_array.end(); ++_iter24)
std::vector<RowRecord> ::const_iterator _iter26;
for (_iter26 = this->record_array.begin(); _iter26 != this->record_array.end(); ++_iter26)
{
xfer += (*_iter24).write(oprot);
xfer += (*_iter26).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -885,10 +885,10 @@ uint32_t MilvusService_AddVector_pargs::write(::apache::thrift::protocol::TProto
xfer += oprot->writeFieldBegin("record_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->record_array)).size()));
std::vector<RowRecord> ::const_iterator _iter25;
for (_iter25 = (*(this->record_array)).begin(); _iter25 != (*(this->record_array)).end(); ++_iter25)
std::vector<RowRecord> ::const_iterator _iter27;
for (_iter27 = (*(this->record_array)).begin(); _iter27 != (*(this->record_array)).end(); ++_iter27)
{
xfer += (*_iter25).write(oprot);
xfer += (*_iter27).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -929,14 +929,14 @@ uint32_t MilvusService_AddVector_result::read(::apache::thrift::protocol::TProto
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->success.clear();
uint32_t _size26;
::apache::thrift::protocol::TType _etype29;
xfer += iprot->readListBegin(_etype29, _size26);
this->success.resize(_size26);
uint32_t _i30;
for (_i30 = 0; _i30 < _size26; ++_i30)
uint32_t _size28;
::apache::thrift::protocol::TType _etype31;
xfer += iprot->readListBegin(_etype31, _size28);
this->success.resize(_size28);
uint32_t _i32;
for (_i32 = 0; _i32 < _size28; ++_i32)
{
xfer += iprot->readI64(this->success[_i30]);
xfer += iprot->readI64(this->success[_i32]);
}
xfer += iprot->readListEnd();
}
......@@ -975,10 +975,10 @@ uint32_t MilvusService_AddVector_result::write(::apache::thrift::protocol::TProt
xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->success.size()));
std::vector<int64_t> ::const_iterator _iter31;
for (_iter31 = this->success.begin(); _iter31 != this->success.end(); ++_iter31)
std::vector<int64_t> ::const_iterator _iter33;
for (_iter33 = this->success.begin(); _iter33 != this->success.end(); ++_iter33)
{
xfer += oprot->writeI64((*_iter31));
xfer += oprot->writeI64((*_iter33));
}
xfer += oprot->writeListEnd();
}
......@@ -1023,14 +1023,14 @@ uint32_t MilvusService_AddVector_presult::read(::apache::thrift::protocol::TProt
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
(*(this->success)).clear();
uint32_t _size32;
::apache::thrift::protocol::TType _etype35;
xfer += iprot->readListBegin(_etype35, _size32);
(*(this->success)).resize(_size32);
uint32_t _i36;
for (_i36 = 0; _i36 < _size32; ++_i36)
uint32_t _size34;
::apache::thrift::protocol::TType _etype37;
xfer += iprot->readListBegin(_etype37, _size34);
(*(this->success)).resize(_size34);
uint32_t _i38;
for (_i38 = 0; _i38 < _size34; ++_i38)
{
xfer += iprot->readI64((*(this->success))[_i36]);
xfer += iprot->readI64((*(this->success))[_i38]);
}
xfer += iprot->readListEnd();
}
......@@ -1097,14 +1097,14 @@ uint32_t MilvusService_SearchVector_args::read(::apache::thrift::protocol::TProt
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->query_record_array.clear();
uint32_t _size37;
::apache::thrift::protocol::TType _etype40;
xfer += iprot->readListBegin(_etype40, _size37);
this->query_record_array.resize(_size37);
uint32_t _i41;
for (_i41 = 0; _i41 < _size37; ++_i41)
uint32_t _size39;
::apache::thrift::protocol::TType _etype42;
xfer += iprot->readListBegin(_etype42, _size39);
this->query_record_array.resize(_size39);
uint32_t _i43;
for (_i43 = 0; _i43 < _size39; ++_i43)
{
xfer += this->query_record_array[_i41].read(iprot);
xfer += this->query_record_array[_i43].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -1117,14 +1117,14 @@ uint32_t MilvusService_SearchVector_args::read(::apache::thrift::protocol::TProt
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->query_range_array.clear();
uint32_t _size42;
::apache::thrift::protocol::TType _etype45;
xfer += iprot->readListBegin(_etype45, _size42);
this->query_range_array.resize(_size42);
uint32_t _i46;
for (_i46 = 0; _i46 < _size42; ++_i46)
uint32_t _size44;
::apache::thrift::protocol::TType _etype47;
xfer += iprot->readListBegin(_etype47, _size44);
this->query_range_array.resize(_size44);
uint32_t _i48;
for (_i48 = 0; _i48 < _size44; ++_i48)
{
xfer += this->query_range_array[_i46].read(iprot);
xfer += this->query_range_array[_i48].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -1165,10 +1165,10 @@ uint32_t MilvusService_SearchVector_args::write(::apache::thrift::protocol::TPro
xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->query_record_array.size()));
std::vector<RowRecord> ::const_iterator _iter47;
for (_iter47 = this->query_record_array.begin(); _iter47 != this->query_record_array.end(); ++_iter47)
std::vector<RowRecord> ::const_iterator _iter49;
for (_iter49 = this->query_record_array.begin(); _iter49 != this->query_record_array.end(); ++_iter49)
{
xfer += (*_iter47).write(oprot);
xfer += (*_iter49).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1177,10 +1177,10 @@ uint32_t MilvusService_SearchVector_args::write(::apache::thrift::protocol::TPro
xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->query_range_array.size()));
std::vector<Range> ::const_iterator _iter48;
for (_iter48 = this->query_range_array.begin(); _iter48 != this->query_range_array.end(); ++_iter48)
std::vector<Range> ::const_iterator _iter50;
for (_iter50 = this->query_range_array.begin(); _iter50 != this->query_range_array.end(); ++_iter50)
{
xfer += (*_iter48).write(oprot);
xfer += (*_iter50).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1212,10 +1212,10 @@ uint32_t MilvusService_SearchVector_pargs::write(::apache::thrift::protocol::TPr
xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->query_record_array)).size()));
std::vector<RowRecord> ::const_iterator _iter49;
for (_iter49 = (*(this->query_record_array)).begin(); _iter49 != (*(this->query_record_array)).end(); ++_iter49)
std::vector<RowRecord> ::const_iterator _iter51;
for (_iter51 = (*(this->query_record_array)).begin(); _iter51 != (*(this->query_record_array)).end(); ++_iter51)
{
xfer += (*_iter49).write(oprot);
xfer += (*_iter51).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1224,10 +1224,10 @@ uint32_t MilvusService_SearchVector_pargs::write(::apache::thrift::protocol::TPr
xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->query_range_array)).size()));
std::vector<Range> ::const_iterator _iter50;
for (_iter50 = (*(this->query_range_array)).begin(); _iter50 != (*(this->query_range_array)).end(); ++_iter50)
std::vector<Range> ::const_iterator _iter52;
for (_iter52 = (*(this->query_range_array)).begin(); _iter52 != (*(this->query_range_array)).end(); ++_iter52)
{
xfer += (*_iter50).write(oprot);
xfer += (*_iter52).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1272,14 +1272,14 @@ uint32_t MilvusService_SearchVector_result::read(::apache::thrift::protocol::TPr
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->success.clear();
uint32_t _size51;
::apache::thrift::protocol::TType _etype54;
xfer += iprot->readListBegin(_etype54, _size51);
this->success.resize(_size51);
uint32_t _i55;
for (_i55 = 0; _i55 < _size51; ++_i55)
uint32_t _size53;
::apache::thrift::protocol::TType _etype56;
xfer += iprot->readListBegin(_etype56, _size53);
this->success.resize(_size53);
uint32_t _i57;
for (_i57 = 0; _i57 < _size53; ++_i57)
{
xfer += this->success[_i55].read(iprot);
xfer += this->success[_i57].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -1318,10 +1318,10 @@ uint32_t MilvusService_SearchVector_result::write(::apache::thrift::protocol::TP
xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->success.size()));
std::vector<TopKQueryResult> ::const_iterator _iter56;
for (_iter56 = this->success.begin(); _iter56 != this->success.end(); ++_iter56)
std::vector<TopKQueryResult> ::const_iterator _iter58;
for (_iter58 = this->success.begin(); _iter58 != this->success.end(); ++_iter58)
{
xfer += (*_iter56).write(oprot);
xfer += (*_iter58).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1366,14 +1366,357 @@ uint32_t MilvusService_SearchVector_presult::read(::apache::thrift::protocol::TP
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
(*(this->success)).clear();
uint32_t _size57;
::apache::thrift::protocol::TType _etype60;
xfer += iprot->readListBegin(_etype60, _size57);
(*(this->success)).resize(_size57);
uint32_t _i61;
for (_i61 = 0; _i61 < _size57; ++_i61)
uint32_t _size59;
::apache::thrift::protocol::TType _etype62;
xfer += iprot->readListBegin(_etype62, _size59);
(*(this->success)).resize(_size59);
uint32_t _i63;
for (_i63 = 0; _i63 < _size59; ++_i63)
{
xfer += (*(this->success))[_i63].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.success = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->e.read(iprot);
this->__isset.e = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
MilvusService_SearchVector2_args::~MilvusService_SearchVector2_args() throw() {
}
uint32_t MilvusService_SearchVector2_args::read(::apache::thrift::protocol::TProtocol* iprot) {
::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->table_name);
this->__isset.table_name = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->query_record_array.clear();
uint32_t _size64;
::apache::thrift::protocol::TType _etype67;
xfer += iprot->readListBegin(_etype67, _size64);
this->query_record_array.resize(_size64);
uint32_t _i68;
for (_i68 = 0; _i68 < _size64; ++_i68)
{
xfer += this->query_record_array[_i68].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.query_record_array = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->query_range_array.clear();
uint32_t _size69;
::apache::thrift::protocol::TType _etype72;
xfer += iprot->readListBegin(_etype72, _size69);
this->query_range_array.resize(_size69);
uint32_t _i73;
for (_i73 = 0; _i73 < _size69; ++_i73)
{
xfer += this->query_range_array[_i73].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.query_range_array = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->topk);
this->__isset.topk = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t MilvusService_SearchVector2_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
xfer += oprot->writeStructBegin("MilvusService_SearchVector2_args");
xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->table_name);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->query_record_array.size()));
std::vector<RowRecord> ::const_iterator _iter74;
for (_iter74 = this->query_record_array.begin(); _iter74 != this->query_record_array.end(); ++_iter74)
{
xfer += (*_iter74).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->query_range_array.size()));
std::vector<Range> ::const_iterator _iter75;
for (_iter75 = this->query_range_array.begin(); _iter75 != this->query_range_array.end(); ++_iter75)
{
xfer += (*_iter75).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 5);
xfer += oprot->writeI64(this->topk);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
MilvusService_SearchVector2_pargs::~MilvusService_SearchVector2_pargs() throw() {
}
uint32_t MilvusService_SearchVector2_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
xfer += oprot->writeStructBegin("MilvusService_SearchVector2_pargs");
xfer += oprot->writeFieldBegin("table_name", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString((*(this->table_name)));
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->query_record_array)).size()));
std::vector<RowRecord> ::const_iterator _iter76;
for (_iter76 = (*(this->query_record_array)).begin(); _iter76 != (*(this->query_record_array)).end(); ++_iter76)
{
xfer += (*_iter76).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->query_range_array)).size()));
std::vector<Range> ::const_iterator _iter77;
for (_iter77 = (*(this->query_range_array)).begin(); _iter77 != (*(this->query_range_array)).end(); ++_iter77)
{
xfer += (*_iter77).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("topk", ::apache::thrift::protocol::T_I64, 5);
xfer += oprot->writeI64((*(this->topk)));
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
MilvusService_SearchVector2_result::~MilvusService_SearchVector2_result() throw() {
}
uint32_t MilvusService_SearchVector2_result::read(::apache::thrift::protocol::TProtocol* iprot) {
::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->success.clear();
uint32_t _size78;
::apache::thrift::protocol::TType _etype81;
xfer += iprot->readListBegin(_etype81, _size78);
this->success.resize(_size78);
uint32_t _i82;
for (_i82 = 0; _i82 < _size78; ++_i82)
{
xfer += this->success[_i82].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.success = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->e.read(iprot);
this->__isset.e = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t MilvusService_SearchVector2_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("MilvusService_SearchVector2_result");
if (this->__isset.success) {
xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->success.size()));
std::vector<TopKQueryBinResult> ::const_iterator _iter83;
for (_iter83 = this->success.begin(); _iter83 != this->success.end(); ++_iter83)
{
xfer += (*_iter83).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
} else if (this->__isset.e) {
xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->e.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
MilvusService_SearchVector2_presult::~MilvusService_SearchVector2_presult() throw() {
}
uint32_t MilvusService_SearchVector2_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 0:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
(*(this->success)).clear();
uint32_t _size84;
::apache::thrift::protocol::TType _etype87;
xfer += iprot->readListBegin(_etype87, _size84);
(*(this->success)).resize(_size84);
uint32_t _i88;
for (_i88 = 0; _i88 < _size84; ++_i88)
{
xfer += (*(this->success))[_i61].read(iprot);
xfer += (*(this->success))[_i88].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -1440,14 +1783,14 @@ uint32_t MilvusService_SearchVectorInFiles_args::read(::apache::thrift::protocol
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->file_id_array.clear();
uint32_t _size62;
::apache::thrift::protocol::TType _etype65;
xfer += iprot->readListBegin(_etype65, _size62);
this->file_id_array.resize(_size62);
uint32_t _i66;
for (_i66 = 0; _i66 < _size62; ++_i66)
uint32_t _size89;
::apache::thrift::protocol::TType _etype92;
xfer += iprot->readListBegin(_etype92, _size89);
this->file_id_array.resize(_size89);
uint32_t _i93;
for (_i93 = 0; _i93 < _size89; ++_i93)
{
xfer += iprot->readString(this->file_id_array[_i66]);
xfer += iprot->readString(this->file_id_array[_i93]);
}
xfer += iprot->readListEnd();
}
......@@ -1460,14 +1803,14 @@ uint32_t MilvusService_SearchVectorInFiles_args::read(::apache::thrift::protocol
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->query_record_array.clear();
uint32_t _size67;
::apache::thrift::protocol::TType _etype70;
xfer += iprot->readListBegin(_etype70, _size67);
this->query_record_array.resize(_size67);
uint32_t _i71;
for (_i71 = 0; _i71 < _size67; ++_i71)
uint32_t _size94;
::apache::thrift::protocol::TType _etype97;
xfer += iprot->readListBegin(_etype97, _size94);
this->query_record_array.resize(_size94);
uint32_t _i98;
for (_i98 = 0; _i98 < _size94; ++_i98)
{
xfer += this->query_record_array[_i71].read(iprot);
xfer += this->query_record_array[_i98].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -1480,14 +1823,14 @@ uint32_t MilvusService_SearchVectorInFiles_args::read(::apache::thrift::protocol
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->query_range_array.clear();
uint32_t _size72;
::apache::thrift::protocol::TType _etype75;
xfer += iprot->readListBegin(_etype75, _size72);
this->query_range_array.resize(_size72);
uint32_t _i76;
for (_i76 = 0; _i76 < _size72; ++_i76)
uint32_t _size99;
::apache::thrift::protocol::TType _etype102;
xfer += iprot->readListBegin(_etype102, _size99);
this->query_range_array.resize(_size99);
uint32_t _i103;
for (_i103 = 0; _i103 < _size99; ++_i103)
{
xfer += this->query_range_array[_i76].read(iprot);
xfer += this->query_range_array[_i103].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -1528,10 +1871,10 @@ uint32_t MilvusService_SearchVectorInFiles_args::write(::apache::thrift::protoco
xfer += oprot->writeFieldBegin("file_id_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->file_id_array.size()));
std::vector<std::string> ::const_iterator _iter77;
for (_iter77 = this->file_id_array.begin(); _iter77 != this->file_id_array.end(); ++_iter77)
std::vector<std::string> ::const_iterator _iter104;
for (_iter104 = this->file_id_array.begin(); _iter104 != this->file_id_array.end(); ++_iter104)
{
xfer += oprot->writeString((*_iter77));
xfer += oprot->writeString((*_iter104));
}
xfer += oprot->writeListEnd();
}
......@@ -1540,10 +1883,10 @@ uint32_t MilvusService_SearchVectorInFiles_args::write(::apache::thrift::protoco
xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->query_record_array.size()));
std::vector<RowRecord> ::const_iterator _iter78;
for (_iter78 = this->query_record_array.begin(); _iter78 != this->query_record_array.end(); ++_iter78)
std::vector<RowRecord> ::const_iterator _iter105;
for (_iter105 = this->query_record_array.begin(); _iter105 != this->query_record_array.end(); ++_iter105)
{
xfer += (*_iter78).write(oprot);
xfer += (*_iter105).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1552,10 +1895,10 @@ uint32_t MilvusService_SearchVectorInFiles_args::write(::apache::thrift::protoco
xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 5);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->query_range_array.size()));
std::vector<Range> ::const_iterator _iter79;
for (_iter79 = this->query_range_array.begin(); _iter79 != this->query_range_array.end(); ++_iter79)
std::vector<Range> ::const_iterator _iter106;
for (_iter106 = this->query_range_array.begin(); _iter106 != this->query_range_array.end(); ++_iter106)
{
xfer += (*_iter79).write(oprot);
xfer += (*_iter106).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1587,10 +1930,10 @@ uint32_t MilvusService_SearchVectorInFiles_pargs::write(::apache::thrift::protoc
xfer += oprot->writeFieldBegin("file_id_array", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>((*(this->file_id_array)).size()));
std::vector<std::string> ::const_iterator _iter80;
for (_iter80 = (*(this->file_id_array)).begin(); _iter80 != (*(this->file_id_array)).end(); ++_iter80)
std::vector<std::string> ::const_iterator _iter107;
for (_iter107 = (*(this->file_id_array)).begin(); _iter107 != (*(this->file_id_array)).end(); ++_iter107)
{
xfer += oprot->writeString((*_iter80));
xfer += oprot->writeString((*_iter107));
}
xfer += oprot->writeListEnd();
}
......@@ -1599,10 +1942,10 @@ uint32_t MilvusService_SearchVectorInFiles_pargs::write(::apache::thrift::protoc
xfer += oprot->writeFieldBegin("query_record_array", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->query_record_array)).size()));
std::vector<RowRecord> ::const_iterator _iter81;
for (_iter81 = (*(this->query_record_array)).begin(); _iter81 != (*(this->query_record_array)).end(); ++_iter81)
std::vector<RowRecord> ::const_iterator _iter108;
for (_iter108 = (*(this->query_record_array)).begin(); _iter108 != (*(this->query_record_array)).end(); ++_iter108)
{
xfer += (*_iter81).write(oprot);
xfer += (*_iter108).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1611,10 +1954,10 @@ uint32_t MilvusService_SearchVectorInFiles_pargs::write(::apache::thrift::protoc
xfer += oprot->writeFieldBegin("query_range_array", ::apache::thrift::protocol::T_LIST, 5);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->query_range_array)).size()));
std::vector<Range> ::const_iterator _iter82;
for (_iter82 = (*(this->query_range_array)).begin(); _iter82 != (*(this->query_range_array)).end(); ++_iter82)
std::vector<Range> ::const_iterator _iter109;
for (_iter109 = (*(this->query_range_array)).begin(); _iter109 != (*(this->query_range_array)).end(); ++_iter109)
{
xfer += (*_iter82).write(oprot);
xfer += (*_iter109).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1659,14 +2002,14 @@ uint32_t MilvusService_SearchVectorInFiles_result::read(::apache::thrift::protoc
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->success.clear();
uint32_t _size83;
::apache::thrift::protocol::TType _etype86;
xfer += iprot->readListBegin(_etype86, _size83);
this->success.resize(_size83);
uint32_t _i87;
for (_i87 = 0; _i87 < _size83; ++_i87)
uint32_t _size110;
::apache::thrift::protocol::TType _etype113;
xfer += iprot->readListBegin(_etype113, _size110);
this->success.resize(_size110);
uint32_t _i114;
for (_i114 = 0; _i114 < _size110; ++_i114)
{
xfer += this->success[_i87].read(iprot);
xfer += this->success[_i114].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -1705,10 +2048,10 @@ uint32_t MilvusService_SearchVectorInFiles_result::write(::apache::thrift::proto
xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->success.size()));
std::vector<TopKQueryResult> ::const_iterator _iter88;
for (_iter88 = this->success.begin(); _iter88 != this->success.end(); ++_iter88)
std::vector<TopKQueryResult> ::const_iterator _iter115;
for (_iter115 = this->success.begin(); _iter115 != this->success.end(); ++_iter115)
{
xfer += (*_iter88).write(oprot);
xfer += (*_iter115).write(oprot);
}
xfer += oprot->writeListEnd();
}
......@@ -1753,14 +2096,14 @@ uint32_t MilvusService_SearchVectorInFiles_presult::read(::apache::thrift::proto
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
(*(this->success)).clear();
uint32_t _size89;
::apache::thrift::protocol::TType _etype92;
xfer += iprot->readListBegin(_etype92, _size89);
(*(this->success)).resize(_size89);
uint32_t _i93;
for (_i93 = 0; _i93 < _size89; ++_i93)
uint32_t _size116;
::apache::thrift::protocol::TType _etype119;
xfer += iprot->readListBegin(_etype119, _size116);
(*(this->success)).resize(_size116);
uint32_t _i120;
for (_i120 = 0; _i120 < _size116; ++_i120)
{
xfer += (*(this->success))[_i93].read(iprot);
xfer += (*(this->success))[_i120].read(iprot);
}
xfer += iprot->readListEnd();
}
......@@ -2291,14 +2634,14 @@ uint32_t MilvusService_ShowTables_result::read(::apache::thrift::protocol::TProt
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->success.clear();
uint32_t _size94;
::apache::thrift::protocol::TType _etype97;
xfer += iprot->readListBegin(_etype97, _size94);
this->success.resize(_size94);
uint32_t _i98;
for (_i98 = 0; _i98 < _size94; ++_i98)
uint32_t _size121;
::apache::thrift::protocol::TType _etype124;
xfer += iprot->readListBegin(_etype124, _size121);
this->success.resize(_size121);
uint32_t _i125;
for (_i125 = 0; _i125 < _size121; ++_i125)
{
xfer += iprot->readString(this->success[_i98]);
xfer += iprot->readString(this->success[_i125]);
}
xfer += iprot->readListEnd();
}
......@@ -2337,10 +2680,10 @@ uint32_t MilvusService_ShowTables_result::write(::apache::thrift::protocol::TPro
xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->success.size()));
std::vector<std::string> ::const_iterator _iter99;
for (_iter99 = this->success.begin(); _iter99 != this->success.end(); ++_iter99)
std::vector<std::string> ::const_iterator _iter126;
for (_iter126 = this->success.begin(); _iter126 != this->success.end(); ++_iter126)
{
xfer += oprot->writeString((*_iter99));
xfer += oprot->writeString((*_iter126));
}
xfer += oprot->writeListEnd();
}
......@@ -2385,14 +2728,14 @@ uint32_t MilvusService_ShowTables_presult::read(::apache::thrift::protocol::TPro
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
(*(this->success)).clear();
uint32_t _size100;
::apache::thrift::protocol::TType _etype103;
xfer += iprot->readListBegin(_etype103, _size100);
(*(this->success)).resize(_size100);
uint32_t _i104;
for (_i104 = 0; _i104 < _size100; ++_i104)
uint32_t _size127;
::apache::thrift::protocol::TType _etype130;
xfer += iprot->readListBegin(_etype130, _size127);
(*(this->success)).resize(_size127);
uint32_t _i131;
for (_i131 = 0; _i131 < _size127; ++_i131)
{
xfer += iprot->readString((*(this->success))[_i104]);
xfer += iprot->readString((*(this->success))[_i131]);
}
xfer += iprot->readListEnd();
}
......@@ -2983,6 +3326,70 @@ void MilvusServiceClient::recv_SearchVector(std::vector<TopKQueryResult> & _retu
throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVector failed: unknown result");
}
void MilvusServiceClient::SearchVector2(std::vector<TopKQueryBinResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk)
{
send_SearchVector2(table_name, query_record_array, query_range_array, topk);
recv_SearchVector2(_return);
}
void MilvusServiceClient::send_SearchVector2(const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk)
{
int32_t cseqid = 0;
oprot_->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_CALL, cseqid);
MilvusService_SearchVector2_pargs args;
args.table_name = &table_name;
args.query_record_array = &query_record_array;
args.query_range_array = &query_range_array;
args.topk = &topk;
args.write(oprot_);
oprot_->writeMessageEnd();
oprot_->getTransport()->writeEnd();
oprot_->getTransport()->flush();
}
void MilvusServiceClient::recv_SearchVector2(std::vector<TopKQueryBinResult> & _return)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
iprot_->readMessageBegin(fname, mtype, rseqid);
if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
::apache::thrift::TApplicationException x;
x.read(iprot_);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY) {
iprot_->skip(::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
}
if (fname.compare("SearchVector2") != 0) {
iprot_->skip(::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
}
MilvusService_SearchVector2_presult result;
result.success = &_return;
result.read(iprot_);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
if (result.__isset.success) {
// _return pointer has now been filled
return;
}
if (result.__isset.e) {
throw result.e;
}
throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVector2 failed: unknown result");
}
void MilvusServiceClient::SearchVectorInFiles(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<std::string> & file_id_array, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk)
{
send_SearchVectorInFiles(table_name, file_id_array, query_record_array, query_range_array, topk);
......@@ -3649,6 +4056,63 @@ void MilvusServiceProcessor::process_SearchVector(int32_t seqid, ::apache::thrif
}
}
void MilvusServiceProcessor::process_SearchVector2(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
if (this->eventHandler_.get() != NULL) {
ctx = this->eventHandler_->getContext("MilvusService.SearchVector2", callContext);
}
::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "MilvusService.SearchVector2");
if (this->eventHandler_.get() != NULL) {
this->eventHandler_->preRead(ctx, "MilvusService.SearchVector2");
}
MilvusService_SearchVector2_args args;
args.read(iprot);
iprot->readMessageEnd();
uint32_t bytes = iprot->getTransport()->readEnd();
if (this->eventHandler_.get() != NULL) {
this->eventHandler_->postRead(ctx, "MilvusService.SearchVector2", bytes);
}
MilvusService_SearchVector2_result result;
try {
iface_->SearchVector2(result.success, args.table_name, args.query_record_array, args.query_range_array, args.topk);
result.__isset.success = true;
} catch (Exception &e) {
result.e = e;
result.__isset.e = true;
} catch (const std::exception& e) {
if (this->eventHandler_.get() != NULL) {
this->eventHandler_->handlerError(ctx, "MilvusService.SearchVector2");
}
::apache::thrift::TApplicationException x(e.what());
oprot->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_EXCEPTION, seqid);
x.write(oprot);
oprot->writeMessageEnd();
oprot->getTransport()->writeEnd();
oprot->getTransport()->flush();
return;
}
if (this->eventHandler_.get() != NULL) {
this->eventHandler_->preWrite(ctx, "MilvusService.SearchVector2");
}
oprot->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_REPLY, seqid);
result.write(oprot);
oprot->writeMessageEnd();
bytes = oprot->getTransport()->writeEnd();
oprot->getTransport()->flush();
if (this->eventHandler_.get() != NULL) {
this->eventHandler_->postWrite(ctx, "MilvusService.SearchVector2", bytes);
}
}
void MilvusServiceProcessor::process_SearchVectorInFiles(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
void* ctx = NULL;
......@@ -4455,6 +4919,97 @@ void MilvusServiceConcurrentClient::recv_SearchVector(std::vector<TopKQueryResul
} // end while(true)
}
void MilvusServiceConcurrentClient::SearchVector2(std::vector<TopKQueryBinResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk)
{
int32_t seqid = send_SearchVector2(table_name, query_record_array, query_range_array, topk);
recv_SearchVector2(_return, seqid);
}
int32_t MilvusServiceConcurrentClient::send_SearchVector2(const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk)
{
int32_t cseqid = this->sync_.generateSeqId();
::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_);
oprot_->writeMessageBegin("SearchVector2", ::apache::thrift::protocol::T_CALL, cseqid);
MilvusService_SearchVector2_pargs args;
args.table_name = &table_name;
args.query_record_array = &query_record_array;
args.query_range_array = &query_range_array;
args.topk = &topk;
args.write(oprot_);
oprot_->writeMessageEnd();
oprot_->getTransport()->writeEnd();
oprot_->getTransport()->flush();
sentry.commit();
return cseqid;
}
void MilvusServiceConcurrentClient::recv_SearchVector2(std::vector<TopKQueryBinResult> & _return, const int32_t seqid)
{
int32_t rseqid = 0;
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
// the read mutex gets dropped and reacquired as part of waitForWork()
// The destructor of this sentry wakes up other clients
::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid);
while(true) {
if(!this->sync_.getPending(fname, mtype, rseqid)) {
iprot_->readMessageBegin(fname, mtype, rseqid);
}
if(seqid == rseqid) {
if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
::apache::thrift::TApplicationException x;
x.read(iprot_);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
sentry.commit();
throw x;
}
if (mtype != ::apache::thrift::protocol::T_REPLY) {
iprot_->skip(::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
}
if (fname.compare("SearchVector2") != 0) {
iprot_->skip(::apache::thrift::protocol::T_STRUCT);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
// in a bad state, don't commit
using ::apache::thrift::protocol::TProtocolException;
throw TProtocolException(TProtocolException::INVALID_DATA);
}
MilvusService_SearchVector2_presult result;
result.success = &_return;
result.read(iprot_);
iprot_->readMessageEnd();
iprot_->getTransport()->readEnd();
if (result.__isset.success) {
// _return pointer has now been filled
sentry.commit();
return;
}
if (result.__isset.e) {
sentry.commit();
throw result.e;
}
// in a bad state, don't commit
throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "SearchVector2 failed: unknown result");
}
// seqid != rseqid
this->sync_.updatePending(fname, mtype, rseqid);
// this will temporarily unlock the readMutex, and let other clients get work done
this->sync_.waitForWork(seqid);
} // end while(true)
}
void MilvusServiceConcurrentClient::SearchVectorInFiles(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<std::string> & file_id_array, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk)
{
int32_t seqid = send_SearchVectorInFiles(table_name, file_id_array, query_record_array, query_range_array, topk);
......
......@@ -104,6 +104,25 @@ class MilvusServiceIf {
*/
virtual void SearchVector(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk) = 0;
/**
* @brief Query vector
*
* This method is used to query vector in table.
*
* @param table_name, table_name is queried.
* @param query_record_array, all vector are going to be queried.
* @param query_range_array, optional ranges for conditional search. If not specified, search whole table
* @param topk, how many similarity vectors will be searched.
*
* @return query binary result array.
*
* @param table_name
* @param query_record_array
* @param query_range_array
* @param topk
*/
virtual void SearchVector2(std::vector<TopKQueryBinResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk) = 0;
/**
* @brief Internal use query interface
*
......@@ -218,6 +237,9 @@ class MilvusServiceNull : virtual public MilvusServiceIf {
void SearchVector(std::vector<TopKQueryResult> & /* _return */, const std::string& /* table_name */, const std::vector<RowRecord> & /* query_record_array */, const std::vector<Range> & /* query_range_array */, const int64_t /* topk */) {
return;
}
void SearchVector2(std::vector<TopKQueryBinResult> & /* _return */, const std::string& /* table_name */, const std::vector<RowRecord> & /* query_record_array */, const std::vector<Range> & /* query_range_array */, const int64_t /* topk */) {
return;
}
void SearchVectorInFiles(std::vector<TopKQueryResult> & /* _return */, const std::string& /* table_name */, const std::vector<std::string> & /* file_id_array */, const std::vector<RowRecord> & /* query_record_array */, const std::vector<Range> & /* query_range_array */, const int64_t /* topk */) {
return;
}
......@@ -912,6 +934,139 @@ class MilvusService_SearchVector_presult {
};
typedef struct _MilvusService_SearchVector2_args__isset {
_MilvusService_SearchVector2_args__isset() : table_name(false), query_record_array(false), query_range_array(false), topk(false) {}
bool table_name :1;
bool query_record_array :1;
bool query_range_array :1;
bool topk :1;
} _MilvusService_SearchVector2_args__isset;
class MilvusService_SearchVector2_args {
public:
MilvusService_SearchVector2_args(const MilvusService_SearchVector2_args&);
MilvusService_SearchVector2_args& operator=(const MilvusService_SearchVector2_args&);
MilvusService_SearchVector2_args() : table_name(), topk(0) {
}
virtual ~MilvusService_SearchVector2_args() throw();
std::string table_name;
std::vector<RowRecord> query_record_array;
std::vector<Range> query_range_array;
int64_t topk;
_MilvusService_SearchVector2_args__isset __isset;
void __set_table_name(const std::string& val);
void __set_query_record_array(const std::vector<RowRecord> & val);
void __set_query_range_array(const std::vector<Range> & val);
void __set_topk(const int64_t val);
bool operator == (const MilvusService_SearchVector2_args & rhs) const
{
if (!(table_name == rhs.table_name))
return false;
if (!(query_record_array == rhs.query_record_array))
return false;
if (!(query_range_array == rhs.query_range_array))
return false;
if (!(topk == rhs.topk))
return false;
return true;
}
bool operator != (const MilvusService_SearchVector2_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const MilvusService_SearchVector2_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class MilvusService_SearchVector2_pargs {
public:
virtual ~MilvusService_SearchVector2_pargs() throw();
const std::string* table_name;
const std::vector<RowRecord> * query_record_array;
const std::vector<Range> * query_range_array;
const int64_t* topk;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _MilvusService_SearchVector2_result__isset {
_MilvusService_SearchVector2_result__isset() : success(false), e(false) {}
bool success :1;
bool e :1;
} _MilvusService_SearchVector2_result__isset;
class MilvusService_SearchVector2_result {
public:
MilvusService_SearchVector2_result(const MilvusService_SearchVector2_result&);
MilvusService_SearchVector2_result& operator=(const MilvusService_SearchVector2_result&);
MilvusService_SearchVector2_result() {
}
virtual ~MilvusService_SearchVector2_result() throw();
std::vector<TopKQueryBinResult> success;
Exception e;
_MilvusService_SearchVector2_result__isset __isset;
void __set_success(const std::vector<TopKQueryBinResult> & val);
void __set_e(const Exception& val);
bool operator == (const MilvusService_SearchVector2_result & rhs) const
{
if (!(success == rhs.success))
return false;
if (!(e == rhs.e))
return false;
return true;
}
bool operator != (const MilvusService_SearchVector2_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const MilvusService_SearchVector2_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _MilvusService_SearchVector2_presult__isset {
_MilvusService_SearchVector2_presult__isset() : success(false), e(false) {}
bool success :1;
bool e :1;
} _MilvusService_SearchVector2_presult__isset;
class MilvusService_SearchVector2_presult {
public:
virtual ~MilvusService_SearchVector2_presult() throw();
std::vector<TopKQueryBinResult> * success;
Exception e;
_MilvusService_SearchVector2_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _MilvusService_SearchVectorInFiles_args__isset {
_MilvusService_SearchVectorInFiles_args__isset() : table_name(false), file_id_array(false), query_record_array(false), query_range_array(false), topk(false) {}
bool table_name :1;
......@@ -1531,6 +1686,9 @@ class MilvusServiceClient : virtual public MilvusServiceIf {
void SearchVector(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void send_SearchVector(const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void recv_SearchVector(std::vector<TopKQueryResult> & _return);
void SearchVector2(std::vector<TopKQueryBinResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void send_SearchVector2(const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void recv_SearchVector2(std::vector<TopKQueryBinResult> & _return);
void SearchVectorInFiles(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<std::string> & file_id_array, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void send_SearchVectorInFiles(const std::string& table_name, const std::vector<std::string> & file_id_array, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void recv_SearchVectorInFiles(std::vector<TopKQueryResult> & _return);
......@@ -1567,6 +1725,7 @@ class MilvusServiceProcessor : public ::apache::thrift::TDispatchProcessor {
void process_BuildIndex(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_AddVector(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_SearchVector(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_SearchVector2(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_SearchVectorInFiles(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_DescribeTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_GetTableRowCount(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
......@@ -1581,6 +1740,7 @@ class MilvusServiceProcessor : public ::apache::thrift::TDispatchProcessor {
processMap_["BuildIndex"] = &MilvusServiceProcessor::process_BuildIndex;
processMap_["AddVector"] = &MilvusServiceProcessor::process_AddVector;
processMap_["SearchVector"] = &MilvusServiceProcessor::process_SearchVector;
processMap_["SearchVector2"] = &MilvusServiceProcessor::process_SearchVector2;
processMap_["SearchVectorInFiles"] = &MilvusServiceProcessor::process_SearchVectorInFiles;
processMap_["DescribeTable"] = &MilvusServiceProcessor::process_DescribeTable;
processMap_["GetTableRowCount"] = &MilvusServiceProcessor::process_GetTableRowCount;
......@@ -1670,6 +1830,16 @@ class MilvusServiceMultiface : virtual public MilvusServiceIf {
return;
}
void SearchVector2(std::vector<TopKQueryBinResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->SearchVector2(_return, table_name, query_record_array, query_range_array, topk);
}
ifaces_[i]->SearchVector2(_return, table_name, query_record_array, query_range_array, topk);
return;
}
void SearchVectorInFiles(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<std::string> & file_id_array, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk) {
size_t sz = ifaces_.size();
size_t i = 0;
......@@ -1767,6 +1937,9 @@ class MilvusServiceConcurrentClient : virtual public MilvusServiceIf {
void SearchVector(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
int32_t send_SearchVector(const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void recv_SearchVector(std::vector<TopKQueryResult> & _return, const int32_t seqid);
void SearchVector2(std::vector<TopKQueryBinResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
int32_t send_SearchVector2(const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void recv_SearchVector2(std::vector<TopKQueryBinResult> & _return, const int32_t seqid);
void SearchVectorInFiles(std::vector<TopKQueryResult> & _return, const std::string& table_name, const std::vector<std::string> & file_id_array, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
int32_t send_SearchVectorInFiles(const std::string& table_name, const std::vector<std::string> & file_id_array, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk);
void recv_SearchVectorInFiles(std::vector<TopKQueryResult> & _return, const int32_t seqid);
......
......@@ -120,6 +120,28 @@ class MilvusServiceHandler : virtual public MilvusServiceIf {
printf("SearchVector\n");
}
/**
* @brief Query vector
*
* This method is used to query vector in table.
*
* @param table_name, table_name is queried.
* @param query_record_array, all vector are going to be queried.
* @param query_range_array, optional ranges for conditional search. If not specified, search whole table
* @param topk, how many similarity vectors will be searched.
*
* @return query binary result array.
*
* @param table_name
* @param query_record_array
* @param query_range_array
* @param topk
*/
void SearchVector2(std::vector<TopKQueryBinResult> & _return, const std::string& table_name, const std::vector<RowRecord> & query_record_array, const std::vector<Range> & query_range_array, const int64_t topk) {
// Your implementation goes here
printf("SearchVector2\n");
}
/**
* @brief Internal use query interface
*
......
......@@ -781,4 +781,119 @@ void TopKQueryResult::printTo(std::ostream& out) const {
out << ")";
}
TopKQueryBinResult::~TopKQueryBinResult() throw() {
}
void TopKQueryBinResult::__set_id_array(const std::string& val) {
this->id_array = val;
}
void TopKQueryBinResult::__set_distance_array(const std::string& val) {
this->distance_array = val;
}
std::ostream& operator<<(std::ostream& out, const TopKQueryBinResult& obj)
{
obj.printTo(out);
return out;
}
uint32_t TopKQueryBinResult::read(::apache::thrift::protocol::TProtocol* iprot) {
::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_id_array = false;
bool isset_distance_array = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readBinary(this->id_array);
isset_id_array = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readBinary(this->distance_array);
isset_distance_array = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_id_array)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_distance_array)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TopKQueryBinResult::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
xfer += oprot->writeStructBegin("TopKQueryBinResult");
xfer += oprot->writeFieldBegin("id_array", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary(this->id_array);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("distance_array", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeBinary(this->distance_array);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TopKQueryBinResult &a, TopKQueryBinResult &b) {
using ::std::swap;
swap(a.id_array, b.id_array);
swap(a.distance_array, b.distance_array);
}
TopKQueryBinResult::TopKQueryBinResult(const TopKQueryBinResult& other19) {
id_array = other19.id_array;
distance_array = other19.distance_array;
}
TopKQueryBinResult& TopKQueryBinResult::operator=(const TopKQueryBinResult& other20) {
id_array = other20.id_array;
distance_array = other20.distance_array;
return *this;
}
void TopKQueryBinResult::printTo(std::ostream& out) const {
using ::apache::thrift::to_string;
out << "TopKQueryBinResult(";
out << "id_array=" << to_string(id_array);
out << ", " << "distance_array=" << to_string(distance_array);
out << ")";
}
}} // namespace
......@@ -63,6 +63,8 @@ class QueryResult;
class TopKQueryResult;
class TopKQueryBinResult;
typedef struct _Exception__isset {
_Exception__isset() : code(false), reason(false) {}
bool code :1;
......@@ -346,6 +348,47 @@ void swap(TopKQueryResult &a, TopKQueryResult &b);
std::ostream& operator<<(std::ostream& out, const TopKQueryResult& obj);
class TopKQueryBinResult : public virtual ::apache::thrift::TBase {
public:
TopKQueryBinResult(const TopKQueryBinResult&);
TopKQueryBinResult& operator=(const TopKQueryBinResult&);
TopKQueryBinResult() : id_array(), distance_array() {
}
virtual ~TopKQueryBinResult() throw();
std::string id_array;
std::string distance_array;
void __set_id_array(const std::string& val);
void __set_distance_array(const std::string& val);
bool operator == (const TopKQueryBinResult & rhs) const
{
if (!(id_array == rhs.id_array))
return false;
if (!(distance_array == rhs.distance_array))
return false;
return true;
}
bool operator != (const TopKQueryBinResult &rhs) const {
return !(*this == rhs);
}
bool operator < (const TopKQueryBinResult & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
virtual void printTo(std::ostream& out) const;
};
void swap(TopKQueryBinResult &a, TopKQueryBinResult &b);
std::ostream& operator<<(std::ostream& out, const TopKQueryBinResult& obj);
}} // namespace
#endif
......@@ -84,6 +84,14 @@ struct TopKQueryResult {
1: list<QueryResult> query_result_arrays; ///< TopK query result
}
/**
* @brief TopK query binary result
*/
struct TopKQueryBinResult {
1: required binary id_array; ///< id array, interger array
2: required binary distance_array; ///< distance array, double array
}
service MilvusService {
/**
* @brief Create table method
......@@ -158,6 +166,23 @@ service MilvusService {
4: list<Range> query_range_array,
5: i64 topk) throws(1: Exception e);
/**
* @brief Query vector
*
* This method is used to query vector in table.
*
* @param table_name, table_name is queried.
* @param query_record_array, all vector are going to be queried.
* @param query_range_array, optional ranges for conditional search. If not specified, search whole table
* @param topk, how many similarity vectors will be searched.
*
* @return query binary result array.
*/
list<TopKQueryBinResult> SearchVector2(2: string table_name,
3: list<RowRecord> query_record_array,
4: list<Range> query_range_array,
5: i64 topk) throws(1: Exception e);
/**
* @brief Internal use query interface
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册