Feat: count entities by expression (#22765)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/22806/head
Jiquan Long 2023-03-16 19:31:55 +08:00 committed by GitHub
parent 3d8f0156c7
commit 8139106b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 2035 additions and 302 deletions

View File

@ -263,6 +263,20 @@ struct VectorANNSDefaultTypeInternal {
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 VectorANNSDefaultTypeInternal _VectorANNS_default_instance_;
PROTOBUF_CONSTEXPR QueryPlanNode::QueryPlanNode(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.predicates_)*/nullptr
, /*decltype(_impl_.is_count_)*/false
, /*decltype(_impl_._cached_size_)*/{}} {}
struct QueryPlanNodeDefaultTypeInternal {
PROTOBUF_CONSTEXPR QueryPlanNodeDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~QueryPlanNodeDefaultTypeInternal() {}
union {
QueryPlanNode _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 QueryPlanNodeDefaultTypeInternal _QueryPlanNode_default_instance_;
PROTOBUF_CONSTEXPR PlanNode::PlanNode(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.output_field_ids_)*/{}
@ -282,7 +296,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
} // namespace plan
} // namespace proto
} // namespace milvus
static ::_pb::Metadata file_level_metadata_plan_2eproto[17];
static ::_pb::Metadata file_level_metadata_plan_2eproto[18];
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_plan_2eproto[4];
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_plan_2eproto = nullptr;
@ -444,6 +458,14 @@ const uint32_t TableStruct_plan_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(pro
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::VectorANNS, _impl_.query_info_),
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::VectorANNS, _impl_.placeholder_tag_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::QueryPlanNode, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::QueryPlanNode, _impl_.predicates_),
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::QueryPlanNode, _impl_.is_count_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::PlanNode, _internal_metadata_),
~0u, // no _extensions_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::PlanNode, _impl_._oneof_case_[0]),
@ -451,6 +473,7 @@ const uint32_t TableStruct_plan_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(pro
~0u, // no _inlined_string_donated_
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::PlanNode, _impl_.output_field_ids_),
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::PlanNode, _impl_.node_),
};
@ -471,7 +494,8 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode
{ 117, -1, -1, sizeof(::milvus::proto::plan::BinaryArithOpEvalRangeExpr)},
{ 128, -1, -1, sizeof(::milvus::proto::plan::Expr)},
{ 145, -1, -1, sizeof(::milvus::proto::plan::VectorANNS)},
{ 156, -1, -1, sizeof(::milvus::proto::plan::PlanNode)},
{ 156, -1, -1, sizeof(::milvus::proto::plan::QueryPlanNode)},
{ 164, -1, -1, sizeof(::milvus::proto::plan::PlanNode)},
};
static const ::_pb::Message* const file_default_instances[] = {
@ -491,6 +515,7 @@ static const ::_pb::Message* const file_default_instances[] = {
&::milvus::proto::plan::_BinaryArithOpEvalRangeExpr_default_instance_._instance,
&::milvus::proto::plan::_Expr_default_instance_._instance,
&::milvus::proto::plan::_VectorANNS_default_instance_._instance,
&::milvus::proto::plan::_QueryPlanNode_default_instance_._instance,
&::milvus::proto::plan::_PlanNode_default_instance_._instance,
};
@ -567,27 +592,31 @@ const char descriptor_table_protodef_plan_2eproto[] PROTOBUF_SECTION_VARIABLE(pr
"\030\002 \001(\003\022+\n\npredicates\030\003 \001(\0132\027.milvus.prot"
"o.plan.Expr\0220\n\nquery_info\030\004 \001(\0132\034.milvus"
".proto.plan.QueryInfo\022\027\n\017placeholder_tag"
"\030\005 \001(\t\"\221\001\n\010PlanNode\0224\n\013vector_anns\030\001 \001(\013"
"\030\005 \001(\t\"N\n\rQueryPlanNode\022+\n\npredicates\030\001 "
"\001(\0132\027.milvus.proto.plan.Expr\022\020\n\010is_count"
"\030\002 \001(\010\"\304\001\n\010PlanNode\0224\n\013vector_anns\030\001 \001(\013"
"2\035.milvus.proto.plan.VectorANNSH\000\022-\n\npre"
"dicates\030\002 \001(\0132\027.milvus.proto.plan.ExprH\000"
"\022\030\n\020output_field_ids\030\003 \003(\003B\006\n\004node*\272\001\n\006O"
"pType\022\013\n\007Invalid\020\000\022\017\n\013GreaterThan\020\001\022\020\n\014G"
"reaterEqual\020\002\022\014\n\010LessThan\020\003\022\r\n\tLessEqual"
"\020\004\022\t\n\005Equal\020\005\022\014\n\010NotEqual\020\006\022\017\n\013PrefixMat"
"ch\020\007\022\020\n\014PostfixMatch\020\010\022\t\n\005Match\020\t\022\t\n\005Ran"
"ge\020\n\022\006\n\002In\020\013\022\t\n\005NotIn\020\014*G\n\013ArithOpType\022\013"
"\n\007Unknown\020\000\022\007\n\003Add\020\001\022\007\n\003Sub\020\002\022\007\n\003Mul\020\003\022\007"
"\n\003Div\020\004\022\007\n\003Mod\020\005B3Z1github.com/milvus-io"
"/milvus/internal/proto/planpbb\006proto3"
"\0221\n\005query\030\004 \001(\0132 .milvus.proto.plan.Quer"
"yPlanNodeH\000\022\030\n\020output_field_ids\030\003 \003(\003B\006\n"
"\004node*\272\001\n\006OpType\022\013\n\007Invalid\020\000\022\017\n\013Greater"
"Than\020\001\022\020\n\014GreaterEqual\020\002\022\014\n\010LessThan\020\003\022\r"
"\n\tLessEqual\020\004\022\t\n\005Equal\020\005\022\014\n\010NotEqual\020\006\022\017"
"\n\013PrefixMatch\020\007\022\020\n\014PostfixMatch\020\010\022\t\n\005Mat"
"ch\020\t\022\t\n\005Range\020\n\022\006\n\002In\020\013\022\t\n\005NotIn\020\014*G\n\013Ar"
"ithOpType\022\013\n\007Unknown\020\000\022\007\n\003Add\020\001\022\007\n\003Sub\020\002"
"\022\007\n\003Mul\020\003\022\007\n\003Div\020\004\022\007\n\003Mod\020\005B3Z1github.co"
"m/milvus-io/milvus/internal/proto/planpb"
"b\006proto3"
;
static const ::_pbi::DescriptorTable* const descriptor_table_plan_2eproto_deps[1] = {
&::descriptor_table_schema_2eproto,
};
static ::_pbi::once_flag descriptor_table_plan_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_plan_2eproto = {
false, false, 3357, descriptor_table_protodef_plan_2eproto,
false, false, 3488, descriptor_table_protodef_plan_2eproto,
"plan.proto",
&descriptor_table_plan_2eproto_once, descriptor_table_plan_2eproto_deps, 1, 17,
&descriptor_table_plan_2eproto_once, descriptor_table_plan_2eproto_deps, 1, 18,
schemas, file_default_instances, TableStruct_plan_2eproto::offsets,
file_level_metadata_plan_2eproto, file_level_enum_descriptors_plan_2eproto,
file_level_service_descriptors_plan_2eproto,
@ -5555,10 +5584,235 @@ void VectorANNS::InternalSwap(VectorANNS* other) {
// ===================================================================
class QueryPlanNode::_Internal {
public:
static const ::milvus::proto::plan::Expr& predicates(const QueryPlanNode* msg);
};
const ::milvus::proto::plan::Expr&
QueryPlanNode::_Internal::predicates(const QueryPlanNode* msg) {
return *msg->_impl_.predicates_;
}
QueryPlanNode::QueryPlanNode(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:milvus.proto.plan.QueryPlanNode)
}
QueryPlanNode::QueryPlanNode(const QueryPlanNode& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
QueryPlanNode* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_.predicates_){nullptr}
, decltype(_impl_.is_count_){}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_predicates()) {
_this->_impl_.predicates_ = new ::milvus::proto::plan::Expr(*from._impl_.predicates_);
}
_this->_impl_.is_count_ = from._impl_.is_count_;
// @@protoc_insertion_point(copy_constructor:milvus.proto.plan.QueryPlanNode)
}
inline void QueryPlanNode::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.predicates_){nullptr}
, decltype(_impl_.is_count_){false}
, /*decltype(_impl_._cached_size_)*/{}
};
}
QueryPlanNode::~QueryPlanNode() {
// @@protoc_insertion_point(destructor:milvus.proto.plan.QueryPlanNode)
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void QueryPlanNode::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (this != internal_default_instance()) delete _impl_.predicates_;
}
void QueryPlanNode::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void QueryPlanNode::Clear() {
// @@protoc_insertion_point(message_clear_start:milvus.proto.plan.QueryPlanNode)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaForAllocation() == nullptr && _impl_.predicates_ != nullptr) {
delete _impl_.predicates_;
}
_impl_.predicates_ = nullptr;
_impl_.is_count_ = false;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* QueryPlanNode::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .milvus.proto.plan.Expr predicates = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_predicates(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// bool is_count = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
_impl_.is_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto message_done;
}
ptr = UnknownFieldParse(
tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
} // while
message_done:
return ptr;
failure:
ptr = nullptr;
goto message_done;
#undef CHK_
}
uint8_t* QueryPlanNode::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:milvus.proto.plan.QueryPlanNode)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// .milvus.proto.plan.Expr predicates = 1;
if (this->_internal_has_predicates()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(1, _Internal::predicates(this),
_Internal::predicates(this).GetCachedSize(), target, stream);
}
// bool is_count = 2;
if (this->_internal_is_count() != 0) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteBoolToArray(2, this->_internal_is_count(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:milvus.proto.plan.QueryPlanNode)
return target;
}
size_t QueryPlanNode::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:milvus.proto.plan.QueryPlanNode)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .milvus.proto.plan.Expr predicates = 1;
if (this->_internal_has_predicates()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.predicates_);
}
// bool is_count = 2;
if (this->_internal_is_count() != 0) {
total_size += 1 + 1;
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData QueryPlanNode::_class_data_ = {
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
QueryPlanNode::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*QueryPlanNode::GetClassData() const { return &_class_data_; }
void QueryPlanNode::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
auto* const _this = static_cast<QueryPlanNode*>(&to_msg);
auto& from = static_cast<const QueryPlanNode&>(from_msg);
// @@protoc_insertion_point(class_specific_merge_from_start:milvus.proto.plan.QueryPlanNode)
GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_predicates()) {
_this->_internal_mutable_predicates()->::milvus::proto::plan::Expr::MergeFrom(
from._internal_predicates());
}
if (from._internal_is_count() != 0) {
_this->_internal_set_is_count(from._internal_is_count());
}
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void QueryPlanNode::CopyFrom(const QueryPlanNode& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:milvus.proto.plan.QueryPlanNode)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool QueryPlanNode::IsInitialized() const {
return true;
}
void QueryPlanNode::InternalSwap(QueryPlanNode* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(QueryPlanNode, _impl_.is_count_)
+ sizeof(QueryPlanNode::_impl_.is_count_)
- PROTOBUF_FIELD_OFFSET(QueryPlanNode, _impl_.predicates_)>(
reinterpret_cast<char*>(&_impl_.predicates_),
reinterpret_cast<char*>(&other->_impl_.predicates_));
}
::PROTOBUF_NAMESPACE_ID::Metadata QueryPlanNode::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[16]);
}
// ===================================================================
class PlanNode::_Internal {
public:
static const ::milvus::proto::plan::VectorANNS& vector_anns(const PlanNode* msg);
static const ::milvus::proto::plan::Expr& predicates(const PlanNode* msg);
static const ::milvus::proto::plan::QueryPlanNode& query(const PlanNode* msg);
};
const ::milvus::proto::plan::VectorANNS&
@ -5569,6 +5823,10 @@ const ::milvus::proto::plan::Expr&
PlanNode::_Internal::predicates(const PlanNode* msg) {
return *msg->_impl_.node_.predicates_;
}
const ::milvus::proto::plan::QueryPlanNode&
PlanNode::_Internal::query(const PlanNode* msg) {
return *msg->_impl_.node_.query_;
}
void PlanNode::set_allocated_vector_anns(::milvus::proto::plan::VectorANNS* vector_anns) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_node();
@ -5599,6 +5857,21 @@ void PlanNode::set_allocated_predicates(::milvus::proto::plan::Expr* predicates)
}
// @@protoc_insertion_point(field_set_allocated:milvus.proto.plan.PlanNode.predicates)
}
void PlanNode::set_allocated_query(::milvus::proto::plan::QueryPlanNode* query) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_node();
if (query) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(query);
if (message_arena != submessage_arena) {
query = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, query, submessage_arena);
}
set_has_query();
_impl_.node_.query_ = query;
}
// @@protoc_insertion_point(field_set_allocated:milvus.proto.plan.PlanNode.query)
}
PlanNode::PlanNode(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
@ -5628,6 +5901,11 @@ PlanNode::PlanNode(const PlanNode& from)
from._internal_predicates());
break;
}
case kQuery: {
_this->_internal_mutable_query()->::milvus::proto::plan::QueryPlanNode::MergeFrom(
from._internal_query());
break;
}
case NODE_NOT_SET: {
break;
}
@ -5685,6 +5963,12 @@ void PlanNode::clear_node() {
}
break;
}
case kQuery: {
if (GetArenaForAllocation() == nullptr) {
delete _impl_.node_.query_;
}
break;
}
case NODE_NOT_SET: {
break;
}
@ -5737,6 +6021,14 @@ const char* PlanNode::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx)
} else
goto handle_unusual;
continue;
// .milvus.proto.plan.QueryPlanNode query = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
ptr = ctx->ParseMessage(_internal_mutable_query(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
@ -5789,6 +6081,13 @@ uint8_t* PlanNode::_InternalSerialize(
}
}
// .milvus.proto.plan.QueryPlanNode query = 4;
if (_internal_has_query()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(4, _Internal::query(this),
_Internal::query(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
@ -5834,6 +6133,13 @@ size_t PlanNode::ByteSizeLong() const {
*_impl_.node_.predicates_);
break;
}
// .milvus.proto.plan.QueryPlanNode query = 4;
case kQuery: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.node_.query_);
break;
}
case NODE_NOT_SET: {
break;
}
@ -5868,6 +6174,11 @@ void PlanNode::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTO
from._internal_predicates());
break;
}
case kQuery: {
_this->_internal_mutable_query()->::milvus::proto::plan::QueryPlanNode::MergeFrom(
from._internal_query());
break;
}
case NODE_NOT_SET: {
break;
}
@ -5897,7 +6208,7 @@ void PlanNode::InternalSwap(PlanNode* other) {
::PROTOBUF_NAMESPACE_ID::Metadata PlanNode::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[16]);
file_level_metadata_plan_2eproto[17]);
}
// @@protoc_insertion_point(namespace_scope)
@ -5969,6 +6280,10 @@ template<> PROTOBUF_NOINLINE ::milvus::proto::plan::VectorANNS*
Arena::CreateMaybeMessage< ::milvus::proto::plan::VectorANNS >(Arena* arena) {
return Arena::CreateMessageInternal< ::milvus::proto::plan::VectorANNS >(arena);
}
template<> PROTOBUF_NOINLINE ::milvus::proto::plan::QueryPlanNode*
Arena::CreateMaybeMessage< ::milvus::proto::plan::QueryPlanNode >(Arena* arena) {
return Arena::CreateMessageInternal< ::milvus::proto::plan::QueryPlanNode >(arena);
}
template<> PROTOBUF_NOINLINE ::milvus::proto::plan::PlanNode*
Arena::CreateMaybeMessage< ::milvus::proto::plan::PlanNode >(Arena* arena) {
return Arena::CreateMessageInternal< ::milvus::proto::plan::PlanNode >(arena);

View File

@ -85,6 +85,9 @@ extern PlanNodeDefaultTypeInternal _PlanNode_default_instance_;
class QueryInfo;
struct QueryInfoDefaultTypeInternal;
extern QueryInfoDefaultTypeInternal _QueryInfo_default_instance_;
class QueryPlanNode;
struct QueryPlanNodeDefaultTypeInternal;
extern QueryPlanNodeDefaultTypeInternal _QueryPlanNode_default_instance_;
class TermExpr;
struct TermExprDefaultTypeInternal;
extern TermExprDefaultTypeInternal _TermExpr_default_instance_;
@ -116,6 +119,7 @@ template<> ::milvus::proto::plan::Expr* Arena::CreateMaybeMessage<::milvus::prot
template<> ::milvus::proto::plan::GenericValue* Arena::CreateMaybeMessage<::milvus::proto::plan::GenericValue>(Arena*);
template<> ::milvus::proto::plan::PlanNode* Arena::CreateMaybeMessage<::milvus::proto::plan::PlanNode>(Arena*);
template<> ::milvus::proto::plan::QueryInfo* Arena::CreateMaybeMessage<::milvus::proto::plan::QueryInfo>(Arena*);
template<> ::milvus::proto::plan::QueryPlanNode* Arena::CreateMaybeMessage<::milvus::proto::plan::QueryPlanNode>(Arena*);
template<> ::milvus::proto::plan::TermExpr* Arena::CreateMaybeMessage<::milvus::proto::plan::TermExpr>(Arena*);
template<> ::milvus::proto::plan::UnaryExpr* Arena::CreateMaybeMessage<::milvus::proto::plan::UnaryExpr>(Arena*);
template<> ::milvus::proto::plan::UnaryRangeExpr* Arena::CreateMaybeMessage<::milvus::proto::plan::UnaryRangeExpr>(Arena*);
@ -3527,6 +3531,174 @@ class VectorANNS final :
};
// -------------------------------------------------------------------
class QueryPlanNode final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.plan.QueryPlanNode) */ {
public:
inline QueryPlanNode() : QueryPlanNode(nullptr) {}
~QueryPlanNode() override;
explicit PROTOBUF_CONSTEXPR QueryPlanNode(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
QueryPlanNode(const QueryPlanNode& from);
QueryPlanNode(QueryPlanNode&& from) noexcept
: QueryPlanNode() {
*this = ::std::move(from);
}
inline QueryPlanNode& operator=(const QueryPlanNode& from) {
CopyFrom(from);
return *this;
}
inline QueryPlanNode& operator=(QueryPlanNode&& from) noexcept {
if (this == &from) return *this;
if (GetOwningArena() == from.GetOwningArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
&& GetOwningArena() != nullptr
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
) {
InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return default_instance().GetMetadata().reflection;
}
static const QueryPlanNode& default_instance() {
return *internal_default_instance();
}
static inline const QueryPlanNode* internal_default_instance() {
return reinterpret_cast<const QueryPlanNode*>(
&_QueryPlanNode_default_instance_);
}
static constexpr int kIndexInFileMessages =
16;
friend void swap(QueryPlanNode& a, QueryPlanNode& b) {
a.Swap(&b);
}
inline void Swap(QueryPlanNode* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
}
}
void UnsafeArenaSwap(QueryPlanNode* other) {
if (other == this) return;
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
QueryPlanNode* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
return CreateMaybeMessage<QueryPlanNode>(arena);
}
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const QueryPlanNode& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom( const QueryPlanNode& from) {
QueryPlanNode::MergeImpl(*this, from);
}
private:
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(QueryPlanNode* other);
private:
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "milvus.proto.plan.QueryPlanNode";
}
protected:
explicit QueryPlanNode(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
public:
static const ClassData _class_data_;
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kPredicatesFieldNumber = 1,
kIsCountFieldNumber = 2,
};
// .milvus.proto.plan.Expr predicates = 1;
bool has_predicates() const;
private:
bool _internal_has_predicates() const;
public:
void clear_predicates();
const ::milvus::proto::plan::Expr& predicates() const;
PROTOBUF_NODISCARD ::milvus::proto::plan::Expr* release_predicates();
::milvus::proto::plan::Expr* mutable_predicates();
void set_allocated_predicates(::milvus::proto::plan::Expr* predicates);
private:
const ::milvus::proto::plan::Expr& _internal_predicates() const;
::milvus::proto::plan::Expr* _internal_mutable_predicates();
public:
void unsafe_arena_set_allocated_predicates(
::milvus::proto::plan::Expr* predicates);
::milvus::proto::plan::Expr* unsafe_arena_release_predicates();
// bool is_count = 2;
void clear_is_count();
bool is_count() const;
void set_is_count(bool value);
private:
bool _internal_is_count() const;
void _internal_set_is_count(bool value);
public:
// @@protoc_insertion_point(class_scope:milvus.proto.plan.QueryPlanNode)
private:
class _Internal;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
struct Impl_ {
::milvus::proto::plan::Expr* predicates_;
bool is_count_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_plan_2eproto;
};
// -------------------------------------------------------------------
class PlanNode final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.plan.PlanNode) */ {
public:
@ -3573,6 +3745,7 @@ class PlanNode final :
enum NodeCase {
kVectorAnns = 1,
kPredicates = 2,
kQuery = 4,
NODE_NOT_SET = 0,
};
@ -3581,7 +3754,7 @@ class PlanNode final :
&_PlanNode_default_instance_);
}
static constexpr int kIndexInFileMessages =
16;
17;
friend void swap(PlanNode& a, PlanNode& b) {
a.Swap(&b);
@ -3657,6 +3830,7 @@ class PlanNode final :
kOutputFieldIdsFieldNumber = 3,
kVectorAnnsFieldNumber = 1,
kPredicatesFieldNumber = 2,
kQueryFieldNumber = 4,
};
// repeated int64 output_field_ids = 3;
int output_field_ids_size() const;
@ -3716,6 +3890,24 @@ class PlanNode final :
::milvus::proto::plan::Expr* predicates);
::milvus::proto::plan::Expr* unsafe_arena_release_predicates();
// .milvus.proto.plan.QueryPlanNode query = 4;
bool has_query() const;
private:
bool _internal_has_query() const;
public:
void clear_query();
const ::milvus::proto::plan::QueryPlanNode& query() const;
PROTOBUF_NODISCARD ::milvus::proto::plan::QueryPlanNode* release_query();
::milvus::proto::plan::QueryPlanNode* mutable_query();
void set_allocated_query(::milvus::proto::plan::QueryPlanNode* query);
private:
const ::milvus::proto::plan::QueryPlanNode& _internal_query() const;
::milvus::proto::plan::QueryPlanNode* _internal_mutable_query();
public:
void unsafe_arena_set_allocated_query(
::milvus::proto::plan::QueryPlanNode* query);
::milvus::proto::plan::QueryPlanNode* unsafe_arena_release_query();
void clear_node();
NodeCase node_case() const;
// @@protoc_insertion_point(class_scope:milvus.proto.plan.PlanNode)
@ -3723,6 +3915,7 @@ class PlanNode final :
class _Internal;
void set_has_vector_anns();
void set_has_predicates();
void set_has_query();
inline bool has_node() const;
inline void clear_has_node();
@ -3738,6 +3931,7 @@ class PlanNode final :
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_;
::milvus::proto::plan::VectorANNS* vector_anns_;
::milvus::proto::plan::Expr* predicates_;
::milvus::proto::plan::QueryPlanNode* query_;
} node_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
uint32_t _oneof_case_[1];
@ -7298,6 +7492,120 @@ inline void VectorANNS::set_allocated_placeholder_tag(std::string* placeholder_t
// -------------------------------------------------------------------
// QueryPlanNode
// .milvus.proto.plan.Expr predicates = 1;
inline bool QueryPlanNode::_internal_has_predicates() const {
return this != internal_default_instance() && _impl_.predicates_ != nullptr;
}
inline bool QueryPlanNode::has_predicates() const {
return _internal_has_predicates();
}
inline void QueryPlanNode::clear_predicates() {
if (GetArenaForAllocation() == nullptr && _impl_.predicates_ != nullptr) {
delete _impl_.predicates_;
}
_impl_.predicates_ = nullptr;
}
inline const ::milvus::proto::plan::Expr& QueryPlanNode::_internal_predicates() const {
const ::milvus::proto::plan::Expr* p = _impl_.predicates_;
return p != nullptr ? *p : reinterpret_cast<const ::milvus::proto::plan::Expr&>(
::milvus::proto::plan::_Expr_default_instance_);
}
inline const ::milvus::proto::plan::Expr& QueryPlanNode::predicates() const {
// @@protoc_insertion_point(field_get:milvus.proto.plan.QueryPlanNode.predicates)
return _internal_predicates();
}
inline void QueryPlanNode::unsafe_arena_set_allocated_predicates(
::milvus::proto::plan::Expr* predicates) {
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.predicates_);
}
_impl_.predicates_ = predicates;
if (predicates) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.plan.QueryPlanNode.predicates)
}
inline ::milvus::proto::plan::Expr* QueryPlanNode::release_predicates() {
::milvus::proto::plan::Expr* temp = _impl_.predicates_;
_impl_.predicates_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
if (GetArenaForAllocation() == nullptr) { delete old; }
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
inline ::milvus::proto::plan::Expr* QueryPlanNode::unsafe_arena_release_predicates() {
// @@protoc_insertion_point(field_release:milvus.proto.plan.QueryPlanNode.predicates)
::milvus::proto::plan::Expr* temp = _impl_.predicates_;
_impl_.predicates_ = nullptr;
return temp;
}
inline ::milvus::proto::plan::Expr* QueryPlanNode::_internal_mutable_predicates() {
if (_impl_.predicates_ == nullptr) {
auto* p = CreateMaybeMessage<::milvus::proto::plan::Expr>(GetArenaForAllocation());
_impl_.predicates_ = p;
}
return _impl_.predicates_;
}
inline ::milvus::proto::plan::Expr* QueryPlanNode::mutable_predicates() {
::milvus::proto::plan::Expr* _msg = _internal_mutable_predicates();
// @@protoc_insertion_point(field_mutable:milvus.proto.plan.QueryPlanNode.predicates)
return _msg;
}
inline void QueryPlanNode::set_allocated_predicates(::milvus::proto::plan::Expr* predicates) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete _impl_.predicates_;
}
if (predicates) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(predicates);
if (message_arena != submessage_arena) {
predicates = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, predicates, submessage_arena);
}
} else {
}
_impl_.predicates_ = predicates;
// @@protoc_insertion_point(field_set_allocated:milvus.proto.plan.QueryPlanNode.predicates)
}
// bool is_count = 2;
inline void QueryPlanNode::clear_is_count() {
_impl_.is_count_ = false;
}
inline bool QueryPlanNode::_internal_is_count() const {
return _impl_.is_count_;
}
inline bool QueryPlanNode::is_count() const {
// @@protoc_insertion_point(field_get:milvus.proto.plan.QueryPlanNode.is_count)
return _internal_is_count();
}
inline void QueryPlanNode::_internal_set_is_count(bool value) {
_impl_.is_count_ = value;
}
inline void QueryPlanNode::set_is_count(bool value) {
_internal_set_is_count(value);
// @@protoc_insertion_point(field_set:milvus.proto.plan.QueryPlanNode.is_count)
}
// -------------------------------------------------------------------
// PlanNode
// .milvus.proto.plan.VectorANNS vector_anns = 1;
@ -7448,6 +7756,80 @@ inline ::milvus::proto::plan::Expr* PlanNode::mutable_predicates() {
return _msg;
}
// .milvus.proto.plan.QueryPlanNode query = 4;
inline bool PlanNode::_internal_has_query() const {
return node_case() == kQuery;
}
inline bool PlanNode::has_query() const {
return _internal_has_query();
}
inline void PlanNode::set_has_query() {
_impl_._oneof_case_[0] = kQuery;
}
inline void PlanNode::clear_query() {
if (_internal_has_query()) {
if (GetArenaForAllocation() == nullptr) {
delete _impl_.node_.query_;
}
clear_has_node();
}
}
inline ::milvus::proto::plan::QueryPlanNode* PlanNode::release_query() {
// @@protoc_insertion_point(field_release:milvus.proto.plan.PlanNode.query)
if (_internal_has_query()) {
clear_has_node();
::milvus::proto::plan::QueryPlanNode* temp = _impl_.node_.query_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
_impl_.node_.query_ = nullptr;
return temp;
} else {
return nullptr;
}
}
inline const ::milvus::proto::plan::QueryPlanNode& PlanNode::_internal_query() const {
return _internal_has_query()
? *_impl_.node_.query_
: reinterpret_cast< ::milvus::proto::plan::QueryPlanNode&>(::milvus::proto::plan::_QueryPlanNode_default_instance_);
}
inline const ::milvus::proto::plan::QueryPlanNode& PlanNode::query() const {
// @@protoc_insertion_point(field_get:milvus.proto.plan.PlanNode.query)
return _internal_query();
}
inline ::milvus::proto::plan::QueryPlanNode* PlanNode::unsafe_arena_release_query() {
// @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.plan.PlanNode.query)
if (_internal_has_query()) {
clear_has_node();
::milvus::proto::plan::QueryPlanNode* temp = _impl_.node_.query_;
_impl_.node_.query_ = nullptr;
return temp;
} else {
return nullptr;
}
}
inline void PlanNode::unsafe_arena_set_allocated_query(::milvus::proto::plan::QueryPlanNode* query) {
clear_node();
if (query) {
set_has_query();
_impl_.node_.query_ = query;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.plan.PlanNode.query)
}
inline ::milvus::proto::plan::QueryPlanNode* PlanNode::_internal_mutable_query() {
if (!_internal_has_query()) {
clear_node();
set_has_query();
_impl_.node_.query_ = CreateMaybeMessage< ::milvus::proto::plan::QueryPlanNode >(GetArenaForAllocation());
}
return _impl_.node_.query_;
}
inline ::milvus::proto::plan::QueryPlanNode* PlanNode::mutable_query() {
::milvus::proto::plan::QueryPlanNode* _msg = _internal_mutable_query();
// @@protoc_insertion_point(field_mutable:milvus.proto.plan.PlanNode.query)
return _msg;
}
// repeated int64 output_field_ids = 3;
inline int PlanNode::_internal_output_field_ids_size() const {
return _impl_.output_field_ids_.size();
@ -7539,6 +7921,8 @@ inline PlanNode::NodeCase PlanNode::node_case() const {
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)

View File

@ -57,7 +57,8 @@ struct RetrievePlanNode : PlanNode {
void
accept(PlanNodeVisitor&) override;
ExprPtr predicate_;
std::optional<ExprPtr> predicate_;
bool is_count;
};
} // namespace milvus::query

View File

@ -185,14 +185,31 @@ ProtoParser::PlanNodeFromProto(const planpb::PlanNode& plan_node_proto) {
std::unique_ptr<RetrievePlanNode>
ProtoParser::RetrievePlanNodeFromProto(
const planpb::PlanNode& plan_node_proto) {
Assert(plan_node_proto.has_predicates());
auto& predicate_proto = plan_node_proto.predicates();
auto expr_opt = [&]() -> ExprPtr { return ParseExpr(predicate_proto); }();
Assert(plan_node_proto.has_predicates() || plan_node_proto.has_query());
auto plan_node = [&]() -> std::unique_ptr<RetrievePlanNode> {
return std::make_unique<RetrievePlanNode>();
auto node = std::make_unique<RetrievePlanNode>();
if (plan_node_proto.has_predicates()) { // version before 2023.03.30.
node->is_count = false;
auto& predicate_proto = plan_node_proto.predicates();
auto expr_opt = [&]() -> ExprPtr {
return ParseExpr(predicate_proto);
}();
node->predicate_ = std::move(expr_opt);
} else {
auto& query = plan_node_proto.query();
if (query.has_predicates()) {
auto& predicate_proto = query.predicates();
auto expr_opt = [&]() -> ExprPtr {
return ParseExpr(predicate_proto);
}();
node->predicate_ = std::move(expr_opt);
}
node->is_count = query.is_count();
}
return node;
}();
plan_node->predicate_ = std::move(expr_opt);
return plan_node;
}

View File

@ -125,6 +125,17 @@ ExecPlanNodeVisitor::VectorVisitorImpl(VectorPlanNode& node) {
search_result_opt_ = std::move(search_result);
}
std::unique_ptr<RetrieveResult>
wrap_num_entities(int64_t cnt) {
auto retrieve_result = std::make_unique<RetrieveResult>();
DataArray arr;
arr.set_type(milvus::proto::schema::Int64);
auto scalar = arr.mutable_scalars();
scalar->mutable_long_data()->mutable_data()->Add(cnt);
retrieve_result->field_data_ = {arr};
return retrieve_result;
}
void
ExecPlanNodeVisitor::visit(RetrievePlanNode& node) {
assert(!retrieve_result_opt_.has_value());
@ -135,15 +146,26 @@ ExecPlanNodeVisitor::visit(RetrievePlanNode& node) {
auto active_count = segment->get_active_count(timestamp_);
if (active_count == 0) {
if (active_count == 0 && !node.is_count) {
retrieve_result_opt_ = std::move(retrieve_result);
return;
}
if (active_count == 0 && node.is_count) {
retrieve_result = *(wrap_num_entities(0));
retrieve_result_opt_ = std::move(retrieve_result);
return;
}
BitsetType bitset_holder;
if (node.predicate_ != nullptr) {
// For case that retrieve by expression, bitset will be allocated when expression is being executed.
if (node.is_count) {
bitset_holder.resize(active_count);
}
if (node.predicate_.has_value() && node.predicate_.value() != nullptr) {
bitset_holder = ExecExprVisitor(*segment, active_count, timestamp_)
.call_child(*(node.predicate_));
.call_child(*(node.predicate_.value()));
bitset_holder.flip();
}
@ -151,7 +173,14 @@ ExecPlanNodeVisitor::visit(RetrievePlanNode& node) {
segment->mask_with_delete(bitset_holder, active_count, timestamp_);
// if bitset_holder is all 1's, we got empty result
if (bitset_holder.all()) {
if (bitset_holder.all() && !node.is_count) {
retrieve_result_opt_ = std::move(retrieve_result);
return;
}
if (node.is_count) {
auto cnt = bitset_holder.size() - bitset_holder.count();
retrieve_result = *(wrap_num_entities(cnt));
retrieve_result_opt_ = std::move(retrieve_result);
return;
}

View File

@ -51,7 +51,9 @@ void
ExtractInfoPlanNodeVisitor::visit(RetrievePlanNode& node) {
// Assert(node.predicate_.has_value());
ExtractInfoExprVisitor expr_visitor(plan_info_);
node.predicate_->accept(expr_visitor);
if (node.predicate_.has_value()) {
node.predicate_.value()->accept(expr_visitor);
}
}
} // namespace milvus::query

View File

@ -83,6 +83,14 @@ SegmentInternalInterface::Retrieve(const query::RetrievePlan* plan,
query::ExecPlanNodeVisitor visitor(*this, timestamp);
auto retrieve_results = visitor.get_retrieve_result(*plan->plan_node_);
retrieve_results.segment_ = (void*)this;
if (plan->plan_node_->is_count) {
AssertInfo(retrieve_results.field_data_.size() == 1,
"count result should only have one column");
*results->add_fields_data() = retrieve_results.field_data_[0];
return results;
}
results->mutable_offset()->Add(retrieve_results.result_offsets_.begin(),
retrieve_results.result_offsets_.end());
@ -148,11 +156,26 @@ SegmentInternalInterface::Retrieve(const query::RetrievePlan* plan,
int64_t
SegmentInternalInterface::get_real_count() const {
#if 0
auto insert_cnt = get_row_count();
BitsetType bitset_holder;
bitset_holder.resize(insert_cnt, false);
mask_with_delete(bitset_holder, insert_cnt, MAX_TIMESTAMP);
return bitset_holder.size() - bitset_holder.count();
#endif
auto plan = std::make_unique<query::RetrievePlan>(get_schema());
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->is_count = true;
auto res = Retrieve(plan.get(), MAX_TIMESTAMP);
AssertInfo(res->fields_data().size() == 1,
"count result should only have one column");
AssertInfo(res->fields_data()[0].has_scalars(),
"count result should match scalar");
AssertInfo(res->fields_data()[0].scalars().has_long_data(),
"count result should match long data");
AssertInfo(res->fields_data()[0].scalars().long_data().data_size() == 1,
"count result should only have one row");
return res->fields_data()[0].scalars().long_data().data(0);
}
} // namespace milvus::segcore

View File

@ -665,3 +665,26 @@ vector_anns: <
auto ref_plan = CreatePlan(*schema, dsl_text);
plan->check_identical(*ref_plan);
}
TEST(PlanProtoTest, Predicates) {
auto schema = getStandardSchema();
auto age_fid = schema->AddDebugField("age1", DataType::INT64);
planpb::PlanNode plan_node_proto;
auto expr =
plan_node_proto.mutable_predicates()->mutable_unary_range_expr();
expr->set_op(planpb::Equal);
auto column_info = expr->mutable_column_info();
column_info->set_data_type(proto::schema::DataType::Int64);
column_info->set_field_id(age_fid.get());
auto value = expr->mutable_value();
value->set_int64_val(1000);
std::string binary;
plan_node_proto.SerializeToString(&binary);
auto plan =
CreateRetrievePlanByExpr(*schema, binary.c_str(), binary.size());
ASSERT_TRUE(plan->plan_node_->predicate_.has_value());
ASSERT_FALSE(plan->plan_node_->is_count);
}

View File

@ -935,6 +935,8 @@ TEST(Sealed, RealCount) {
schema->set_primary_field_id(pk);
auto segment = CreateSealedSegment(schema);
ASSERT_EQ(0, segment->get_real_count());
int64_t c = 10;
auto dataset = DataGen(schema, c);
auto pks = dataset.get_col<int64_t>(pk);

View File

@ -727,7 +727,7 @@ TEST(AlwaysTrueStringPlan, QueryWithOutputFields) {
auto expr_proto = GenAlwaysTrueExpr(fvec_meta, str_meta);
auto plan_proto = GenPlanNode();
plan_proto->set_allocated_predicates(expr_proto);
plan_proto->mutable_query()->set_allocated_predicates(expr_proto);
SetTargetEntry(plan_proto, {str_meta.get_id().get()});
auto plan = ProtoParser(*schema).CreateRetrievePlan(*plan_proto);

View File

@ -76,8 +76,10 @@ func CreateRetrievePlan(schemaPb *schemapb.CollectionSchema, exprStr string) (*p
}
planNode := &planpb.PlanNode{
Node: &planpb.PlanNode_Predicates{
Predicates: expr,
Node: &planpb.PlanNode_Query{
Query: &planpb.QueryPlanNode{
Predicates: expr,
},
},
}
return planNode, nil

View File

@ -132,6 +132,7 @@ message RetrieveRequest {
uint64 timeout_timestamp = 10;
int64 limit = 11; // Optional
bool ignoreGrowing = 12;
bool is_count = 13;
}
message RetrieveResults {

View File

@ -1038,6 +1038,7 @@ type RetrieveRequest struct {
TimeoutTimestamp uint64 `protobuf:"varint,10,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"`
Limit int64 `protobuf:"varint,11,opt,name=limit,proto3" json:"limit,omitempty"`
IgnoreGrowing bool `protobuf:"varint,12,opt,name=ignoreGrowing,proto3" json:"ignoreGrowing,omitempty"`
IsCount bool `protobuf:"varint,13,opt,name=is_count,json=isCount,proto3" json:"is_count,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -1152,6 +1153,13 @@ func (m *RetrieveRequest) GetIgnoreGrowing() bool {
return false
}
func (m *RetrieveRequest) GetIsCount() bool {
if m != nil {
return m.IsCount
}
return false
}
type RetrieveResults struct {
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
Status *commonpb.Status `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
@ -1898,118 +1906,118 @@ func init() {
func init() { proto.RegisterFile("internal.proto", fileDescriptor_41f4a519b878ee3b) }
var fileDescriptor_41f4a519b878ee3b = []byte{
// 1793 bytes of a gzipped FileDescriptorProto
// 1804 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcf, 0x6f, 0x1c, 0x49,
0xf5, 0xff, 0xf6, 0xf4, 0xfc, 0x7c, 0x33, 0xb6, 0xdb, 0x15, 0x27, 0xdf, 0x8e, 0xb3, 0xbb, 0xf1,
0x36, 0x48, 0x98, 0x45, 0x1b, 0x2f, 0x5e, 0xed, 0x86, 0x03, 0x02, 0xc5, 0xee, 0xac, 0x35, 0xda,
0x71, 0x70, 0x7a, 0xa2, 0x95, 0xe0, 0xd2, 0xaa, 0x99, 0x2e, 0x8f, 0x8b, 0x74, 0x77, 0xb5, 0xab,
0xaa, 0x63, 0x3b, 0x67, 0x6e, 0x48, 0xdc, 0xb8, 0x20, 0xc1, 0x19, 0x21, 0x71, 0xe6, 0xc8, 0x7f,
0xc1, 0x1f, 0xb3, 0xe2, 0x80, 0xea, 0x47, 0xcf, 0x0f, 0x7b, 0x62, 0xd9, 0x8e, 0x80, 0xe5, 0x56,
0xf5, 0x79, 0xaf, 0x5e, 0x55, 0xbd, 0x1f, 0x9f, 0x7e, 0xd5, 0xb0, 0x4a, 0x73, 0x49, 0x78, 0x8e,
0xd3, 0x27, 0x05, 0x67, 0x92, 0xa1, 0xfb, 0x19, 0x4d, 0xdf,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0xea, 0x68, 0x05, 0x3a,
0xe1, 0xe1, 0xa0, 0x9f, 0x0b, 0xc2, 0xa5, 0xd7, 0xb0, 0xd3, 0x90, 0xa4, 0x44, 0x12, 0xaf, 0x89,
0xd6, 0xa0, 0x1b, 0x1e, 0x0e, 0xf6, 0xca, 0xf4, 0xb5, 0xfa, 0x8e, 0x79, 0x2d, 0x2d, 0x7f, 0x39,
0x30, 0xad, 0xb2, 0xd7, 0xd6, 0xe6, 0x5f, 0x0e, 0x54, 0xf3, 0x7e, 0xe1, 0x75, 0xf6, 0x9e, 0xfe,
0xea, 0x8b, 0x09, 0x95, 0x27, 0xe5, 0x48, 0x39, 0x68, 0xc7, 0xdc, 0xf5, 0x53, 0xca, 0xec, 0x68,
0xa7, 0xba, 0xef, 0x8e, 0xbe, 0xfe, 0x74, 0x5a, 0x8c, 0x46, 0x4d, 0x8d, 0x7c, 0xfe, 0xaf, 0x00,
0x00, 0x00, 0xff, 0xff, 0x82, 0xcb, 0xf7, 0x4a, 0xe3, 0x15, 0x00, 0x00,
}

View File

@ -148,10 +148,16 @@ message VectorANNS {
string placeholder_tag = 5; // always be "$0"
}
message QueryPlanNode {
Expr predicates = 1;
bool is_count = 2;
};
message PlanNode {
oneof node {
VectorANNS vector_anns = 1;
Expr predicates = 2;
Expr predicates = 2; // deprecated, use query instead.
QueryPlanNode query = 4;
}
repeated int64 output_field_ids = 3;
}

View File

@ -1265,10 +1265,58 @@ func (m *VectorANNS) GetPlaceholderTag() string {
return ""
}
type QueryPlanNode struct {
Predicates *Expr `protobuf:"bytes,1,opt,name=predicates,proto3" json:"predicates,omitempty"`
IsCount bool `protobuf:"varint,2,opt,name=is_count,json=isCount,proto3" json:"is_count,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *QueryPlanNode) Reset() { *m = QueryPlanNode{} }
func (m *QueryPlanNode) String() string { return proto.CompactTextString(m) }
func (*QueryPlanNode) ProtoMessage() {}
func (*QueryPlanNode) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{16}
}
func (m *QueryPlanNode) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryPlanNode.Unmarshal(m, b)
}
func (m *QueryPlanNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryPlanNode.Marshal(b, m, deterministic)
}
func (m *QueryPlanNode) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryPlanNode.Merge(m, src)
}
func (m *QueryPlanNode) XXX_Size() int {
return xxx_messageInfo_QueryPlanNode.Size(m)
}
func (m *QueryPlanNode) XXX_DiscardUnknown() {
xxx_messageInfo_QueryPlanNode.DiscardUnknown(m)
}
var xxx_messageInfo_QueryPlanNode proto.InternalMessageInfo
func (m *QueryPlanNode) GetPredicates() *Expr {
if m != nil {
return m.Predicates
}
return nil
}
func (m *QueryPlanNode) GetIsCount() bool {
if m != nil {
return m.IsCount
}
return false
}
type PlanNode struct {
// Types that are valid to be assigned to Node:
// *PlanNode_VectorAnns
// *PlanNode_Predicates
// *PlanNode_Query
Node isPlanNode_Node `protobuf_oneof:"node"`
OutputFieldIds []int64 `protobuf:"varint,3,rep,packed,name=output_field_ids,json=outputFieldIds,proto3" json:"output_field_ids,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -1280,7 +1328,7 @@ func (m *PlanNode) Reset() { *m = PlanNode{} }
func (m *PlanNode) String() string { return proto.CompactTextString(m) }
func (*PlanNode) ProtoMessage() {}
func (*PlanNode) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{16}
return fileDescriptor_2d655ab2f7683c23, []int{17}
}
func (m *PlanNode) XXX_Unmarshal(b []byte) error {
@ -1313,10 +1361,16 @@ type PlanNode_Predicates struct {
Predicates *Expr `protobuf:"bytes,2,opt,name=predicates,proto3,oneof"`
}
type PlanNode_Query struct {
Query *QueryPlanNode `protobuf:"bytes,4,opt,name=query,proto3,oneof"`
}
func (*PlanNode_VectorAnns) isPlanNode_Node() {}
func (*PlanNode_Predicates) isPlanNode_Node() {}
func (*PlanNode_Query) isPlanNode_Node() {}
func (m *PlanNode) GetNode() isPlanNode_Node {
if m != nil {
return m.Node
@ -1338,6 +1392,13 @@ func (m *PlanNode) GetPredicates() *Expr {
return nil
}
func (m *PlanNode) GetQuery() *QueryPlanNode {
if x, ok := m.GetNode().(*PlanNode_Query); ok {
return x.Query
}
return nil
}
func (m *PlanNode) GetOutputFieldIds() []int64 {
if m != nil {
return m.OutputFieldIds
@ -1350,6 +1411,7 @@ func (*PlanNode) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*PlanNode_VectorAnns)(nil),
(*PlanNode_Predicates)(nil),
(*PlanNode_Query)(nil),
}
}
@ -1374,99 +1436,104 @@ func init() {
proto.RegisterType((*BinaryArithOpEvalRangeExpr)(nil), "milvus.proto.plan.BinaryArithOpEvalRangeExpr")
proto.RegisterType((*Expr)(nil), "milvus.proto.plan.Expr")
proto.RegisterType((*VectorANNS)(nil), "milvus.proto.plan.VectorANNS")
proto.RegisterType((*QueryPlanNode)(nil), "milvus.proto.plan.QueryPlanNode")
proto.RegisterType((*PlanNode)(nil), "milvus.proto.plan.PlanNode")
}
func init() { proto.RegisterFile("plan.proto", fileDescriptor_2d655ab2f7683c23) }
var fileDescriptor_2d655ab2f7683c23 = []byte{
// 1407 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x72, 0xdc, 0x44,
0x10, 0x5e, 0xad, 0x76, 0xbd, 0x52, 0xef, 0x7a, 0xad, 0xe8, 0x42, 0x7e, 0x48, 0x6c, 0x44, 0x8a,
0x98, 0x50, 0xb1, 0x2b, 0x24, 0x24, 0x95, 0x50, 0x01, 0xff, 0x05, 0x7b, 0x8b, 0xc4, 0x36, 0x8a,
0xe3, 0x03, 0x17, 0x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 0xa7, 0x79, 0xec,
0x98, 0x6a, 0xb1, 0xc3, 0x7a, 0x4e, 0x05, 0x25, 0x3c, 0x72, 0xaa, 0x5b, 0x77, 0xbe, 0xbd, 0x7d,
0xca, 0x64, 0x27, 0x6f, 0xaf, 0x85, 0xbc, 0xbb, 0xae, 0xa9, 0xbe, 0xc5, 0x78, 0xb1, 0x5a, 0x67,
0x89, 0xa4, 0x22, 0x21, 0xf1, 0x3a, 0xb2, 0xbf, 0xae, 0xd8, 0x4f, 0xdb, 0xed, 0x05, 0xfc, 0xba,
0xf3, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0x23, 0x5b, 0x87, 0xb6, 0x0f, 0x00, 0x00,
// 1457 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x3f, 0x73, 0xdb, 0xc6,
0x12, 0x27, 0xf8, 0x47, 0x04, 0x96, 0x14, 0x05, 0xa3, 0x79, 0xfe, 0xf3, 0x6c, 0xe9, 0xe1, 0x79,
0x9e, 0xf5, 0x9c, 0xb1, 0x34, 0x8e, 0x1d, 0x3b, 0x76, 0xc6, 0x89, 0xfe, 0x39, 0x22, 0x27, 0xb6,
0xa4, 0xc0, 0xb2, 0x8a, 0x34, 0x98, 0x23, 0x70, 0x12, 0x6f, 0x0c, 0xe2, 0xe0, 0xc3, 0x81, 0xb6,
0xea, 0x74, 0xe9, 0xf2, 0x01, 0xd2, 0x26, 0x7d, 0xca, 0x34, 0xf9, 0x02, 0x29, 0x52, 0xa6, 0xcf,
0x47, 0x48, 0x97, 0x2a, 0x73, 0x7b, 0x20, 0x48, 0x6a, 0x48, 0x8b, 0x9a, 0x78, 0x26, 0xdd, 0x61,
0x6f, 0x77, 0xef, 0xb7, 0xbf, 0xdd, 0xdb, 0x5b, 0x00, 0x24, 0x11, 0x89, 0xd7, 0x12, 0xc1, 0x25,
0x77, 0x2e, 0xf5, 0x59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xf7, 0xbe,
0xba, 0x7b, 0xc2, 0x64, 0x2f, 0xeb, 0xae, 0x05, 0xbc, 0xbf, 0xae, 0xe9, 0xbe, 0xc3, 0x78, 0xbe,
0x5a, 0x67, 0xb1, 0xa4, 0x22, 0x26, 0xd1, 0x3a, 0x66, 0x60, 0x5d, 0x65, 0x20, 0xe9, 0x76, 0x17,
0xf0, 0xeb, 0xde, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x6c, 0x97, 0x4f, 0x55, 0x10, 0x00,
0x00,
}

View File

@ -0,0 +1,22 @@
package proxy
import (
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/util/funcutil"
)
type cntReducer struct {
}
func (r *cntReducer) Reduce(results []*internalpb.RetrieveResults) (*milvuspb.QueryResults, error) {
cnt := int64(0)
for _, res := range results {
c, err := funcutil.CntOfInternalResult(res)
if err != nil {
return nil, err
}
cnt += c
}
return funcutil.WrapCntToQueryResults(cnt), nil
}

View File

@ -0,0 +1,45 @@
package proxy
import (
"testing"
"github.com/milvus-io/milvus/internal/util/funcutil"
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
)
func Test_cntReducer_Reduce(t *testing.T) {
t.Run("invalid", func(t *testing.T) {
r := &cntReducer{}
results := []*internalpb.RetrieveResults{
{
FieldsData: []*schemapb.FieldData{nil, nil},
},
}
_, err := r.Reduce(results)
assert.Error(t, err)
})
t.Run("normal case", func(t *testing.T) {
r := &cntReducer{}
results := []*internalpb.RetrieveResults{
funcutil.WrapCntToInternalResult(1),
funcutil.WrapCntToInternalResult(2),
funcutil.WrapCntToInternalResult(3),
funcutil.WrapCntToInternalResult(4),
}
res, err := r.Reduce(results)
assert.NoError(t, err)
total, err := funcutil.CntOfQueryResults(res)
assert.NoError(t, err)
assert.Equal(t, int64(1+2+3+4), total)
})
}

View File

@ -0,0 +1,93 @@
package proxy
import (
"context"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/common"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/util/typeutil"
"go.uber.org/zap"
)
type defaultLimitReducer struct {
ctx context.Context
req *internalpb.RetrieveRequest
params *queryParams
schema *schemapb.CollectionSchema
collectionName string
}
func (r *defaultLimitReducer) Reduce(results []*internalpb.RetrieveResults) (*milvuspb.QueryResults, error) {
res, err := reduceRetrieveResultsAndFillIfEmpty(r.ctx, results, r.params, r.req.GetOutputFieldsId(), r.schema)
if err != nil {
return nil, err
}
if err := r.afterReduce(res); err != nil {
return nil, err
}
return res, nil
}
func (r *defaultLimitReducer) afterReduce(result *milvuspb.QueryResults) error {
collectionName := r.collectionName
ctx := r.ctx
schema := r.schema
outputFieldsID := r.req.GetOutputFieldsId()
result.CollectionName = collectionName
if len(result.FieldsData) > 0 {
result.Status = &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
}
} else {
log.Ctx(ctx).Warn("Query result is nil",
zap.Any("requestType", "query"))
result.Status = &commonpb.Status{
ErrorCode: commonpb.ErrorCode_EmptyCollection,
Reason: "empty collection", // TODO
}
return nil
}
for i := 0; i < len(result.FieldsData); i++ {
if outputFieldsID[i] == common.TimeStampField {
result.FieldsData = append(result.FieldsData[:i], result.FieldsData[(i+1):]...)
i--
continue
}
for _, field := range schema.Fields {
if field.FieldID == outputFieldsID[i] {
// deal with the situation that offset equal to or greater than the number of entities
if result.FieldsData[i] == nil {
var err error
result.FieldsData[i], err = typeutil.GenEmptyFieldData(field)
if err != nil {
return err
}
}
result.FieldsData[i].FieldName = field.Name
result.FieldsData[i].FieldId = field.FieldID
result.FieldsData[i].Type = field.DataType
}
}
}
return nil
}
func newDefaultLimitReducer(ctx context.Context, params *queryParams, req *internalpb.RetrieveRequest, schema *schemapb.CollectionSchema, collectionName string) *defaultLimitReducer {
return &defaultLimitReducer{
ctx: ctx,
req: req,
params: params,
schema: schema,
collectionName: collectionName,
}
}

22
internal/proxy/reducer.go Normal file
View File

@ -0,0 +1,22 @@
package proxy
import (
"context"
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
)
type milvusReducer interface {
Reduce([]*internalpb.RetrieveResults) (*milvuspb.QueryResults, error)
}
func createMilvusReducer(ctx context.Context, params *queryParams, req *internalpb.RetrieveRequest, schema *schemapb.CollectionSchema, plan *planpb.PlanNode, collectionName string) milvusReducer {
if plan.GetQuery().GetIsCount() {
return &cntReducer{}
}
return newDefaultLimitReducer(ctx, params, req, schema, collectionName)
}

View File

@ -0,0 +1,28 @@
package proxy
import (
"testing"
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/stretchr/testify/assert"
)
func Test_createMilvusReducer(t *testing.T) {
n := &planpb.PlanNode{
Node: &planpb.PlanNode_Query{
Query: &planpb.QueryPlanNode{
IsCount: false,
},
},
}
var r milvusReducer
r = createMilvusReducer(nil, nil, nil, nil, n, "")
_, ok := r.(*defaultLimitReducer)
assert.True(t, ok)
n.Node.(*planpb.PlanNode_Query).Query.IsCount = true
r = createMilvusReducer(nil, nil, nil, nil, n, "")
_, ok = r.(*cntReducer)
assert.True(t, ok)
}

View File

@ -6,11 +6,13 @@ import (
"strconv"
"strings"
"github.com/golang/protobuf/proto"
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/cockroachdb/errors"
"github.com/milvus-io/milvus/internal/common"
"github.com/milvus-io/milvus/internal/parser/planparserv2"
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
"github.com/milvus-io/milvus/internal/log"
@ -57,6 +59,8 @@ type queryTask struct {
queryShardPolicy pickShardPolicy
shardMgr *shardClientMgr
plan *planpb.PlanNode
}
type queryParams struct {
@ -169,6 +173,74 @@ func parseQueryParams(queryParamsPair []*commonpb.KeyValuePair) (*queryParams, e
}, nil
}
func matchCountRule(outputs []string) bool {
return len(outputs) == 1 && strings.ToLower(strings.TrimSpace(outputs[0])) == "count(*)"
}
func createCntPlan(expr string, schema *schemapb.CollectionSchema) (*planpb.PlanNode, error) {
if expr == "" {
return &planpb.PlanNode{
Node: &planpb.PlanNode_Query{
Query: &planpb.QueryPlanNode{
Predicates: nil,
IsCount: true,
},
},
}, nil
}
plan, err := planparserv2.CreateRetrievePlan(schema, expr)
if err != nil {
return nil, err
}
plan.Node.(*planpb.PlanNode_Query).Query.IsCount = true
return plan, nil
}
func (t *queryTask) createPlan(ctx context.Context) error {
schema := t.schema
cntMatch := matchCountRule(t.request.GetOutputFields())
if cntMatch {
var err error
t.plan, err = createCntPlan(t.request.GetExpr(), schema)
return err
}
if t.request.Expr == "" {
return fmt.Errorf("query expression is empty")
}
plan, err := planparserv2.CreateRetrievePlan(schema, t.request.Expr)
if err != nil {
return err
}
t.request.OutputFields, err = translateOutputFields(t.request.OutputFields, schema, true)
if err != nil {
return err
}
log.Ctx(ctx).Debug("translate output fields",
zap.Strings("OutputFields", t.request.OutputFields),
zap.String("requestType", "query"))
outputFieldIDs, err := translateToOutputFieldIDs(t.request.GetOutputFields(), schema)
if err != nil {
return err
}
outputFieldIDs = append(outputFieldIDs, common.TimeStampField)
t.RetrieveRequest.OutputFieldsId = outputFieldIDs
plan.OutputFieldIds = outputFieldIDs
t.plan = plan
log.Ctx(ctx).Debug("translate output fields to field ids",
zap.Int64s("OutputFieldsID", t.OutputFieldsId),
zap.String("requestType", "query"))
return nil
}
func (t *queryTask) PreExecute(ctx context.Context) error {
if t.queryShardPolicy == nil {
t.queryShardPolicy = mergeRoundRobinPolicy
@ -268,34 +340,15 @@ func (t *queryTask) PreExecute(ctx context.Context) error {
t.request.Expr = IDs2Expr(pkField, t.ids)
}
if t.request.Expr == "" {
return fmt.Errorf("query expression is empty")
}
plan, err := planparserv2.CreateRetrievePlan(schema, t.request.Expr)
if err != nil {
if err := t.createPlan(ctx); err != nil {
return err
}
t.request.OutputFields, err = translateOutputFields(t.request.OutputFields, schema, true)
if err != nil {
return err
}
log.Ctx(ctx).Debug("translate output fields",
zap.Any("OutputFields", t.request.OutputFields),
zap.Any("requestType", "query"))
outputFieldIDs, err := translateToOutputFieldIDs(t.request.GetOutputFields(), schema)
if err != nil {
return err
if t.plan.GetQuery().GetIsCount() {
t.RetrieveRequest.IsCount = true
}
outputFieldIDs = append(outputFieldIDs, common.TimeStampField)
t.RetrieveRequest.OutputFieldsId = outputFieldIDs
plan.OutputFieldIds = outputFieldIDs
log.Ctx(ctx).Debug("translate output fields to field ids",
zap.Any("OutputFieldsID", t.OutputFieldsId),
zap.Any("requestType", "query"))
t.RetrieveRequest.SerializedExprPlan, err = proto.Marshal(plan)
t.RetrieveRequest.SerializedExprPlan, err = proto.Marshal(t.plan)
if err != nil {
return err
}
@ -387,52 +440,15 @@ func (t *queryTask) PostExecute(ctx context.Context) error {
metrics.ProxyDecodeResultLatency.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), metrics.QueryLabel).Observe(0.0)
tr.CtxRecord(ctx, "reduceResultStart")
t.result, err = reduceRetrieveResultsAndFillIfEmpty(ctx, t.toReduceResults, t.queryParams, t.GetOutputFieldsId(), t.schema)
reducer := createMilvusReducer(ctx, t.queryParams, t.RetrieveRequest, t.schema, t.plan, t.collectionName)
t.result, err = reducer.Reduce(t.toReduceResults)
if err != nil {
return err
}
metrics.ProxyReduceResultLatency.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), metrics.QueryLabel).Observe(float64(tr.RecordSpan().Milliseconds()))
t.result.CollectionName = t.collectionName
if len(t.result.FieldsData) > 0 {
t.result.Status = &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
}
} else {
log.Ctx(ctx).Warn("Query result is nil",
zap.Any("requestType", "query"))
t.result.Status = &commonpb.Status{
ErrorCode: commonpb.ErrorCode_EmptyCollection,
Reason: "empty collection", // TODO
}
return nil
}
schema, err := globalMetaCache.GetCollectionSchema(ctx, t.request.CollectionName)
if err != nil {
return err
}
for i := 0; i < len(t.result.FieldsData); i++ {
if t.OutputFieldsId[i] == common.TimeStampField {
t.result.FieldsData = append(t.result.FieldsData[:i], t.result.FieldsData[(i+1):]...)
i--
continue
}
for _, field := range schema.Fields {
if field.FieldID == t.OutputFieldsId[i] {
// deal with the situation that offset equal to or greater than the number of entities
if t.result.FieldsData[i] == nil {
t.result.FieldsData[i], err = typeutil.GenEmptyFieldData(field)
if err != nil {
return err
}
}
t.result.FieldsData[i].FieldName = field.Name
t.result.FieldsData[i].FieldId = field.FieldID
t.result.FieldsData[i].Type = field.DataType
}
}
}
log.Ctx(ctx).Debug("Query PostExecute done",
zap.String("requestType", "query"))
return nil

View File

@ -695,3 +695,179 @@ func Test_filterSystemFields(t *testing.T) {
filtered := filterSystemFields(outputFieldIDs)
assert.ElementsMatch(t, []UniqueID{common.StartOfUserFieldID}, filtered)
}
func Test_matchCountRule(t *testing.T) {
type args struct {
outputs []string
}
tests := []struct {
name string
args args
want bool
}{
{
args: args{
outputs: nil,
},
want: false,
},
{
args: args{
outputs: []string{"count(*)", "count(*)"},
},
want: false,
},
{
args: args{
outputs: []string{"not count(*)"},
},
want: false,
},
{
args: args{
outputs: []string{"count(*)"},
},
want: true,
},
{
args: args{
outputs: []string{"COUNT(*)"},
},
want: true,
},
{
args: args{
outputs: []string{" count(*)"},
},
want: true,
},
{
args: args{
outputs: []string{" COUNT(*)"},
},
want: true,
},
{
args: args{
outputs: []string{"count(*) "},
},
want: true,
},
{
args: args{
outputs: []string{"COUNT(*) "},
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equalf(t, tt.want, matchCountRule(tt.args.outputs), "matchCountRule(%v)", tt.args.outputs)
})
}
}
func Test_createCntPlan(t *testing.T) {
t.Run("plan without filter", func(t *testing.T) {
plan, err := createCntPlan("", nil)
assert.NoError(t, err)
assert.True(t, plan.GetQuery().GetIsCount())
assert.Nil(t, plan.GetQuery().GetPredicates())
})
t.Run("invalid schema", func(t *testing.T) {
_, err := createCntPlan("a > b", nil)
assert.Error(t, err)
})
t.Run("invalid schema", func(t *testing.T) {
schema := &schemapb.CollectionSchema{
Fields: []*schemapb.FieldSchema{
{
FieldID: 100,
Name: "a",
IsPrimaryKey: true,
DataType: schemapb.DataType_Int64,
},
},
}
plan, err := createCntPlan("a > 4", schema)
assert.NoError(t, err)
assert.True(t, plan.GetQuery().GetIsCount())
assert.NotNil(t, plan.GetQuery().GetPredicates())
})
}
func Test_queryTask_createPlan(t *testing.T) {
t.Run("match count rule", func(t *testing.T) {
tsk := &queryTask{
request: &milvuspb.QueryRequest{
OutputFields: []string{"count(*)"},
},
}
err := tsk.createPlan(context.TODO())
assert.NoError(t, err)
plan := tsk.plan
assert.True(t, plan.GetQuery().GetIsCount())
assert.Nil(t, plan.GetQuery().GetPredicates())
})
t.Run("query without expression", func(t *testing.T) {
tsk := &queryTask{
request: &milvuspb.QueryRequest{
OutputFields: []string{"a"},
},
}
err := tsk.createPlan(context.TODO())
assert.Error(t, err)
})
t.Run("invalid expression", func(t *testing.T) {
schema := &schemapb.CollectionSchema{
Fields: []*schemapb.FieldSchema{
{
FieldID: 100,
Name: "a",
IsPrimaryKey: true,
DataType: schemapb.DataType_Int64,
},
},
}
tsk := &queryTask{
schema: schema,
request: &milvuspb.QueryRequest{
OutputFields: []string{"a"},
Expr: "b > 2",
},
}
err := tsk.createPlan(context.TODO())
assert.Error(t, err)
})
t.Run("invalid output fields", func(t *testing.T) {
schema := &schemapb.CollectionSchema{
Fields: []*schemapb.FieldSchema{
{
FieldID: 100,
Name: "a",
IsPrimaryKey: true,
DataType: schemapb.DataType_Int64,
},
},
}
tsk := &queryTask{
schema: schema,
request: &milvuspb.QueryRequest{
OutputFields: []string{"b"},
Expr: "a > 2",
},
}
err := tsk.createPlan(context.TODO())
assert.Error(t, err)
})
}

View File

@ -0,0 +1,37 @@
package querynode
import (
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/segcorepb"
"github.com/milvus-io/milvus/internal/util/funcutil"
)
type cntReducer struct {
}
func (r *cntReducer) Reduce(results []*internalpb.RetrieveResults) (*internalpb.RetrieveResults, error) {
cnt := int64(0)
for _, res := range results {
c, err := funcutil.CntOfInternalResult(res)
if err != nil {
return nil, err
}
cnt += c
}
return funcutil.WrapCntToInternalResult(cnt), nil
}
type cntReducerSegCore struct {
}
func (r *cntReducerSegCore) Reduce(results []*segcorepb.RetrieveResults) (*segcorepb.RetrieveResults, error) {
cnt := int64(0)
for _, res := range results {
c, err := funcutil.CntOfSegCoreResult(res)
if err != nil {
return nil, err
}
cnt += c
}
return funcutil.WrapCntToSegCoreResult(cnt), nil
}

View File

@ -0,0 +1,81 @@
package querynode
import (
"testing"
"github.com/milvus-io/milvus/internal/proto/segcorepb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/util/funcutil"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/stretchr/testify/assert"
)
func Test_cntReducer_Reduce(t *testing.T) {
t.Run("invalid", func(t *testing.T) {
r := &cntReducer{}
results := []*internalpb.RetrieveResults{
{
FieldsData: []*schemapb.FieldData{nil, nil},
},
}
_, err := r.Reduce(results)
assert.Error(t, err)
})
t.Run("normal case", func(t *testing.T) {
r := &cntReducer{}
results := []*internalpb.RetrieveResults{
funcutil.WrapCntToInternalResult(1),
funcutil.WrapCntToInternalResult(2),
funcutil.WrapCntToInternalResult(3),
funcutil.WrapCntToInternalResult(4),
}
res, err := r.Reduce(results)
assert.NoError(t, err)
total, err := funcutil.CntOfInternalResult(res)
assert.NoError(t, err)
assert.Equal(t, int64(1+2+3+4), total)
})
}
func Test_cntReducerSegCore_Reduce(t *testing.T) {
t.Run("invalid", func(t *testing.T) {
r := &cntReducerSegCore{}
results := []*segcorepb.RetrieveResults{
{
FieldsData: []*schemapb.FieldData{nil, nil},
},
}
_, err := r.Reduce(results)
assert.Error(t, err)
})
t.Run("normal case", func(t *testing.T) {
r := &cntReducerSegCore{}
results := []*segcorepb.RetrieveResults{
funcutil.WrapCntToSegCoreResult(1),
funcutil.WrapCntToSegCoreResult(2),
funcutil.WrapCntToSegCoreResult(3),
funcutil.WrapCntToSegCoreResult(4),
}
res, err := r.Reduce(results)
assert.NoError(t, err)
total, err := funcutil.CntOfSegCoreResult(res)
assert.NoError(t, err)
assert.Equal(t, int64(1+2+3+4), total)
})
}

View File

@ -0,0 +1,46 @@
package querynode
import (
"context"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/milvus-io/milvus/internal/proto/segcorepb"
)
type defaultLimitReducer struct {
ctx context.Context
req *querypb.QueryRequest
schema *schemapb.CollectionSchema
}
func (r *defaultLimitReducer) Reduce(results []*internalpb.RetrieveResults) (*internalpb.RetrieveResults, error) {
return mergeInternalRetrieveResultsAndFillIfEmpty(r.ctx, results, r.req.GetReq().GetLimit(), r.req.GetReq().GetOutputFieldsId(), r.schema)
}
func newDefaultLimitReducer(ctx context.Context, req *querypb.QueryRequest, schema *schemapb.CollectionSchema) *defaultLimitReducer {
return &defaultLimitReducer{
ctx: ctx,
req: req,
schema: schema,
}
}
type defaultLimitReducerSegcore struct {
ctx context.Context
req *querypb.QueryRequest
schema *schemapb.CollectionSchema
}
func (r *defaultLimitReducerSegcore) Reduce(results []*segcorepb.RetrieveResults) (*segcorepb.RetrieveResults, error) {
return mergeSegcoreRetrieveResultsAndFillIfEmpty(r.ctx, results, r.req.GetReq().GetLimit(), r.req.GetReq().GetOutputFieldsId(), r.schema)
}
func newDefaultLimitReducerSegcore(ctx context.Context, req *querypb.QueryRequest, schema *schemapb.CollectionSchema) *defaultLimitReducerSegcore {
return &defaultLimitReducerSegcore{
ctx: ctx,
req: req,
schema: schema,
}
}

View File

@ -945,6 +945,7 @@ func (node *QueryNode) queryWithDmlChannel(ctx context.Context, req *querypb.Que
zap.Bool("fromShardLeader", req.GetFromShardLeader()),
zap.String("vChannel", dmlChannel),
zap.Int64s("segmentIDs", req.GetSegmentIDs()),
zap.Bool("is_count", req.GetReq().GetIsCount()),
zap.Uint64("guaranteeTimestamp", req.GetReq().GetGuaranteeTimestamp()),
zap.Uint64("timeTravel", req.GetReq().GetTravelTimestamp()))
@ -1030,8 +1031,10 @@ func (node *QueryNode) queryWithDmlChannel(ctx context.Context, req *querypb.Que
tr.CtxElapse(ctx, fmt.Sprintf("start reduce query result, fromSharedLeader = %t, vChannel = %s, segmentIDs = %v",
req.GetFromShardLeader(), dmlChannel, req.GetSegmentIDs()))
ret, err2 := mergeInternalRetrieveResultsAndFillIfEmpty(ctx, results, req.Req.GetLimit(), req.GetReq().GetOutputFieldsId(), qs.collection.Schema())
if err2 != nil {
reducer := createInternalReducer(ctx, req, qs.collection.Schema())
ret, err2 := reducer.Reduce(results)
if err != nil {
failRet.Status.Reason = err2.Error()
return failRet, nil
}
@ -1052,6 +1055,7 @@ func (node *QueryNode) Query(ctx context.Context, req *querypb.QueryRequest) (*i
zap.Bool("fromShardleader", req.GetFromShardLeader()),
zap.Strings("vChannels", req.GetDmlChannels()),
zap.Int64s("segmentIDs", req.GetSegmentIDs()),
zap.Bool("is_count", req.GetReq().GetIsCount()),
zap.Uint64("guaranteeTimestamp", req.Req.GetGuaranteeTimestamp()),
zap.Uint64("timeTravel", req.GetReq().GetTravelTimestamp()))
@ -1116,7 +1120,10 @@ func (node *QueryNode) Query(ctx context.Context, req *querypb.QueryRequest) (*i
failRet.Status.Reason = err.Error()
return failRet, nil
}
ret, err := mergeInternalRetrieveResultsAndFillIfEmpty(ctx, toMergeResults, req.GetReq().GetLimit(), req.GetReq().GetOutputFieldsId(), coll.Schema())
reducer := createInternalReducer(ctx, req, coll.Schema())
ret, err := reducer.Reduce(toMergeResults)
if err != nil {
failRet.Status.ErrorCode = commonpb.ErrorCode_UnexpectedError
failRet.Status.Reason = err.Error()

View File

@ -0,0 +1,33 @@
package querynode
import (
"context"
"github.com/milvus-io/milvus/internal/proto/segcorepb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/querypb"
)
type internalReducer interface {
Reduce([]*internalpb.RetrieveResults) (*internalpb.RetrieveResults, error)
}
func createInternalReducer(ctx context.Context, req *querypb.QueryRequest, schema *schemapb.CollectionSchema) internalReducer {
if req.GetReq().GetIsCount() {
return &cntReducer{}
}
return newDefaultLimitReducer(ctx, req, schema)
}
type segCoreReducer interface {
Reduce([]*segcorepb.RetrieveResults) (*segcorepb.RetrieveResults, error)
}
func createSegCoreReducer(ctx context.Context, req *querypb.QueryRequest, schema *schemapb.CollectionSchema) segCoreReducer {
if req.GetReq().GetIsCount() {
return &cntReducerSegCore{}
}
return newDefaultLimitReducerSegcore(ctx, req, schema)
}

View File

@ -0,0 +1,53 @@
package querynode
import (
"context"
"testing"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/stretchr/testify/assert"
)
func Test_createInternalReducer(t *testing.T) {
req := &querypb.QueryRequest{
Req: &internalpb.RetrieveRequest{
IsCount: false,
},
}
var r internalReducer
var ok bool
r = createInternalReducer(context.TODO(), req, nil)
_, ok = r.(*defaultLimitReducer)
assert.True(t, ok)
req.Req.IsCount = true
r = createInternalReducer(context.TODO(), req, nil)
_, ok = r.(*cntReducer)
assert.True(t, ok)
}
func Test_createSegCoreReducer(t *testing.T) {
req := &querypb.QueryRequest{
Req: &internalpb.RetrieveRequest{
IsCount: false,
},
}
var r segCoreReducer
var ok bool
r = createSegCoreReducer(context.TODO(), req, nil)
_, ok = r.(*defaultLimitReducerSegcore)
assert.True(t, ok)
req.Req.IsCount = true
r = createSegCoreReducer(context.TODO(), req, nil)
_, ok = r.(*cntReducerSegCore)
assert.True(t, ok)
}

View File

@ -85,7 +85,10 @@ func (q *queryTask) queryOnStreaming() error {
}
q.tr.RecordSpan()
mergedResult, err := mergeSegcoreRetrieveResultsAndFillIfEmpty(ctx, sResults, q.iReq.GetLimit(), q.iReq.GetOutputFieldsId(), coll.Schema())
reducer := createSegCoreReducer(ctx, q.req, coll.Schema())
mergedResult, err := reducer.Reduce(sResults)
if err != nil {
return err
}
@ -128,7 +131,9 @@ func (q *queryTask) queryOnHistorical() error {
return err
}
mergedResult, err := mergeSegcoreRetrieveResultsAndFillIfEmpty(ctx, retrieveResults, q.req.GetReq().GetLimit(), q.iReq.GetOutputFieldsId(), coll.Schema())
reducer := createSegCoreReducer(ctx, q.req, coll.Schema())
mergedResult, err := reducer.Reduce(retrieveResults)
if err != nil {
return err
}

View File

@ -0,0 +1,94 @@
package funcutil
import (
"fmt"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/segcorepb"
)
func CntOfInternalResult(res *internalpb.RetrieveResults) (int64, error) {
if len(res.GetFieldsData()) != 1 {
return 0, fmt.Errorf("internal count result should only have one column")
}
f := res.GetFieldsData()[0]
return CntOfFieldData(f)
}
func CntOfSegCoreResult(res *segcorepb.RetrieveResults) (int64, error) {
if len(res.GetFieldsData()) != 1 {
return 0, fmt.Errorf("segcore count result should only have one column")
}
f := res.GetFieldsData()[0]
return CntOfFieldData(f)
}
func CntOfFieldData(f *schemapb.FieldData) (int64, error) {
scalars := f.GetScalars()
if scalars == nil {
return 0, fmt.Errorf("count result should be scalar")
}
data := scalars.GetLongData()
if data == nil {
return 0, fmt.Errorf("count result should be int64 data")
}
if len(data.GetData()) != 1 {
return 0, fmt.Errorf("count result shoud only have one row")
}
return data.GetData()[0], nil
}
func WrapCntToInternalResult(cnt int64) *internalpb.RetrieveResults {
return &internalpb.RetrieveResults{
Status: &commonpb.Status{},
FieldsData: []*schemapb.FieldData{WrapCntToFieldData(cnt)},
}
}
func WrapCntToSegCoreResult(cnt int64) *segcorepb.RetrieveResults {
return &segcorepb.RetrieveResults{
Ids: nil,
Offset: nil,
FieldsData: []*schemapb.FieldData{WrapCntToFieldData(cnt)},
}
}
func WrapCntToFieldData(cnt int64) *schemapb.FieldData {
return &schemapb.FieldData{
Type: schemapb.DataType_Int64,
FieldName: "count(*)",
Field: &schemapb.FieldData_Scalars{
Scalars: &schemapb.ScalarField{
Data: &schemapb.ScalarField_LongData{
LongData: &schemapb.LongArray{
Data: []int64{cnt},
},
},
},
},
FieldId: 0,
}
}
func WrapCntToQueryResults(cnt int64) *milvuspb.QueryResults {
return &milvuspb.QueryResults{
Status: &commonpb.Status{},
FieldsData: []*schemapb.FieldData{WrapCntToFieldData(cnt)},
CollectionName: "",
}
}
func CntOfQueryResults(res *milvuspb.QueryResults) (int64, error) {
if len(res.GetFieldsData()) != 1 {
return 0, fmt.Errorf("milvus count result should only have one column")
}
f := res.GetFieldsData()[0]
return CntOfFieldData(f)
}

View File

@ -0,0 +1,95 @@
package funcutil
import (
"testing"
"github.com/milvus-io/milvus/internal/proto/segcorepb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/stretchr/testify/assert"
)
func TestCntOfInternalResult(t *testing.T) {
t.Run("invalid", func(t *testing.T) {
res := &internalpb.RetrieveResults{
FieldsData: []*schemapb.FieldData{nil, nil},
}
_, err := CntOfInternalResult(res)
assert.Error(t, err)
})
t.Run("normal case", func(t *testing.T) {
res := WrapCntToInternalResult(5)
cnt, err := CntOfInternalResult(res)
assert.NoError(t, err)
assert.Equal(t, int64(5), cnt)
})
}
func TestCntOfSegCoreResult(t *testing.T) {
t.Run("invalid", func(t *testing.T) {
res := &segcorepb.RetrieveResults{
FieldsData: []*schemapb.FieldData{nil, nil},
}
_, err := CntOfSegCoreResult(res)
assert.Error(t, err)
})
t.Run("normal case", func(t *testing.T) {
res := WrapCntToSegCoreResult(5)
cnt, err := CntOfSegCoreResult(res)
assert.NoError(t, err)
assert.Equal(t, int64(5), cnt)
})
}
func TestCntOfFieldData(t *testing.T) {
t.Run("not scalars", func(t *testing.T) {
f := &schemapb.FieldData{
Field: &schemapb.FieldData_Vectors{},
}
_, err := CntOfFieldData(f)
assert.Error(t, err)
})
t.Run("not long data", func(t *testing.T) {
f := &schemapb.FieldData{
Field: &schemapb.FieldData_Scalars{
Scalars: &schemapb.ScalarField{
Data: &schemapb.ScalarField_DoubleData{},
},
},
}
_, err := CntOfFieldData(f)
assert.Error(t, err)
})
t.Run("more than one row", func(t *testing.T) {
f := &schemapb.FieldData{
Field: &schemapb.FieldData_Scalars{
Scalars: &schemapb.ScalarField{
Data: &schemapb.ScalarField_LongData{
LongData: &schemapb.LongArray{
Data: []int64{1, 2, 3},
},
},
},
},
}
_, err := CntOfFieldData(f)
assert.Error(t, err)
})
t.Run("more than one row", func(t *testing.T) {
f := WrapCntToFieldData(1000)
cnt, err := CntOfFieldData(f)
assert.NoError(t, err)
assert.Equal(t, int64(1000), cnt)
})
}

View File

@ -50,7 +50,7 @@ mkdir -p planpb
mkdir -p ../../cmd/tools/migration/legacy/legacypb
protoc_opt="${protoc} --proto_path=${API_PROTO_DIR} --proto_path=/usr/local/include --proto_path=."
protoc_opt="${protoc} --proto_path=${API_PROTO_DIR} --proto_path=/usr/local/include --proto_path=/usr/include --proto_path=."
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./etcdpb etcd_meta.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./indexcgopb index_cgo_msg.proto