Support Placeholder Parser and refine CreatePlan on predicate-less

Signed-off-by: FluorineDog <guilin.gou@zilliz.com>
pull/4973/head^2
FluorineDog 2020-11-12 12:18:07 +08:00 committed by yefu.chen
parent 1cd2fd9954
commit f0ec7a8c78
26 changed files with 531 additions and 721 deletions

View File

@ -38,10 +38,6 @@ class RowBatchDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<RowBatch> _instance;
} _RowBatch_default_instance_;
class VectorValuesDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<VectorValues> _instance;
} _VectorValues_default_instance_;
class PlaceholderValueDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<PlaceholderValue> _instance;
@ -338,22 +334,7 @@ static void InitDefaultsscc_info_StringResponse_service_5fmsg_2eproto() {
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_StringResponse_service_5fmsg_2eproto}, {
&scc_info_Status_common_2eproto.base,}};
static void InitDefaultsscc_info_VectorValues_service_5fmsg_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::milvus::proto::service::_VectorValues_default_instance_;
new (ptr) ::milvus::proto::service::VectorValues();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::milvus::proto::service::VectorValues::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_VectorValues_service_5fmsg_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_VectorValues_service_5fmsg_2eproto}, {
&scc_info_Blob_common_2eproto.base,}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_service_5fmsg_2eproto[17];
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_service_5fmsg_2eproto[16];
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_service_5fmsg_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_service_5fmsg_2eproto = nullptr;
@ -381,19 +362,13 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_service_5fmsg_2eproto::offsets
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::RowBatch, row_data_),
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::RowBatch, hash_keys_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::VectorValues, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::VectorValues, value_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::PlaceholderValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::PlaceholderValue, tag_),
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::PlaceholderValue, type_),
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::PlaceholderValue, value_),
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::PlaceholderValue, values_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::service::PlaceholderGroup, _internal_metadata_),
~0u, // no _extensions_
@ -488,27 +463,25 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOB
{ 0, -1, sizeof(::milvus::proto::service::CollectionName)},
{ 6, -1, sizeof(::milvus::proto::service::PartitionName)},
{ 13, -1, sizeof(::milvus::proto::service::RowBatch)},
{ 22, -1, sizeof(::milvus::proto::service::VectorValues)},
{ 28, -1, sizeof(::milvus::proto::service::PlaceholderValue)},
{ 36, -1, sizeof(::milvus::proto::service::PlaceholderGroup)},
{ 42, -1, sizeof(::milvus::proto::service::Query)},
{ 51, -1, sizeof(::milvus::proto::service::StringResponse)},
{ 58, -1, sizeof(::milvus::proto::service::BoolResponse)},
{ 65, -1, sizeof(::milvus::proto::service::StringListResponse)},
{ 72, -1, sizeof(::milvus::proto::service::IntegerListResponse)},
{ 79, -1, sizeof(::milvus::proto::service::IntegerRangeResponse)},
{ 87, -1, sizeof(::milvus::proto::service::CollectionDescription)},
{ 95, -1, sizeof(::milvus::proto::service::PartitionDescription)},
{ 103, -1, sizeof(::milvus::proto::service::Score)},
{ 110, -1, sizeof(::milvus::proto::service::Hits)},
{ 118, -1, sizeof(::milvus::proto::service::QueryResult)},
{ 22, -1, sizeof(::milvus::proto::service::PlaceholderValue)},
{ 30, -1, sizeof(::milvus::proto::service::PlaceholderGroup)},
{ 36, -1, sizeof(::milvus::proto::service::Query)},
{ 45, -1, sizeof(::milvus::proto::service::StringResponse)},
{ 52, -1, sizeof(::milvus::proto::service::BoolResponse)},
{ 59, -1, sizeof(::milvus::proto::service::StringListResponse)},
{ 66, -1, sizeof(::milvus::proto::service::IntegerListResponse)},
{ 73, -1, sizeof(::milvus::proto::service::IntegerRangeResponse)},
{ 81, -1, sizeof(::milvus::proto::service::CollectionDescription)},
{ 89, -1, sizeof(::milvus::proto::service::PartitionDescription)},
{ 97, -1, sizeof(::milvus::proto::service::Score)},
{ 104, -1, sizeof(::milvus::proto::service::Hits)},
{ 112, -1, sizeof(::milvus::proto::service::QueryResult)},
};
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::service::_CollectionName_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::service::_PartitionName_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::service::_RowBatch_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::service::_VectorValues_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::service::_PlaceholderValue_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::service::_PlaceholderGroup_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::milvus::proto::service::_Query_default_instance_),
@ -532,50 +505,49 @@ const char descriptor_table_protodef_service_5fmsg_2eproto[] PROTOBUF_SECTION_VA
"g\030\002 \001(\t\"z\n\010RowBatch\022\027\n\017collection_name\030\001"
" \001(\t\022\025\n\rpartition_tag\030\002 \001(\t\022+\n\010row_data\030"
"\003 \003(\0132\031.milvus.proto.common.Blob\022\021\n\thash"
"_keys\030\004 \003(\005\"8\n\014VectorValues\022(\n\005value\030\001 \003"
"(\0132\031.milvus.proto.common.Blob\"c\n\020Placeho"
"lderValue\022\013\n\003tag\030\001 \001(\t\0223\n\004type\030\002 \001(\0162%.m"
"ilvus.proto.service.PlaceholderType\022\r\n\005v"
"alue\030\003 \001(\014\"P\n\020PlaceholderGroup\022<\n\014placeh"
"olders\030\001 \003(\0132&.milvus.proto.service.Plac"
"eholderValue\"`\n\005Query\022\027\n\017collection_name"
"\030\001 \001(\t\022\026\n\016partition_tags\030\002 \003(\t\022\013\n\003dsl\030\003 "
"\001(\t\022\031\n\021placeholder_group\030\004 \001(\014\"L\n\016String"
"Response\022+\n\006status\030\001 \001(\0132\033.milvus.proto."
"common.Status\022\r\n\005value\030\002 \001(\t\"J\n\014BoolResp"
"onse\022+\n\006status\030\001 \001(\0132\033.milvus.proto.comm"
"on.Status\022\r\n\005value\030\002 \001(\010\"Q\n\022StringListRe"
"sponse\022+\n\006status\030\001 \001(\0132\033.milvus.proto.co"
"mmon.Status\022\016\n\006values\030\002 \003(\t\"R\n\023IntegerLi"
"stResponse\022+\n\006status\030\001 \001(\0132\033.milvus.prot"
"o.common.Status\022\016\n\006values\030\002 \003(\003\"_\n\024Integ"
"erRangeResponse\022+\n\006status\030\001 \001(\0132\033.milvus"
".proto.common.Status\022\r\n\005begin\030\002 \001(\003\022\013\n\003e"
"nd\030\003 \001(\003\"\262\001\n\025CollectionDescription\022+\n\006st"
"atus\030\001 \001(\0132\033.milvus.proto.common.Status\022"
"5\n\006schema\030\002 \001(\0132%.milvus.proto.schema.Co"
"llectionSchema\0225\n\nstatistics\030\003 \003(\0132!.mil"
"vus.proto.common.KeyValuePair\"\255\001\n\024Partit"
"ionDescription\022+\n\006status\030\001 \001(\0132\033.milvus."
"proto.common.Status\0221\n\004name\030\002 \001(\0132#.milv"
"us.proto.service.PartitionName\0225\n\nstatis"
"tics\030\003 \003(\0132!.milvus.proto.common.KeyValu"
"ePair\"$\n\005Score\022\013\n\003tag\030\001 \001(\t\022\016\n\006values\030\002 "
"\003(\002\"m\n\004Hits\022\013\n\003ids\030\001 \003(\003\022+\n\010row_data\030\002 \003"
"(\0132\031.milvus.proto.common.Blob\022+\n\006scores\030"
"\003 \003(\0132\033.milvus.proto.service.Score\"d\n\013Qu"
"eryResult\022+\n\006status\030\001 \001(\0132\033.milvus.proto"
".common.Status\022(\n\004hits\030\002 \003(\0132\032.milvus.pr"
"oto.service.Hits*@\n\017PlaceholderType\022\010\n\004N"
"ONE\020\000\022\021\n\rVECTOR_BINARY\020d\022\020\n\014VECTOR_FLOAT"
"\020eBCZAgithub.com/zilliztech/milvus-distr"
"ibuted/internal/proto/servicepbb\006proto3"
"_keys\030\004 \003(\005\"d\n\020PlaceholderValue\022\013\n\003tag\030\001"
" \001(\t\0223\n\004type\030\002 \001(\0162%.milvus.proto.servic"
"e.PlaceholderType\022\016\n\006values\030\003 \003(\014\"P\n\020Pla"
"ceholderGroup\022<\n\014placeholders\030\001 \003(\0132&.mi"
"lvus.proto.service.PlaceholderValue\"`\n\005Q"
"uery\022\027\n\017collection_name\030\001 \001(\t\022\026\n\016partiti"
"on_tags\030\002 \003(\t\022\013\n\003dsl\030\003 \001(\t\022\031\n\021placeholde"
"r_group\030\004 \001(\014\"L\n\016StringResponse\022+\n\006statu"
"s\030\001 \001(\0132\033.milvus.proto.common.Status\022\r\n\005"
"value\030\002 \001(\t\"J\n\014BoolResponse\022+\n\006status\030\001 "
"\001(\0132\033.milvus.proto.common.Status\022\r\n\005valu"
"e\030\002 \001(\010\"Q\n\022StringListResponse\022+\n\006status\030"
"\001 \001(\0132\033.milvus.proto.common.Status\022\016\n\006va"
"lues\030\002 \003(\t\"R\n\023IntegerListResponse\022+\n\006sta"
"tus\030\001 \001(\0132\033.milvus.proto.common.Status\022\016"
"\n\006values\030\002 \003(\003\"_\n\024IntegerRangeResponse\022+"
"\n\006status\030\001 \001(\0132\033.milvus.proto.common.Sta"
"tus\022\r\n\005begin\030\002 \001(\003\022\013\n\003end\030\003 \001(\003\"\262\001\n\025Coll"
"ectionDescription\022+\n\006status\030\001 \001(\0132\033.milv"
"us.proto.common.Status\0225\n\006schema\030\002 \001(\0132%"
".milvus.proto.schema.CollectionSchema\0225\n"
"\nstatistics\030\003 \003(\0132!.milvus.proto.common."
"KeyValuePair\"\255\001\n\024PartitionDescription\022+\n"
"\006status\030\001 \001(\0132\033.milvus.proto.common.Stat"
"us\0221\n\004name\030\002 \001(\0132#.milvus.proto.service."
"PartitionName\0225\n\nstatistics\030\003 \003(\0132!.milv"
"us.proto.common.KeyValuePair\"$\n\005Score\022\013\n"
"\003tag\030\001 \001(\t\022\016\n\006values\030\002 \003(\002\"m\n\004Hits\022\013\n\003id"
"s\030\001 \003(\003\022+\n\010row_data\030\002 \003(\0132\031.milvus.proto"
".common.Blob\022+\n\006scores\030\003 \003(\0132\033.milvus.pr"
"oto.service.Score\"d\n\013QueryResult\022+\n\006stat"
"us\030\001 \001(\0132\033.milvus.proto.common.Status\022(\n"
"\004hits\030\002 \003(\0132\032.milvus.proto.service.Hits*"
"@\n\017PlaceholderType\022\010\n\004NONE\020\000\022\021\n\rVECTOR_B"
"INARY\020d\022\020\n\014VECTOR_FLOAT\020eBCZAgithub.com/"
"zilliztech/milvus-distributed/internal/p"
"roto/servicepbb\006proto3"
;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_service_5fmsg_2eproto_deps[2] = {
&::descriptor_table_common_2eproto,
&::descriptor_table_schema_2eproto,
};
static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_service_5fmsg_2eproto_sccs[17] = {
static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_service_5fmsg_2eproto_sccs[16] = {
&scc_info_BoolResponse_service_5fmsg_2eproto.base,
&scc_info_CollectionDescription_service_5fmsg_2eproto.base,
&scc_info_CollectionName_service_5fmsg_2eproto.base,
@ -592,15 +564,14 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_ser
&scc_info_Score_service_5fmsg_2eproto.base,
&scc_info_StringListResponse_service_5fmsg_2eproto.base,
&scc_info_StringResponse_service_5fmsg_2eproto.base,
&scc_info_VectorValues_service_5fmsg_2eproto.base,
};
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_service_5fmsg_2eproto_once;
static bool descriptor_table_service_5fmsg_2eproto_initialized = false;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_service_5fmsg_2eproto = {
&descriptor_table_service_5fmsg_2eproto_initialized, descriptor_table_protodef_service_5fmsg_2eproto, "service_msg.proto", 1799,
&descriptor_table_service_5fmsg_2eproto_once, descriptor_table_service_5fmsg_2eproto_sccs, descriptor_table_service_5fmsg_2eproto_deps, 17, 2,
&descriptor_table_service_5fmsg_2eproto_initialized, descriptor_table_protodef_service_5fmsg_2eproto, "service_msg.proto", 1742,
&descriptor_table_service_5fmsg_2eproto_once, descriptor_table_service_5fmsg_2eproto_sccs, descriptor_table_service_5fmsg_2eproto_deps, 16, 2,
schemas, file_default_instances, TableStruct_service_5fmsg_2eproto::offsets,
file_level_metadata_service_5fmsg_2eproto, 17, file_level_enum_descriptors_service_5fmsg_2eproto, file_level_service_descriptors_service_5fmsg_2eproto,
file_level_metadata_service_5fmsg_2eproto, 16, file_level_enum_descriptors_service_5fmsg_2eproto, file_level_service_descriptors_service_5fmsg_2eproto,
};
// Force running AddDescriptors() at dynamic initialization time.
@ -1684,270 +1655,6 @@ void RowBatch::InternalSwap(RowBatch* other) {
}
// ===================================================================
void VectorValues::InitAsDefaultInstance() {
}
class VectorValues::_Internal {
public:
};
void VectorValues::clear_value() {
value_.Clear();
}
VectorValues::VectorValues()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:milvus.proto.service.VectorValues)
}
VectorValues::VectorValues(const VectorValues& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr),
value_(from.value_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:milvus.proto.service.VectorValues)
}
void VectorValues::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_VectorValues_service_5fmsg_2eproto.base);
}
VectorValues::~VectorValues() {
// @@protoc_insertion_point(destructor:milvus.proto.service.VectorValues)
SharedDtor();
}
void VectorValues::SharedDtor() {
}
void VectorValues::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const VectorValues& VectorValues::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_VectorValues_service_5fmsg_2eproto.base);
return *internal_default_instance();
}
void VectorValues::Clear() {
// @@protoc_insertion_point(message_clear_start:milvus.proto.service.VectorValues)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
value_.Clear();
_internal_metadata_.Clear();
}
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
const char* VectorValues::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// repeated .milvus.proto.common.Blob value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
ptr = ctx->ParseMessage(add_value(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
} while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
bool VectorValues::MergePartialFromCodedStream(
::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
::PROTOBUF_NAMESPACE_ID::uint32 tag;
// @@protoc_insertion_point(parse_start:milvus.proto.service.VectorValues)
for (;;) {
::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .milvus.proto.common.Blob value = 1;
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
input, add_value()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:milvus.proto.service.VectorValues)
return true;
failure:
// @@protoc_insertion_point(parse_failure:milvus.proto.service.VectorValues)
return false;
#undef DO_
}
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void VectorValues::SerializeWithCachedSizes(
::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:milvus.proto.service.VectorValues)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .milvus.proto.common.Blob value = 1;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->value_size()); i < n; i++) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
1,
this->value(static_cast<int>(i)),
output);
}
if (_internal_metadata_.have_unknown_fields()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
_internal_metadata_.unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:milvus.proto.service.VectorValues)
}
::PROTOBUF_NAMESPACE_ID::uint8* VectorValues::InternalSerializeWithCachedSizesToArray(
::PROTOBUF_NAMESPACE_ID::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:milvus.proto.service.VectorValues)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .milvus.proto.common.Blob value = 1;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->value_size()); i < n; i++) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
1, this->value(static_cast<int>(i)), target);
}
if (_internal_metadata_.have_unknown_fields()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:milvus.proto.service.VectorValues)
return target;
}
size_t VectorValues::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:milvus.proto.service.VectorValues)
size_t total_size = 0;
if (_internal_metadata_.have_unknown_fields()) {
total_size +=
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
_internal_metadata_.unknown_fields());
}
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// repeated .milvus.proto.common.Blob value = 1;
{
unsigned int count = static_cast<unsigned int>(this->value_size());
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
this->value(static_cast<int>(i)));
}
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void VectorValues::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:milvus.proto.service.VectorValues)
GOOGLE_DCHECK_NE(&from, this);
const VectorValues* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<VectorValues>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:milvus.proto.service.VectorValues)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:milvus.proto.service.VectorValues)
MergeFrom(*source);
}
}
void VectorValues::MergeFrom(const VectorValues& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:milvus.proto.service.VectorValues)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
value_.MergeFrom(from.value_);
}
void VectorValues::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:milvus.proto.service.VectorValues)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void VectorValues::CopyFrom(const VectorValues& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:milvus.proto.service.VectorValues)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool VectorValues::IsInitialized() const {
return true;
}
void VectorValues::InternalSwap(VectorValues* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
CastToBase(&value_)->InternalSwap(CastToBase(&other->value_));
}
::PROTOBUF_NAMESPACE_ID::Metadata VectorValues::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void PlaceholderValue::InitAsDefaultInstance() {
@ -1963,16 +1670,13 @@ PlaceholderValue::PlaceholderValue()
}
PlaceholderValue::PlaceholderValue(const PlaceholderValue& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_(nullptr),
values_(from.values_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
tag_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from.tag().empty()) {
tag_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.tag_);
}
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from.value().empty()) {
value_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value_);
}
type_ = from.type_;
// @@protoc_insertion_point(copy_constructor:milvus.proto.service.PlaceholderValue)
}
@ -1980,7 +1684,6 @@ PlaceholderValue::PlaceholderValue(const PlaceholderValue& from)
void PlaceholderValue::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_PlaceholderValue_service_5fmsg_2eproto.base);
tag_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
type_ = 0;
}
@ -1991,7 +1694,6 @@ PlaceholderValue::~PlaceholderValue() {
void PlaceholderValue::SharedDtor() {
tag_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
void PlaceholderValue::SetCachedSize(int size) const {
@ -2009,8 +1711,8 @@ void PlaceholderValue::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
values_.Clear();
tag_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
value_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
type_ = 0;
_internal_metadata_.Clear();
}
@ -2038,11 +1740,16 @@ const char* PlaceholderValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA
set_type(static_cast<::milvus::proto::service::PlaceholderType>(val));
} else goto handle_unusual;
continue;
// bytes value = 3;
// repeated bytes values = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(mutable_value(), ptr, ctx);
CHK_(ptr);
ptr -= 1;
do {
ptr += 1;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(add_values(), ptr, ctx);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
} while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
} else goto handle_unusual;
continue;
default: {
@ -2104,11 +1811,11 @@ bool PlaceholderValue::MergePartialFromCodedStream(
break;
}
// bytes value = 3;
// repeated bytes values = 3;
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes(
input, this->mutable_value()));
input, this->add_values()));
} else {
goto handle_unusual;
}
@ -2158,10 +1865,10 @@ void PlaceholderValue::SerializeWithCachedSizes(
2, this->type(), output);
}
// bytes value = 3;
if (this->value().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBytesMaybeAliased(
3, this->value(), output);
// repeated bytes values = 3;
for (int i = 0, n = this->values_size(); i < n; i++) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBytes(
3, this->values(i), output);
}
if (_internal_metadata_.have_unknown_fields()) {
@ -2194,11 +1901,10 @@ void PlaceholderValue::SerializeWithCachedSizes(
2, this->type(), target);
}
// bytes value = 3;
if (this->value().size() > 0) {
target =
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBytesToArray(
3, this->value(), target);
// repeated bytes values = 3;
for (int i = 0, n = this->values_size(); i < n; i++) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
WriteBytesToArray(3, this->values(i), target);
}
if (_internal_metadata_.have_unknown_fields()) {
@ -2222,6 +1928,14 @@ size_t PlaceholderValue::ByteSizeLong() const {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// repeated bytes values = 3;
total_size += 1 *
::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->values_size());
for (int i = 0, n = this->values_size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
this->values(i));
}
// string tag = 1;
if (this->tag().size() > 0) {
total_size += 1 +
@ -2229,13 +1943,6 @@ size_t PlaceholderValue::ByteSizeLong() const {
this->tag());
}
// bytes value = 3;
if (this->value().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
this->value());
}
// .milvus.proto.service.PlaceholderType type = 2;
if (this->type() != 0) {
total_size += 1 +
@ -2269,14 +1976,11 @@ void PlaceholderValue::MergeFrom(const PlaceholderValue& from) {
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
values_.MergeFrom(from.values_);
if (from.tag().size() > 0) {
tag_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.tag_);
}
if (from.value().size() > 0) {
value_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value_);
}
if (from.type() != 0) {
set_type(from.type());
}
@ -2303,10 +2007,9 @@ bool PlaceholderValue::IsInitialized() const {
void PlaceholderValue::InternalSwap(PlaceholderValue* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
values_.InternalSwap(CastToBase(&other->values_));
tag_.Swap(&other->tag_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
value_.Swap(&other->value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(type_, other->type_);
}
@ -6557,9 +6260,6 @@ template<> PROTOBUF_NOINLINE ::milvus::proto::service::PartitionName* Arena::Cre
template<> PROTOBUF_NOINLINE ::milvus::proto::service::RowBatch* Arena::CreateMaybeMessage< ::milvus::proto::service::RowBatch >(Arena* arena) {
return Arena::CreateInternal< ::milvus::proto::service::RowBatch >(arena);
}
template<> PROTOBUF_NOINLINE ::milvus::proto::service::VectorValues* Arena::CreateMaybeMessage< ::milvus::proto::service::VectorValues >(Arena* arena) {
return Arena::CreateInternal< ::milvus::proto::service::VectorValues >(arena);
}
template<> PROTOBUF_NOINLINE ::milvus::proto::service::PlaceholderValue* Arena::CreateMaybeMessage< ::milvus::proto::service::PlaceholderValue >(Arena* arena) {
return Arena::CreateInternal< ::milvus::proto::service::PlaceholderValue >(arena);
}

View File

@ -50,7 +50,7 @@ struct TableStruct_service_5fmsg_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[17]
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[16]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
@ -108,9 +108,6 @@ extern StringListResponseDefaultTypeInternal _StringListResponse_default_instanc
class StringResponse;
class StringResponseDefaultTypeInternal;
extern StringResponseDefaultTypeInternal _StringResponse_default_instance_;
class VectorValues;
class VectorValuesDefaultTypeInternal;
extern VectorValuesDefaultTypeInternal _VectorValues_default_instance_;
} // namespace service
} // namespace proto
} // namespace milvus
@ -131,7 +128,6 @@ template<> ::milvus::proto::service::RowBatch* Arena::CreateMaybeMessage<::milvu
template<> ::milvus::proto::service::Score* Arena::CreateMaybeMessage<::milvus::proto::service::Score>(Arena*);
template<> ::milvus::proto::service::StringListResponse* Arena::CreateMaybeMessage<::milvus::proto::service::StringListResponse>(Arena*);
template<> ::milvus::proto::service::StringResponse* Arena::CreateMaybeMessage<::milvus::proto::service::StringResponse>(Arena*);
template<> ::milvus::proto::service::VectorValues* Arena::CreateMaybeMessage<::milvus::proto::service::VectorValues>(Arena*);
PROTOBUF_NAMESPACE_CLOSE
namespace milvus {
namespace proto {
@ -629,143 +625,6 @@ class RowBatch :
};
// -------------------------------------------------------------------
class VectorValues :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.service.VectorValues) */ {
public:
VectorValues();
virtual ~VectorValues();
VectorValues(const VectorValues& from);
VectorValues(VectorValues&& from) noexcept
: VectorValues() {
*this = ::std::move(from);
}
inline VectorValues& operator=(const VectorValues& from) {
CopyFrom(from);
return *this;
}
inline VectorValues& operator=(VectorValues&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const VectorValues& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const VectorValues* internal_default_instance() {
return reinterpret_cast<const VectorValues*>(
&_VectorValues_default_instance_);
}
static constexpr int kIndexInFileMessages =
3;
friend void swap(VectorValues& a, VectorValues& b) {
a.Swap(&b);
}
inline void Swap(VectorValues* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline VectorValues* New() const final {
return CreateMaybeMessage<VectorValues>(nullptr);
}
VectorValues* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<VectorValues>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const VectorValues& from);
void MergeFrom(const VectorValues& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
#else
bool MergePartialFromCodedStream(
::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(VectorValues* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "milvus.proto.service.VectorValues";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_service_5fmsg_2eproto);
return ::descriptor_table_service_5fmsg_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kValueFieldNumber = 1,
};
// repeated .milvus.proto.common.Blob value = 1;
int value_size() const;
void clear_value();
::milvus::proto::common::Blob* mutable_value(int index);
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::Blob >*
mutable_value();
const ::milvus::proto::common::Blob& value(int index) const;
::milvus::proto::common::Blob* add_value();
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::Blob >&
value() const;
// @@protoc_insertion_point(class_scope:milvus.proto.service.VectorValues)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::Blob > value_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_service_5fmsg_2eproto;
};
// -------------------------------------------------------------------
class PlaceholderValue :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.service.PlaceholderValue) */ {
public:
@ -808,7 +667,7 @@ class PlaceholderValue :
&_PlaceholderValue_default_instance_);
}
static constexpr int kIndexInFileMessages =
4;
3;
friend void swap(PlaceholderValue& a, PlaceholderValue& b) {
a.Swap(&b);
@ -879,10 +738,27 @@ class PlaceholderValue :
// accessors -------------------------------------------------------
enum : int {
kValuesFieldNumber = 3,
kTagFieldNumber = 1,
kValueFieldNumber = 3,
kTypeFieldNumber = 2,
};
// repeated bytes values = 3;
int values_size() const;
void clear_values();
const std::string& values(int index) const;
std::string* mutable_values(int index);
void set_values(int index, const std::string& value);
void set_values(int index, std::string&& value);
void set_values(int index, const char* value);
void set_values(int index, const void* value, size_t size);
std::string* add_values();
void add_values(const std::string& value);
void add_values(std::string&& value);
void add_values(const char* value);
void add_values(const void* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& values() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_values();
// string tag = 1;
void clear_tag();
const std::string& tag() const;
@ -894,17 +770,6 @@ class PlaceholderValue :
std::string* release_tag();
void set_allocated_tag(std::string* tag);
// bytes value = 3;
void clear_value();
const std::string& value() const;
void set_value(const std::string& value);
void set_value(std::string&& value);
void set_value(const char* value);
void set_value(const void* value, size_t size);
std::string* mutable_value();
std::string* release_value();
void set_allocated_value(std::string* value);
// .milvus.proto.service.PlaceholderType type = 2;
void clear_type();
::milvus::proto::service::PlaceholderType type() const;
@ -915,8 +780,8 @@ class PlaceholderValue :
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> values_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr tag_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr value_;
int type_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_service_5fmsg_2eproto;
@ -965,7 +830,7 @@ class PlaceholderGroup :
&_PlaceholderGroup_default_instance_);
}
static constexpr int kIndexInFileMessages =
5;
4;
friend void swap(PlaceholderGroup& a, PlaceholderGroup& b) {
a.Swap(&b);
@ -1102,7 +967,7 @@ class Query :
&_Query_default_instance_);
}
static constexpr int kIndexInFileMessages =
6;
5;
friend void swap(Query& a, Query& b) {
a.Swap(&b);
@ -1284,7 +1149,7 @@ class StringResponse :
&_StringResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
7;
6;
friend void swap(StringResponse& a, StringResponse& b) {
a.Swap(&b);
@ -1431,7 +1296,7 @@ class BoolResponse :
&_BoolResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
8;
7;
friend void swap(BoolResponse& a, BoolResponse& b) {
a.Swap(&b);
@ -1572,7 +1437,7 @@ class StringListResponse :
&_StringListResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
9;
8;
friend void swap(StringListResponse& a, StringListResponse& b) {
a.Swap(&b);
@ -1725,7 +1590,7 @@ class IntegerListResponse :
&_IntegerListResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
10;
9;
friend void swap(IntegerListResponse& a, IntegerListResponse& b) {
a.Swap(&b);
@ -1873,7 +1738,7 @@ class IntegerRangeResponse :
&_IntegerRangeResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
11;
10;
friend void swap(IntegerRangeResponse& a, IntegerRangeResponse& b) {
a.Swap(&b);
@ -2021,7 +1886,7 @@ class CollectionDescription :
&_CollectionDescription_default_instance_);
}
static constexpr int kIndexInFileMessages =
12;
11;
friend void swap(CollectionDescription& a, CollectionDescription& b) {
a.Swap(&b);
@ -2178,7 +2043,7 @@ class PartitionDescription :
&_PartitionDescription_default_instance_);
}
static constexpr int kIndexInFileMessages =
13;
12;
friend void swap(PartitionDescription& a, PartitionDescription& b) {
a.Swap(&b);
@ -2335,7 +2200,7 @@ class Score :
&_Score_default_instance_);
}
static constexpr int kIndexInFileMessages =
14;
13;
friend void swap(Score& a, Score& b) {
a.Swap(&b);
@ -2486,7 +2351,7 @@ class Hits :
&_Hits_default_instance_);
}
static constexpr int kIndexInFileMessages =
15;
14;
friend void swap(Hits& a, Hits& b) {
a.Swap(&b);
@ -2650,7 +2515,7 @@ class QueryResult :
&_QueryResult_default_instance_);
}
static constexpr int kIndexInFileMessages =
16;
15;
friend void swap(QueryResult& a, QueryResult& b) {
a.Swap(&b);
@ -3086,37 +2951,6 @@ RowBatch::mutable_hash_keys() {
// -------------------------------------------------------------------
// VectorValues
// repeated .milvus.proto.common.Blob value = 1;
inline int VectorValues::value_size() const {
return value_.size();
}
inline ::milvus::proto::common::Blob* VectorValues::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:milvus.proto.service.VectorValues.value)
return value_.Mutable(index);
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::Blob >*
VectorValues::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:milvus.proto.service.VectorValues.value)
return &value_;
}
inline const ::milvus::proto::common::Blob& VectorValues::value(int index) const {
// @@protoc_insertion_point(field_get:milvus.proto.service.VectorValues.value)
return value_.Get(index);
}
inline ::milvus::proto::common::Blob* VectorValues::add_value() {
// @@protoc_insertion_point(field_add:milvus.proto.service.VectorValues.value)
return value_.Add();
}
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::Blob >&
VectorValues::value() const {
// @@protoc_insertion_point(field_list:milvus.proto.service.VectorValues.value)
return value_;
}
// -------------------------------------------------------------------
// PlaceholderValue
// string tag = 1;
@ -3184,55 +3018,69 @@ inline void PlaceholderValue::set_type(::milvus::proto::service::PlaceholderType
// @@protoc_insertion_point(field_set:milvus.proto.service.PlaceholderValue.type)
}
// bytes value = 3;
inline void PlaceholderValue::clear_value() {
value_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
// repeated bytes values = 3;
inline int PlaceholderValue::values_size() const {
return values_.size();
}
inline const std::string& PlaceholderValue::value() const {
// @@protoc_insertion_point(field_get:milvus.proto.service.PlaceholderValue.value)
return value_.GetNoArena();
inline void PlaceholderValue::clear_values() {
values_.Clear();
}
inline void PlaceholderValue::set_value(const std::string& value) {
value_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:milvus.proto.service.PlaceholderValue.value)
inline const std::string& PlaceholderValue::values(int index) const {
// @@protoc_insertion_point(field_get:milvus.proto.service.PlaceholderValue.values)
return values_.Get(index);
}
inline void PlaceholderValue::set_value(std::string&& value) {
value_.SetNoArena(
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:milvus.proto.service.PlaceholderValue.value)
inline std::string* PlaceholderValue::mutable_values(int index) {
// @@protoc_insertion_point(field_mutable:milvus.proto.service.PlaceholderValue.values)
return values_.Mutable(index);
}
inline void PlaceholderValue::set_value(const char* value) {
inline void PlaceholderValue::set_values(int index, const std::string& value) {
// @@protoc_insertion_point(field_set:milvus.proto.service.PlaceholderValue.values)
values_.Mutable(index)->assign(value);
}
inline void PlaceholderValue::set_values(int index, std::string&& value) {
// @@protoc_insertion_point(field_set:milvus.proto.service.PlaceholderValue.values)
values_.Mutable(index)->assign(std::move(value));
}
inline void PlaceholderValue::set_values(int index, const char* value) {
GOOGLE_DCHECK(value != nullptr);
value_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:milvus.proto.service.PlaceholderValue.value)
values_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:milvus.proto.service.PlaceholderValue.values)
}
inline void PlaceholderValue::set_value(const void* value, size_t size) {
value_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:milvus.proto.service.PlaceholderValue.value)
inline void PlaceholderValue::set_values(int index, const void* value, size_t size) {
values_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:milvus.proto.service.PlaceholderValue.values)
}
inline std::string* PlaceholderValue::mutable_value() {
// @@protoc_insertion_point(field_mutable:milvus.proto.service.PlaceholderValue.value)
return value_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
inline std::string* PlaceholderValue::add_values() {
// @@protoc_insertion_point(field_add_mutable:milvus.proto.service.PlaceholderValue.values)
return values_.Add();
}
inline std::string* PlaceholderValue::release_value() {
// @@protoc_insertion_point(field_release:milvus.proto.service.PlaceholderValue.value)
return value_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
inline void PlaceholderValue::add_values(const std::string& value) {
values_.Add()->assign(value);
// @@protoc_insertion_point(field_add:milvus.proto.service.PlaceholderValue.values)
}
inline void PlaceholderValue::set_allocated_value(std::string* value) {
if (value != nullptr) {
} else {
}
value_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set_allocated:milvus.proto.service.PlaceholderValue.value)
inline void PlaceholderValue::add_values(std::string&& value) {
values_.Add(std::move(value));
// @@protoc_insertion_point(field_add:milvus.proto.service.PlaceholderValue.values)
}
inline void PlaceholderValue::add_values(const char* value) {
GOOGLE_DCHECK(value != nullptr);
values_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:milvus.proto.service.PlaceholderValue.values)
}
inline void PlaceholderValue::add_values(const void* value, size_t size) {
values_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:milvus.proto.service.PlaceholderValue.values)
}
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>&
PlaceholderValue::values() const {
// @@protoc_insertion_point(field_list:milvus.proto.service.PlaceholderValue.values)
return values_;
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>*
PlaceholderValue::mutable_values() {
// @@protoc_insertion_point(field_mutable_list:milvus.proto.service.PlaceholderValue.values)
return &values_;
}
// -------------------------------------------------------------------
@ -4460,8 +4308,6 @@ QueryResult::hits() const {
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)

View File

@ -6,7 +6,7 @@ set(MILVUS_QUERY_SRCS
visitors/ShowPlanNodeVisitor.cpp
visitors/ExecPlanNodeVisitor.cpp
Parser.cpp
Plan.cpp
)
add_library(milvus_query ${MILVUS_QUERY_SRCS})
target_link_libraries(milvus_query libprotobuf)

View File

@ -94,7 +94,7 @@ Status
ProcessBooleanQueryJson(const milvus::json& query_json,
query_old::BooleanQueryPtr& boolean_query,
query_old::QueryPtr& query_ptr) {
#if 0
#if 1
if (query_json.empty()) {
return Status{SERVER_INVALID_ARGUMENT, "BoolQuery is null"};
}
@ -176,7 +176,7 @@ DeserializeJsonToBoolQuery(const google::protobuf::RepeatedPtrField<::milvus::gr
const std::string& dsl_string,
query_old::BooleanQueryPtr& boolean_query,
query_old::QueryPtr& query_ptr) {
#if 0
#if 1
try {
milvus::json dsl_json = json::parse(dsl_string);

View File

@ -0,0 +1,118 @@
#include "PlanImpl.h"
#include "utils/Json.h"
#include "PlanNode.h"
#include "utils/EasyAssert.h"
#include "pb/service_msg.pb.h"
#include <vector>
#include <boost/align/aligned_allocator.hpp>
namespace milvus::query {
static std::unique_ptr<VectorPlanNode>
CreateVec(const std::string& field_name, const json& vec_info) {
// TODO add binary info
auto vec_node = std::make_unique<FloatVectorANNS>();
auto topK = vec_info["topk"];
vec_node->query_info_.topK_ = topK;
vec_node->query_info_.metric_type_ = vec_info["metric_type"];
vec_node->query_info_.search_params_ = vec_info["params"];
vec_node->query_info_.field_id_ = field_name;
vec_node->placeholder_tag_ = vec_info["query"];
return vec_node;
}
static std::unique_ptr<Plan>
CreatePlanImplNaive(const std::string& dsl_str) {
auto plan = std::unique_ptr<Plan>();
auto dsl = nlohmann::json::parse(dsl_str);
nlohmann::json vec_pack;
auto& bool_dsl = dsl["bool"];
if (bool_dsl.contains("must")) {
auto& packs = bool_dsl["must"];
for (auto& pack : packs) {
if (pack.contains("vector")) {
auto iter = pack["vector"].begin();
auto key = iter.key();
auto& body = iter.value();
plan->plan_node_ = CreateVec(key, body);
}
}
} else if (bool_dsl.contains("vector")) {
auto iter = bool_dsl["vector"].begin();
auto key = iter.key();
auto& body = iter.value();
plan->plan_node_ = CreateVec(key, body);
} else {
PanicInfo("Unsupported DSL: vector node not detected");
}
return plan;
}
void
CheckNull(const Json& json) {
Assert(!json.is_null());
}
class PlanParser {
void
ParseBoolBody(const Json& dsl) {
CheckNull(dsl);
for (const auto& item : dsl.items()) {
PanicInfo("unimplemented");
}
}
void
CreatePlanImpl(const Json& dsl) {
if (dsl.empty()) {
PanicInfo("DSL Is Empty or Invalid");
}
if (!dsl.contains("bool")) {
auto bool_dsl = dsl["bool"];
ParseBoolBody(bool_dsl);
}
PanicInfo("unimplemented");
}
};
std::unique_ptr<Plan>
CreatePlan(const std::string& dsl_str) {
auto plan = CreatePlanImplNaive(dsl_str);
return plan;
}
std::unique_ptr<PlaceholderGroup>
ParsePlaceholderGroup(const char* placeholder_group_blob) {
namespace ser = milvus::proto::service;
auto result = std::unique_ptr<PlaceholderGroup>();
ser::PlaceholderGroup ph_group;
GOOGLE_PROTOBUF_PARSER_ASSERT(ph_group.ParseFromString(placeholder_group_blob));
for (auto& info : ph_group.placeholders()) {
Placeholder element;
element.tag_ = info.tag();
element.num_of_queries_ = info.values_size();
AssertInfo(element.num_of_queries_, "must have queries");
element.line_sizeof_ = info.values().Get(0).size();
auto& target = element.blob_;
target.reserve(element.line_sizeof_ * element.num_of_queries_);
for (auto& line : info.values()) {
Assert(element.line_sizeof_ == line.size());
target.insert(target.end(), line.begin(), line.end());
}
result->emplace_back(std::move(element));
}
return result;
}
int64_t
GetTopK(const Plan* plan) {
return plan->plan_node_->query_info_.topK_;
}
int64_t
GetNumOfQueries(const PlaceholderGroup* group) {
return group->at(0).num_of_queries_;
}
} // namespace milvus::query

View File

@ -0,0 +1,26 @@
#pragma once
#include <memory>
#include <string_view>
namespace milvus::query {
// NOTE: APIs for C wrapper
// Incomplete Definition, shouldn't be instantiated
struct Plan;
struct PlaceholderGroup;
std::unique_ptr<Plan>
CreatePlan(const std::string& dsl);
std::unique_ptr<PlaceholderGroup>
ParsePlaceholderGroup(const char* placeholder_group_blob);
int64_t
GetNumOfQueries(const PlaceholderGroup*);
// Query Overall TopK from Plan
// Used to alloc result memory at Go side
int64_t
GetTopK(const Plan*);
} // namespace milvus::query

View File

@ -0,0 +1,46 @@
#pragma once
#include "Plan.h"
#include "utils/Json.h"
#include "PlanNode.h"
#include "utils/EasyAssert.h"
#include "pb/service_msg.pb.h"
#include <vector>
#include <boost/align/aligned_allocator.hpp>
namespace milvus::query {
using Json = nlohmann::json;
// class definitions
struct Plan {
std::unique_ptr<VectorPlanNode> plan_node_;
// TODO: add move extra info
};
template <typename T>
using aligned_vector = std::vector<T, boost::alignment::aligned_allocator<T, 512>>;
struct Placeholder {
// milvus::proto::service::PlaceholderGroup group_;
std::string tag_;
int64_t num_of_queries_;
int64_t line_sizeof_;
aligned_vector<char> blob_;
template <typename T>
const T*
get_blob() const {
return reinterpret_cast<const T*>(blob_.data());
}
template <typename T>
T*
get_blob() {
return reinterpret_cast<T*>(blob_.data());
}
};
struct PlaceholderGroup : std::vector<Placeholder> {
using std::vector<Placeholder>::vector;
};
} // namespace milvus::query

View File

@ -5,6 +5,7 @@
#include <string>
#include <optional>
#include "Expr.h"
#include "utils/Json.h"
namespace milvus::query {
class PlanNodeVisitor;
@ -26,12 +27,12 @@ struct PlanNode {
using PlanNodePtr = std::unique_ptr<PlanNode>;
struct QueryInfo{
struct QueryInfo {
int64_t num_queries_;
int64_t dim_;
int64_t topK_;
FieldId field_id_;
std::string metric_type_; // TODO: use enum
nlohmann::json search_params_;
};
struct VectorPlanNode : PlanNode {
@ -44,12 +45,16 @@ struct VectorPlanNode : PlanNode {
};
struct FloatVectorANNS : VectorPlanNode {
std::string placeholder_tag_;
public:
void
accept(PlanNodeVisitor&) override;
};
struct BinaryVectorANNS : VectorPlanNode {
std::string placeholder_tag_;
public:
void
accept(PlanNodeVisitor&) override;

View File

@ -130,7 +130,7 @@ using QueryPtr = std::shared_ptr<Query>;
} // namespace query_old
namespace query {
struct Query {
struct QueryDeprecated {
int64_t num_queries; //
int topK; // topK of queries
std::string field_name; // must be fakevec, whose data_type must be VEC_FLOAT(DIM)
@ -142,6 +142,6 @@ struct Query {
// return std::
//}
using QueryPtr = std::shared_ptr<Query>;
using QueryDeprecatedPtr = std::shared_ptr<QueryDeprecated>;
} // namespace query
} // namespace milvus

View File

@ -13,22 +13,28 @@ class ExecPlanNodeVisitor : PlanNodeVisitor {
public:
using RetType = segcore::QueryResult;
ExecPlanNodeVisitor(segcore::SegmentBase& segment, segcore::Timestamp timestamp, const float* src_data)
: segment_(segment), timestamp_(timestamp), src_data_(src_data) {
ExecPlanNodeVisitor(segcore::SegmentBase& segment,
segcore::Timestamp timestamp,
const PlaceholderGroup& placeholder_group)
: segment_(segment), timestamp_(timestamp), placeholder_group_(placeholder_group) {
}
// using RetType = nlohmann::json;
RetType get_moved_result(){
RetType
get_moved_result(PlanNode& node) {
assert(!ret_.has_value());
node.accept(*this);
assert(ret_.has_value());
auto ret = std::move(ret_).value();
ret_ = std::nullopt;
return ret;
}
private:
// std::optional<RetType> ret_;
segcore::SegmentBase& segment_;
segcore::Timestamp timestamp_;
const float* src_data_;
const PlaceholderGroup& placeholder_group_;
std::optional<RetType> ret_;
};

View File

@ -1,4 +1,5 @@
#include "utils/Json.h"
#include "query/PlanImpl.h"
#include "segcore/SegmentBase.h"
#include "query/generated/ExecPlanNodeVisitor.h"
#include "segcore/SegmentSmallIndex.h"
@ -12,12 +13,15 @@ namespace impl {
class ExecPlanNodeVisitor : PlanNodeVisitor {
public:
using RetType = segcore::QueryResult;
ExecPlanNodeVisitor(segcore::SegmentBase& segment, segcore::Timestamp timestamp, const float* src_data)
: segment_(segment), timestamp_(timestamp), src_data_(src_data) {
ExecPlanNodeVisitor(segcore::SegmentBase& segment,
segcore::Timestamp timestamp,
const PlaceholderGroup& placeholder_group)
: segment_(segment), timestamp_(timestamp), placeholder_group_(placeholder_group) {
}
// using RetType = nlohmann::json;
RetType get_moved_result(PlanNode& node){
RetType
get_moved_result(PlanNode& node) {
assert(!ret_.has_value());
node.accept(*this);
assert(ret_.has_value());
@ -25,11 +29,12 @@ class ExecPlanNodeVisitor : PlanNodeVisitor {
ret_ = std::nullopt;
return ret;
}
private:
// std::optional<RetType> ret_;
segcore::SegmentBase& segment_;
segcore::Timestamp timestamp_;
const float* src_data_;
const PlaceholderGroup& placeholder_group_;
std::optional<RetType> ret_;
};
@ -43,7 +48,8 @@ ExecPlanNodeVisitor::visit(FloatVectorANNS& node) {
auto segment = dynamic_cast<segcore::SegmentSmallIndex*>(&segment_);
AssertInfo(segment, "support SegmentSmallIndex Only");
RetType ret;
segment->QueryBruteForceImpl(node.query_info_, src_data_, timestamp_, ret);
auto src_data = placeholder_group_.at(0).get_blob<float>();
segment->QueryBruteForceImpl(node.query_info_, src_data, timestamp_, ret);
ret_ = ret;
}

View File

@ -42,15 +42,17 @@ ShowPlanNodeVisitor::visit(FloatVectorANNS& node) {
Json json_body{
{"node_type", "FloatVectorANNS"}, //
{"metric_type", info.metric_type_}, //
{"dim", info.dim_}, //
{"field_id_", info.field_id_}, //
{"num_queries", info.num_queries_}, //
{"topK", info.topK_}, //
// {"dim", info.dim_}, //
{"field_id_", info.field_id_}, //
{"num_queries", info.num_queries_}, //
{"topK", info.topK_}, //
{"search_params", info.search_params_}, //
{"placeholder_tag", node.placeholder_tag_}, //
};
if (node.predicate_.has_value()) {
AssertInfo(false, "unimplemented");
PanicInfo("unimplemented");
} else {
// json_body["predicate"] = "nullopt";
json_body["predicate"] = "nullopt";
}
ret_ = json_body;
}

View File

@ -10,6 +10,7 @@ set(SEGCORE_FILES
SegmentBase.cpp
IndexingEntry.cpp
InsertRecord.cpp
Reduce.cpp
)
add_library(milvus_segcore SHARED
${SEGCORE_FILES}

View File

@ -8,8 +8,7 @@
namespace milvus::segcore {
Collection::Collection(const std::string& collection_proto)
: collection_proto_(collection_proto) {
Collection::Collection(const std::string& collection_proto) : collection_proto_(collection_proto) {
parse();
index_ = nullptr;
}

View File

@ -0,0 +1,41 @@
#include <cstdint>
#include <vector>
#include <algorithm>
namespace milvus::segcore {
void
merge_into(int64_t queries,
int64_t topk,
float* distances,
int64_t* uids,
const float* new_distances,
const int64_t* new_uids) {
for (int64_t qn = 0; qn < queries; ++qn) {
auto base = qn * topk;
auto src2_dis = distances + base;
auto src2_uids = uids + base;
auto src1_dis = new_distances + base;
auto src1_uids = new_uids + base;
std::vector<float> buf_dis(topk);
std::vector<int64_t> buf_uids(topk);
auto it1 = 0;
auto it2 = 0;
for (auto buf = 0; buf < topk; ++buf) {
if (src1_dis[it1] <= src2_dis[it2]) {
buf_dis[buf] = src1_dis[it1];
buf_uids[buf] = src1_uids[it1];
++it1;
} else {
buf_dis[buf] = src2_dis[it2];
buf_uids[buf] = src2_uids[it2];
++it2;
}
}
std::copy_n(buf_dis.data(), topk, src2_dis);
std::copy_n(buf_uids.data(), topk, src2_uids);
}
}
} // namespace milvus::segcore

View File

@ -0,0 +1,13 @@
#pragma once
#include <cstdint>
#include <vector>
#include <algorithm>
namespace milvus::segcore {
void
merge_into(int64_t num_queries,
int64_t topk,
float* distances,
int64_t* uids,
const float* new_distances,
const int64_t* new_uids);
} // namespace milvus::segcore

View File

@ -7,6 +7,7 @@
// #include "knowhere/index/Index.h"
// #include "knowhere/index/IndexType.h"
#include "query/deprecated/GeneralQuery.h"
#include "query/Plan.h"
namespace milvus {
namespace segcore {
@ -49,11 +50,14 @@ class SegmentBase {
// query contains metadata of
virtual Status
QueryDeprecated(query::QueryPtr query, Timestamp timestamp, QueryResult& results) = 0;
QueryDeprecated(query::QueryDeprecatedPtr query, Timestamp timestamp, QueryResult& results) = 0;
// // THIS FUNCTION IS REMOVED
// virtual Status
// GetEntityByIds(Timestamp timestamp, const std::vector<Id>& ids, DataChunkPtr& results) = 0;
virtual Status
Search(const query::Plan* Plan,
const query::PlaceholderGroup* placeholder_groups[],
const Timestamp timestamps[],
int num_groups,
QueryResult& results) = 0;
// stop receive insert requests
virtual Status

View File

@ -236,7 +236,7 @@ get_barrier(const RecordType& record, Timestamp timestamp) {
}
Status
SegmentNaive::QueryImpl(query::QueryPtr query_info, Timestamp timestamp, QueryResult& result) {
SegmentNaive::QueryImpl(query::QueryDeprecatedPtr query_info, Timestamp timestamp, QueryResult& result) {
auto ins_barrier = get_barrier(record_, timestamp);
auto del_barrier = get_barrier(deleted_record_, timestamp);
auto bitmap_holder = get_deleted_bitmap(del_barrier, timestamp, ins_barrier, true);
@ -332,7 +332,7 @@ merge_into(int64_t queries,
}
Status
SegmentNaive::QueryBruteForceImpl(query::QueryPtr query_info, Timestamp timestamp, QueryResult& results) {
SegmentNaive::QueryBruteForceImpl(query::QueryDeprecatedPtr query_info, Timestamp timestamp, QueryResult& results) {
auto ins_barrier = get_barrier(record_, timestamp);
auto del_barrier = get_barrier(deleted_record_, timestamp);
auto bitmap_holder = get_deleted_bitmap(del_barrier, timestamp, ins_barrier);
@ -390,7 +390,7 @@ SegmentNaive::QueryBruteForceImpl(query::QueryPtr query_info, Timestamp timestam
}
Status
SegmentNaive::QuerySlowImpl(query::QueryPtr query_info, Timestamp timestamp, QueryResult& result) {
SegmentNaive::QuerySlowImpl(query::QueryDeprecatedPtr query_info, Timestamp timestamp, QueryResult& result) {
auto ins_barrier = get_barrier(record_, timestamp);
auto del_barrier = get_barrier(deleted_record_, timestamp);
auto bitmap_holder = get_deleted_bitmap(del_barrier, timestamp, ins_barrier);
@ -458,12 +458,12 @@ SegmentNaive::QuerySlowImpl(query::QueryPtr query_info, Timestamp timestamp, Que
}
Status
SegmentNaive::QueryDeprecated(query::QueryPtr query_info, Timestamp timestamp, QueryResult& result) {
SegmentNaive::QueryDeprecated(query::QueryDeprecatedPtr query_info, Timestamp timestamp, QueryResult& result) {
// TODO: enable delete
// TODO: enable index
// TODO: remove mock
if (query_info == nullptr) {
query_info = std::make_shared<query::Query>();
query_info = std::make_shared<query::QueryDeprecated>();
query_info->field_name = "fakevec";
query_info->topK = 10;
query_info->num_queries = 1;

View File

@ -45,7 +45,16 @@ class SegmentNaive : public SegmentBase {
// query contains metadata of
Status
QueryDeprecated(query::QueryPtr query_info, Timestamp timestamp, QueryResult& results) override;
QueryDeprecated(query::QueryDeprecatedPtr query_info, Timestamp timestamp, QueryResult& results) override;
virtual Status
Search(const query::Plan* Plan,
const query::PlaceholderGroup* placeholder_groups[],
const Timestamp timestamps[],
int num_groups,
QueryResult& results) override {
PanicInfo("unimplemented");
}
// stop receive insert requests
// will move data to immutable vector or something
@ -105,13 +114,13 @@ class SegmentNaive : public SegmentBase {
get_deleted_bitmap(int64_t del_barrier, Timestamp query_timestamp, int64_t insert_barrier, bool force = false);
Status
QueryImpl(query::QueryPtr query, Timestamp timestamp, QueryResult& results);
QueryImpl(query::QueryDeprecatedPtr query, Timestamp timestamp, QueryResult& results);
Status
QuerySlowImpl(query::QueryPtr query, Timestamp timestamp, QueryResult& results);
QuerySlowImpl(query::QueryDeprecatedPtr query, Timestamp timestamp, QueryResult& results);
Status
QueryBruteForceImpl(query::QueryPtr query, Timestamp timestamp, QueryResult& results);
QueryBruteForceImpl(query::QueryDeprecatedPtr query, Timestamp timestamp, QueryResult& results);
template <typename Type>
knowhere::IndexPtr

View File

@ -9,8 +9,11 @@
#include <knowhere/index/vector_index/adapter/VectorAdapter.h>
#include <knowhere/index/vector_index/VecIndexFactory.h>
#include <faiss/utils/distances.h>
#include "query/generated/ExecPlanNodeVisitor.h"
#include "segcore/SegmentSmallIndex.h"
#include "query/PlanNode.h"
#include "query/PlanImpl.h"
#include "segcore/Reduce.h"
namespace milvus::segcore {
@ -217,46 +220,11 @@ get_barrier(const RecordType& record, Timestamp timestamp) {
return beg;
}
static void
merge_into(int64_t queries,
int64_t topk,
float* distances,
int64_t* uids,
const float* new_distances,
const int64_t* new_uids) {
for (int64_t qn = 0; qn < queries; ++qn) {
auto base = qn * topk;
auto src2_dis = distances + base;
auto src2_uids = uids + base;
auto src1_dis = new_distances + base;
auto src1_uids = new_uids + base;
std::vector<float> buf_dis(topk);
std::vector<int64_t> buf_uids(topk);
auto it1 = 0;
auto it2 = 0;
for (auto buf = 0; buf < topk; ++buf) {
if (src1_dis[it1] <= src2_dis[it2]) {
buf_dis[buf] = src1_dis[it1];
buf_uids[buf] = src1_uids[it1];
++it1;
} else {
buf_dis[buf] = src2_dis[it2];
buf_uids[buf] = src2_uids[it2];
++it2;
}
}
std::copy_n(buf_dis.data(), topk, src2_dis);
std::copy_n(buf_uids.data(), topk, src2_uids);
}
}
Status
SegmentSmallIndex::QueryBruteForceImpl(const query::QueryInfo& info, const float* query_data, Timestamp timestamp, QueryResult& results) {
SegmentSmallIndex::QueryBruteForceImpl(const query::QueryInfo& info,
const float* query_data,
Timestamp timestamp,
QueryResult& results) {
// step 1: binary search to find the barrier of the snapshot
auto ins_barrier = get_barrier(record_, timestamp);
auto del_barrier = get_barrier(deleted_record_, timestamp);
@ -283,7 +251,6 @@ SegmentSmallIndex::QueryBruteForceImpl(const query::QueryInfo& info, const float
auto total_count = topK * num_queries;
// TODO: optimize
// step 3: small indexing search
std::vector<int64_t> final_uids(total_count, -1);
std::vector<float> final_dis(total_count, std::numeric_limits<float>::max());
@ -333,12 +300,12 @@ SegmentSmallIndex::QueryBruteForceImpl(const query::QueryInfo& info, const float
}
Status
SegmentSmallIndex::QueryDeprecated(query::QueryPtr query_info, Timestamp timestamp, QueryResult& result) {
SegmentSmallIndex::QueryDeprecated(query::QueryDeprecatedPtr query_info, Timestamp timestamp, QueryResult& result) {
// TODO: enable delete
// TODO: enable index
// TODO: remove mock
if (query_info == nullptr) {
query_info = std::make_shared<query::Query>();
query_info = std::make_shared<query::QueryDeprecated>();
query_info->field_name = "fakevec";
query_info->topK = 10;
query_info->num_queries = 1;
@ -353,12 +320,14 @@ SegmentSmallIndex::QueryDeprecated(query::QueryPtr query_info, Timestamp timesta
}
int64_t inferred_dim = query_info->query_raw_data.size() / query_info->num_queries;
// TODO
query::QueryInfo info {
query::QueryInfo info{
query_info->num_queries,
inferred_dim,
query_info->topK,
query_info->field_name,
"L2"
"L2",
nlohmann::json{
{"nprobe", 10},
},
};
return QueryBruteForceImpl(info, query_info->query_raw_data.data(), timestamp, result);
}
@ -483,4 +452,15 @@ SegmentSmallIndex::GetMemoryUsageInBytes() {
return total_bytes;
}
Status
SegmentSmallIndex::Search(const query::Plan* Plan,
const query::PlaceholderGroup** placeholder_groups,
const Timestamp* timestamps,
int num_groups,
QueryResult& results) {
Assert(num_groups == 1);
query::ExecPlanNodeVisitor visitor(*this, timestamps[0], *placeholder_groups[0]);
PanicInfo("unimplemented");
}
} // namespace milvus::segcore

View File

@ -71,7 +71,14 @@ class SegmentSmallIndex : public SegmentBase {
// query contains metadata of
Status
QueryDeprecated(query::QueryPtr query_info, Timestamp timestamp, QueryResult& results) override;
QueryDeprecated(query::QueryDeprecatedPtr query_info, Timestamp timestamp, QueryResult& results) override;
Status
Search(const query::Plan* Plan,
const query::PlaceholderGroup* placeholder_groups[],
const Timestamp timestamps[],
int num_groups,
QueryResult& results) override;
// stop receive insert requests
// will move data to immutable vector or something

View File

@ -125,7 +125,7 @@ Search(CSegmentBase c_segment,
milvus::segcore::QueryResult query_result;
// construct QueryPtr
auto query_ptr = std::make_shared<milvus::query::Query>();
auto query_ptr = std::make_shared<milvus::query::QueryDeprecated>();
query_ptr->num_queries = c_query_info.num_queries;
query_ptr->topK = c_query_info.topK;

View File

@ -13,3 +13,8 @@ EasyAssertInfo(
#define AssertInfo(expr, info) milvus::impl::EasyAssertInfo(bool(expr), #expr, __FILE__, __LINE__, (info))
#define Assert(expr) AssertInfo((expr), "")
#define PanicInfo(info) \
do { \
milvus::impl::EasyAssertInfo(false, (info), __FILE__, __LINE__, ""); \
__builtin_unreachable(); \
} while (0)

View File

@ -429,7 +429,7 @@ TEST(CApiTest, GetRowCountTest) {
DeleteSegment(segment);
}
//TEST(CApiTest, SchemaTest) {
// TEST(CApiTest, SchemaTest) {
// std::string schema_string =
// "id: 6873737669791618215\nname: \"collection0\"\nschema: \u003c\n "
// "field_metas: \u003c\n field_name: \"age\"\n type: INT32\n dim: 1\n \u003e\n "

View File

@ -59,7 +59,6 @@ TEST(Query, ShowExecutor) {
auto& info = node->query_info_;
info.metric_type_ = "L2";
info.num_queries_ = 10;
info.dim_ = 16;
info.topK_ = 20;
info.field_id_ = "fakevec";
node->predicate_ = std::nullopt;

View File

@ -43,19 +43,15 @@ enum PlaceholderType {
}
message VectorValues {
repeated common.Blob value = 1;
}
/**
* @brief Placeholder value in DSL
*/
message PlaceholderValue {
string tag = 1;
PlaceholderType type = 2;
// value contains the serialized VectorValues
bytes value = 3;
// values is a 2d-array, every array contains a vector
repeated bytes values = 3;
}
message PlaceholderGroup {
@ -69,6 +65,7 @@ message Query {
string collection_name = 1;
repeated string partition_tags = 2;
string dsl = 3;
// placeholder_group contains the serialized PlaceholderGroup
bytes placeholder_group = 4;
}