mirror of https://github.com/milvus-io/milvus.git
Fix InsertTask and SearchTask
Signed-off-by: dragondriver <jiquan.long@zilliz.com>pull/4973/head^2
parent
c9fb34142c
commit
568cef0730
|
@ -29,4 +29,3 @@ add_subdirectory( pb )
|
|||
add_subdirectory( segcore )
|
||||
add_subdirectory( cache )
|
||||
add_subdirectory( query )
|
||||
add_subdirectory( common )
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
set(COMMON_SRC
|
||||
Schema.cpp
|
||||
)
|
||||
|
||||
add_library(milvus_common
|
||||
${COMMON_SRC}
|
||||
)
|
||||
target_link_libraries(milvus_common milvus_proto)
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||
|
||||
#include "common/Schema.h"
|
||||
#include <google/protobuf/text_format.h>
|
||||
|
||||
namespace milvus {
|
||||
std::shared_ptr<Schema>
|
||||
Schema::ParseFrom(const milvus::proto::schema::CollectionSchema& schema_proto) {
|
||||
auto schema = std::make_shared<Schema>();
|
||||
schema->set_auto_id(schema_proto.autoid());
|
||||
for (const milvus::proto::schema::FieldSchema& child : schema_proto.fields()) {
|
||||
const auto& type_params = child.type_params();
|
||||
int64_t dim = -1;
|
||||
auto data_type = DataType(child.data_type());
|
||||
for (const auto& type_param : type_params) {
|
||||
if (type_param.key() == "dim") {
|
||||
dim = strtoll(type_param.value().c_str(), nullptr, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (field_is_vector(data_type)) {
|
||||
AssertInfo(dim != -1, "dim not found");
|
||||
} else {
|
||||
AssertInfo(dim == 1 || dim == -1, "Invalid dim field. Should be 1 or not exists");
|
||||
dim = 1;
|
||||
}
|
||||
|
||||
if (child.is_primary_key()) {
|
||||
AssertInfo(!schema->primary_key_offset_opt_.has_value(), "repetitive primary key");
|
||||
schema->primary_key_offset_opt_ = schema->size();
|
||||
}
|
||||
|
||||
schema->AddField(child.name(), data_type, dim);
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
} // namespace milvus
|
|
@ -16,8 +16,6 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
#include <pb/schema.pb.h>
|
||||
#include <optional>
|
||||
|
||||
namespace milvus {
|
||||
|
||||
|
@ -39,11 +37,6 @@ class Schema {
|
|||
total_sizeof_ += field_sizeof;
|
||||
}
|
||||
|
||||
void
|
||||
set_auto_id(bool is_auto_id) {
|
||||
is_auto_id_ = is_auto_id;
|
||||
}
|
||||
|
||||
auto
|
||||
begin() {
|
||||
return fields_.begin();
|
||||
|
@ -53,13 +46,6 @@ class Schema {
|
|||
end() {
|
||||
return fields_.end();
|
||||
}
|
||||
|
||||
public:
|
||||
bool
|
||||
get_is_auto_id() const {
|
||||
return is_auto_id_;
|
||||
}
|
||||
|
||||
auto
|
||||
begin() const {
|
||||
return fields_.begin();
|
||||
|
@ -114,15 +100,6 @@ class Schema {
|
|||
return (*this)[offset];
|
||||
}
|
||||
|
||||
std::optional<int>
|
||||
get_primary_key_offset() const {
|
||||
return primary_key_offset_opt_;
|
||||
}
|
||||
|
||||
public:
|
||||
static std::shared_ptr<Schema>
|
||||
ParseFrom(const milvus::proto::schema::CollectionSchema& schema_proto);
|
||||
|
||||
private:
|
||||
// this is where data holds
|
||||
std::vector<FieldMeta> fields_;
|
||||
|
@ -132,8 +109,6 @@ class Schema {
|
|||
std::unordered_map<std::string, int> offsets_;
|
||||
std::vector<int> sizeof_infos_;
|
||||
int total_sizeof_ = 0;
|
||||
bool is_auto_id_ = true;
|
||||
std::optional<int> primary_key_offset_opt_;
|
||||
};
|
||||
|
||||
using SchemaPtr = std::shared_ptr<Schema>;
|
||||
|
|
|
@ -72,7 +72,6 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_schema_2eproto::offsets[] PROT
|
|||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
PROTOBUF_FIELD_OFFSET(::milvus::proto::schema::FieldSchema, name_),
|
||||
PROTOBUF_FIELD_OFFSET(::milvus::proto::schema::FieldSchema, is_primary_key_),
|
||||
PROTOBUF_FIELD_OFFSET(::milvus::proto::schema::FieldSchema, description_),
|
||||
PROTOBUF_FIELD_OFFSET(::milvus::proto::schema::FieldSchema, data_type_),
|
||||
PROTOBUF_FIELD_OFFSET(::milvus::proto::schema::FieldSchema, type_params_),
|
||||
|
@ -89,7 +88,7 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_schema_2eproto::offsets[] PROT
|
|||
};
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, sizeof(::milvus::proto::schema::FieldSchema)},
|
||||
{ 11, -1, sizeof(::milvus::proto::schema::CollectionSchema)},
|
||||
{ 10, -1, sizeof(::milvus::proto::schema::CollectionSchema)},
|
||||
};
|
||||
|
||||
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
|
||||
|
@ -99,21 +98,21 @@ static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] =
|
|||
|
||||
const char descriptor_table_protodef_schema_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\014schema.proto\022\023milvus.proto.schema\032\014com"
|
||||
"mon.proto\"\353\001\n\013FieldSchema\022\014\n\004name\030\001 \001(\t\022"
|
||||
"\026\n\016is_primary_key\030\002 \001(\010\022\023\n\013description\030\003"
|
||||
" \001(\t\0220\n\tdata_type\030\004 \001(\0162\035.milvus.proto.s"
|
||||
"chema.DataType\0226\n\013type_params\030\005 \003(\0132!.mi"
|
||||
"lvus.proto.common.KeyValuePair\0227\n\014index_"
|
||||
"params\030\006 \003(\0132!.milvus.proto.common.KeyVa"
|
||||
"luePair\"w\n\020CollectionSchema\022\014\n\004name\030\001 \001("
|
||||
"\t\022\023\n\013description\030\002 \001(\t\022\016\n\006autoID\030\003 \001(\010\0220"
|
||||
"\n\006fields\030\004 \003(\0132 .milvus.proto.schema.Fie"
|
||||
"ldSchema*\221\001\n\010DataType\022\010\n\004NONE\020\000\022\010\n\004BOOL\020"
|
||||
"\001\022\010\n\004INT8\020\002\022\t\n\005INT16\020\003\022\t\n\005INT32\020\004\022\t\n\005INT"
|
||||
"64\020\005\022\t\n\005FLOAT\020\n\022\n\n\006DOUBLE\020\013\022\n\n\006STRING\020\024\022"
|
||||
"\021\n\rVECTOR_BINARY\020d\022\020\n\014VECTOR_FLOAT\020eBBZ@"
|
||||
"github.com/zilliztech/milvus-distributed"
|
||||
"/internal/proto/schemapbb\006proto3"
|
||||
"mon.proto\"\323\001\n\013FieldSchema\022\014\n\004name\030\001 \001(\t\022"
|
||||
"\023\n\013description\030\002 \001(\t\0220\n\tdata_type\030\003 \001(\0162"
|
||||
"\035.milvus.proto.schema.DataType\0226\n\013type_p"
|
||||
"arams\030\004 \003(\0132!.milvus.proto.common.KeyVal"
|
||||
"uePair\0227\n\014index_params\030\005 \003(\0132!.milvus.pr"
|
||||
"oto.common.KeyValuePair\"w\n\020CollectionSch"
|
||||
"ema\022\014\n\004name\030\001 \001(\t\022\023\n\013description\030\002 \001(\t\022\016"
|
||||
"\n\006autoID\030\003 \001(\010\0220\n\006fields\030\004 \003(\0132 .milvus."
|
||||
"proto.schema.FieldSchema*\221\001\n\010DataType\022\010\n"
|
||||
"\004NONE\020\000\022\010\n\004BOOL\020\001\022\010\n\004INT8\020\002\022\t\n\005INT16\020\003\022\t"
|
||||
"\n\005INT32\020\004\022\t\n\005INT64\020\005\022\t\n\005FLOAT\020\n\022\n\n\006DOUBL"
|
||||
"E\020\013\022\n\n\006STRING\020\024\022\021\n\rVECTOR_BINARY\020d\022\020\n\014VE"
|
||||
"CTOR_FLOAT\020eBBZ@github.com/zilliztech/mi"
|
||||
"lvus-distributed/internal/proto/schemapb"
|
||||
"b\006proto3"
|
||||
;
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_schema_2eproto_deps[1] = {
|
||||
&::descriptor_table_common_2eproto,
|
||||
|
@ -125,7 +124,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_sch
|
|||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_schema_2eproto_once;
|
||||
static bool descriptor_table_schema_2eproto_initialized = false;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_schema_2eproto = {
|
||||
&descriptor_table_schema_2eproto_initialized, descriptor_table_protodef_schema_2eproto, "schema.proto", 632,
|
||||
&descriptor_table_schema_2eproto_initialized, descriptor_table_protodef_schema_2eproto, "schema.proto", 608,
|
||||
&descriptor_table_schema_2eproto_once, descriptor_table_schema_2eproto_sccs, descriptor_table_schema_2eproto_deps, 2, 1,
|
||||
schemas, file_default_instances, TableStruct_schema_2eproto::offsets,
|
||||
file_level_metadata_schema_2eproto, 2, file_level_enum_descriptors_schema_2eproto, file_level_service_descriptors_schema_2eproto,
|
||||
|
@ -193,9 +192,7 @@ FieldSchema::FieldSchema(const FieldSchema& from)
|
|||
if (!from.description().empty()) {
|
||||
description_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.description_);
|
||||
}
|
||||
::memcpy(&is_primary_key_, &from.is_primary_key_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&data_type_) -
|
||||
reinterpret_cast<char*>(&is_primary_key_)) + sizeof(data_type_));
|
||||
data_type_ = from.data_type_;
|
||||
// @@protoc_insertion_point(copy_constructor:milvus.proto.schema.FieldSchema)
|
||||
}
|
||||
|
||||
|
@ -203,9 +200,7 @@ void FieldSchema::SharedCtor() {
|
|||
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_FieldSchema_schema_2eproto.base);
|
||||
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
description_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
::memset(&is_primary_key_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&data_type_) -
|
||||
reinterpret_cast<char*>(&is_primary_key_)) + sizeof(data_type_));
|
||||
data_type_ = 0;
|
||||
}
|
||||
|
||||
FieldSchema::~FieldSchema() {
|
||||
|
@ -237,9 +232,7 @@ void FieldSchema::Clear() {
|
|||
index_params_.Clear();
|
||||
name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
description_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
::memset(&is_primary_key_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&data_type_) -
|
||||
reinterpret_cast<char*>(&is_primary_key_)) + sizeof(data_type_));
|
||||
data_type_ = 0;
|
||||
_internal_metadata_.Clear();
|
||||
}
|
||||
|
||||
|
@ -258,50 +251,43 @@ const char* FieldSchema::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
|
|||
CHK_(ptr);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// bool is_primary_key = 2;
|
||||
// string description = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
|
||||
is_primary_key_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
|
||||
CHK_(ptr);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// string description = 3;
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_description(), ptr, ctx, "milvus.proto.schema.FieldSchema.description");
|
||||
CHK_(ptr);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// .milvus.proto.schema.DataType data_type = 4;
|
||||
case 4:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
|
||||
// .milvus.proto.schema.DataType data_type = 3;
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
|
||||
CHK_(ptr);
|
||||
set_data_type(static_cast<::milvus::proto::schema::DataType>(val));
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 5;
|
||||
case 5:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 4;
|
||||
case 4:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
ptr = ctx->ParseMessage(add_type_params(), ptr);
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 42);
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 34);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 6;
|
||||
case 6:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 5;
|
||||
case 5:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
ptr = ctx->ParseMessage(add_index_params(), ptr);
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 50);
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 42);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
default: {
|
||||
|
@ -349,22 +335,9 @@ bool FieldSchema::MergePartialFromCodedStream(
|
|||
break;
|
||||
}
|
||||
|
||||
// bool is_primary_key = 2;
|
||||
// string description = 2;
|
||||
case 2: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) {
|
||||
|
||||
DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
|
||||
bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>(
|
||||
input, &is_primary_key_)));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// string description = 3;
|
||||
case 3: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
|
||||
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
|
||||
input, this->mutable_description()));
|
||||
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
|
@ -377,9 +350,9 @@ bool FieldSchema::MergePartialFromCodedStream(
|
|||
break;
|
||||
}
|
||||
|
||||
// .milvus.proto.schema.DataType data_type = 4;
|
||||
case 4: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (32 & 0xFF)) {
|
||||
// .milvus.proto.schema.DataType data_type = 3;
|
||||
case 3: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) {
|
||||
int value = 0;
|
||||
DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
|
||||
int, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_ENUM>(
|
||||
|
@ -391,9 +364,9 @@ bool FieldSchema::MergePartialFromCodedStream(
|
|||
break;
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 5;
|
||||
case 5: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) {
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 4;
|
||||
case 4: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
|
||||
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
|
||||
input, add_type_params()));
|
||||
} else {
|
||||
|
@ -402,9 +375,9 @@ bool FieldSchema::MergePartialFromCodedStream(
|
|||
break;
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 6;
|
||||
case 6: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) {
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 5;
|
||||
case 5: {
|
||||
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) {
|
||||
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
|
||||
input, add_index_params()));
|
||||
} else {
|
||||
|
@ -450,41 +423,36 @@ void FieldSchema::SerializeWithCachedSizes(
|
|||
1, this->name(), output);
|
||||
}
|
||||
|
||||
// bool is_primary_key = 2;
|
||||
if (this->is_primary_key() != 0) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBool(2, this->is_primary_key(), output);
|
||||
}
|
||||
|
||||
// string description = 3;
|
||||
// string description = 2;
|
||||
if (this->description().size() > 0) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->description().data(), static_cast<int>(this->description().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"milvus.proto.schema.FieldSchema.description");
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased(
|
||||
3, this->description(), output);
|
||||
2, this->description(), output);
|
||||
}
|
||||
|
||||
// .milvus.proto.schema.DataType data_type = 4;
|
||||
// .milvus.proto.schema.DataType data_type = 3;
|
||||
if (this->data_type() != 0) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnum(
|
||||
4, this->data_type(), output);
|
||||
3, this->data_type(), output);
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 5;
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 4;
|
||||
for (unsigned int i = 0,
|
||||
n = static_cast<unsigned int>(this->type_params_size()); i < n; i++) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
|
||||
5,
|
||||
4,
|
||||
this->type_params(static_cast<int>(i)),
|
||||
output);
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 6;
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 5;
|
||||
for (unsigned int i = 0,
|
||||
n = static_cast<unsigned int>(this->index_params_size()); i < n; i++) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
|
||||
6,
|
||||
5,
|
||||
this->index_params(static_cast<int>(i)),
|
||||
output);
|
||||
}
|
||||
|
@ -513,12 +481,7 @@ void FieldSchema::SerializeWithCachedSizes(
|
|||
1, this->name(), target);
|
||||
}
|
||||
|
||||
// bool is_primary_key = 2;
|
||||
if (this->is_primary_key() != 0) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->is_primary_key(), target);
|
||||
}
|
||||
|
||||
// string description = 3;
|
||||
// string description = 2;
|
||||
if (this->description().size() > 0) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->description().data(), static_cast<int>(this->description().length()),
|
||||
|
@ -526,29 +489,29 @@ void FieldSchema::SerializeWithCachedSizes(
|
|||
"milvus.proto.schema.FieldSchema.description");
|
||||
target =
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray(
|
||||
3, this->description(), target);
|
||||
2, this->description(), target);
|
||||
}
|
||||
|
||||
// .milvus.proto.schema.DataType data_type = 4;
|
||||
// .milvus.proto.schema.DataType data_type = 3;
|
||||
if (this->data_type() != 0) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
|
||||
4, this->data_type(), target);
|
||||
3, this->data_type(), target);
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 5;
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 4;
|
||||
for (unsigned int i = 0,
|
||||
n = static_cast<unsigned int>(this->type_params_size()); i < n; i++) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessageToArray(
|
||||
5, this->type_params(static_cast<int>(i)), target);
|
||||
4, this->type_params(static_cast<int>(i)), target);
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 6;
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 5;
|
||||
for (unsigned int i = 0,
|
||||
n = static_cast<unsigned int>(this->index_params_size()); i < n; i++) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessageToArray(
|
||||
6, this->index_params(static_cast<int>(i)), target);
|
||||
5, this->index_params(static_cast<int>(i)), target);
|
||||
}
|
||||
|
||||
if (_internal_metadata_.have_unknown_fields()) {
|
||||
|
@ -572,7 +535,7 @@ size_t FieldSchema::ByteSizeLong() const {
|
|||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 5;
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 4;
|
||||
{
|
||||
unsigned int count = static_cast<unsigned int>(this->type_params_size());
|
||||
total_size += 1UL * count;
|
||||
|
@ -583,7 +546,7 @@ size_t FieldSchema::ByteSizeLong() const {
|
|||
}
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 6;
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 5;
|
||||
{
|
||||
unsigned int count = static_cast<unsigned int>(this->index_params_size());
|
||||
total_size += 1UL * count;
|
||||
|
@ -601,19 +564,14 @@ size_t FieldSchema::ByteSizeLong() const {
|
|||
this->name());
|
||||
}
|
||||
|
||||
// string description = 3;
|
||||
// string description = 2;
|
||||
if (this->description().size() > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->description());
|
||||
}
|
||||
|
||||
// bool is_primary_key = 2;
|
||||
if (this->is_primary_key() != 0) {
|
||||
total_size += 1 + 1;
|
||||
}
|
||||
|
||||
// .milvus.proto.schema.DataType data_type = 4;
|
||||
// .milvus.proto.schema.DataType data_type = 3;
|
||||
if (this->data_type() != 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->data_type());
|
||||
|
@ -656,9 +614,6 @@ void FieldSchema::MergeFrom(const FieldSchema& from) {
|
|||
|
||||
description_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.description_);
|
||||
}
|
||||
if (from.is_primary_key() != 0) {
|
||||
set_is_primary_key(from.is_primary_key());
|
||||
}
|
||||
if (from.data_type() != 0) {
|
||||
set_data_type(from.data_type());
|
||||
}
|
||||
|
@ -691,7 +646,6 @@ void FieldSchema::InternalSwap(FieldSchema* other) {
|
|||
GetArenaNoVirtual());
|
||||
description_.Swap(&other->description_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArenaNoVirtual());
|
||||
swap(is_primary_key_, other->is_primary_key_);
|
||||
swap(data_type_, other->data_type_);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,14 +225,13 @@ class FieldSchema :
|
|||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kTypeParamsFieldNumber = 5,
|
||||
kIndexParamsFieldNumber = 6,
|
||||
kTypeParamsFieldNumber = 4,
|
||||
kIndexParamsFieldNumber = 5,
|
||||
kNameFieldNumber = 1,
|
||||
kDescriptionFieldNumber = 3,
|
||||
kIsPrimaryKeyFieldNumber = 2,
|
||||
kDataTypeFieldNumber = 4,
|
||||
kDescriptionFieldNumber = 2,
|
||||
kDataTypeFieldNumber = 3,
|
||||
};
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 5;
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 4;
|
||||
int type_params_size() const;
|
||||
void clear_type_params();
|
||||
::milvus::proto::common::KeyValuePair* mutable_type_params(int index);
|
||||
|
@ -243,7 +242,7 @@ class FieldSchema :
|
|||
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >&
|
||||
type_params() const;
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 6;
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 5;
|
||||
int index_params_size() const;
|
||||
void clear_index_params();
|
||||
::milvus::proto::common::KeyValuePair* mutable_index_params(int index);
|
||||
|
@ -265,7 +264,7 @@ class FieldSchema :
|
|||
std::string* release_name();
|
||||
void set_allocated_name(std::string* name);
|
||||
|
||||
// string description = 3;
|
||||
// string description = 2;
|
||||
void clear_description();
|
||||
const std::string& description() const;
|
||||
void set_description(const std::string& value);
|
||||
|
@ -276,12 +275,7 @@ class FieldSchema :
|
|||
std::string* release_description();
|
||||
void set_allocated_description(std::string* description);
|
||||
|
||||
// bool is_primary_key = 2;
|
||||
void clear_is_primary_key();
|
||||
bool is_primary_key() const;
|
||||
void set_is_primary_key(bool value);
|
||||
|
||||
// .milvus.proto.schema.DataType data_type = 4;
|
||||
// .milvus.proto.schema.DataType data_type = 3;
|
||||
void clear_data_type();
|
||||
::milvus::proto::schema::DataType data_type() const;
|
||||
void set_data_type(::milvus::proto::schema::DataType value);
|
||||
|
@ -295,7 +289,6 @@ class FieldSchema :
|
|||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair > index_params_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr description_;
|
||||
bool is_primary_key_;
|
||||
int data_type_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_schema_2eproto;
|
||||
|
@ -532,21 +525,7 @@ inline void FieldSchema::set_allocated_name(std::string* name) {
|
|||
// @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.FieldSchema.name)
|
||||
}
|
||||
|
||||
// bool is_primary_key = 2;
|
||||
inline void FieldSchema::clear_is_primary_key() {
|
||||
is_primary_key_ = false;
|
||||
}
|
||||
inline bool FieldSchema::is_primary_key() const {
|
||||
// @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.is_primary_key)
|
||||
return is_primary_key_;
|
||||
}
|
||||
inline void FieldSchema::set_is_primary_key(bool value) {
|
||||
|
||||
is_primary_key_ = value;
|
||||
// @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.is_primary_key)
|
||||
}
|
||||
|
||||
// string description = 3;
|
||||
// string description = 2;
|
||||
inline void FieldSchema::clear_description() {
|
||||
description_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
|
@ -597,7 +576,7 @@ inline void FieldSchema::set_allocated_description(std::string* description) {
|
|||
// @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.FieldSchema.description)
|
||||
}
|
||||
|
||||
// .milvus.proto.schema.DataType data_type = 4;
|
||||
// .milvus.proto.schema.DataType data_type = 3;
|
||||
inline void FieldSchema::clear_data_type() {
|
||||
data_type_ = 0;
|
||||
}
|
||||
|
@ -611,7 +590,7 @@ inline void FieldSchema::set_data_type(::milvus::proto::schema::DataType value)
|
|||
// @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.data_type)
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 5;
|
||||
// repeated .milvus.proto.common.KeyValuePair type_params = 4;
|
||||
inline int FieldSchema::type_params_size() const {
|
||||
return type_params_.size();
|
||||
}
|
||||
|
@ -638,7 +617,7 @@ FieldSchema::type_params() const {
|
|||
return type_params_;
|
||||
}
|
||||
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 6;
|
||||
// repeated .milvus.proto.common.KeyValuePair index_params = 5;
|
||||
inline int FieldSchema::index_params_size() const {
|
||||
return index_params_.size();
|
||||
}
|
||||
|
|
|
@ -133,12 +133,6 @@ CreatePlanImplNaive(const Schema& schema, const std::string& dsl_str) {
|
|||
PanicInfo("Unsupported DSL");
|
||||
}
|
||||
plan->plan_node_->predicate_ = std::move(predicate);
|
||||
// TODO: target_entry parser
|
||||
// if schema autoid is true,
|
||||
// prepend target_entries_ with row_id
|
||||
// else
|
||||
// with primary_key
|
||||
//
|
||||
return plan;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ struct Plan {
|
|||
const Schema& schema_;
|
||||
std::unique_ptr<VectorPlanNode> plan_node_;
|
||||
std::map<std::string, FieldId> tag2field_; // PlaceholderName -> FieldId
|
||||
std::vector<std::string> target_entries_;
|
||||
// TODO: add move extra info
|
||||
};
|
||||
|
||||
|
|
|
@ -116,21 +116,18 @@ QueryBruteForceImpl(const segcore::SegmentSmallIndex& segment,
|
|||
segcore::merge_into(num_queries, topK, final_dis.data(), final_uids.data(), buf_dis.data(), buf_uids.data());
|
||||
}
|
||||
|
||||
results.result_distances_ = std::move(final_dis);
|
||||
results.internal_seg_offsets_ = std::move(final_uids);
|
||||
results.topK_ = topK;
|
||||
results.num_queries_ = num_queries;
|
||||
|
||||
// TODO: deprecated code begin
|
||||
final_uids = results.internal_seg_offsets_;
|
||||
// step 5: convert offset to uids
|
||||
for (auto& id : final_uids) {
|
||||
if (id == -1) {
|
||||
continue;
|
||||
}
|
||||
id = record.uids_[id];
|
||||
}
|
||||
|
||||
results.result_ids_ = std::move(final_uids);
|
||||
// TODO: deprecated code end
|
||||
results.result_distances_ = std::move(final_dis);
|
||||
results.topK_ = topK;
|
||||
results.num_queries_ = num_queries;
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ add_library(milvus_segcore SHARED
|
|||
target_link_libraries(milvus_segcore
|
||||
tbb utils pthread knowhere log milvus_proto
|
||||
dl backtrace
|
||||
milvus_common
|
||||
milvus_query
|
||||
)
|
||||
|
||||
|
|
|
@ -139,7 +139,27 @@ Collection::parse() {
|
|||
}
|
||||
|
||||
collection_name_ = collection_meta.schema().name();
|
||||
schema_ = Schema::ParseFrom(collection_meta.schema());
|
||||
// TODO: delete print
|
||||
std::cout << "create collection " << collection_meta.schema().name() << std::endl;
|
||||
|
||||
auto schema = std::make_shared<Schema>();
|
||||
for (const milvus::proto::schema::FieldSchema& child : collection_meta.schema().fields()) {
|
||||
const auto& type_params = child.type_params();
|
||||
int64_t dim = 16;
|
||||
for (const auto& type_param : type_params) {
|
||||
if (type_param.key() == "dim") {
|
||||
dim = strtoll(type_param.value().c_str(), nullptr, 10);
|
||||
}
|
||||
}
|
||||
std::cout << "add Field, name :" << child.name() << ", datatype :" << child.data_type() << ", dim :" << dim
|
||||
<< std::endl;
|
||||
schema->AddField(std::string_view(child.name()), DataType(child.data_type()), dim);
|
||||
}
|
||||
/*
|
||||
schema->AddField("fakevec", DataType::VECTOR_FLOAT, 16);
|
||||
schema->AddField("age", DataType::INT32);
|
||||
*/
|
||||
schema_ = schema;
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -72,9 +72,6 @@ class SegmentBase {
|
|||
int num_groups,
|
||||
QueryResult& results) = 0;
|
||||
|
||||
virtual Status
|
||||
FillTargetEntry(const query::Plan* Plan, QueryResult& results) = 0;
|
||||
|
||||
// stop receive insert requests
|
||||
virtual Status
|
||||
Close() = 0;
|
||||
|
|
|
@ -84,11 +84,6 @@ class SegmentNaive : public SegmentBase {
|
|||
Status
|
||||
BuildIndex(IndexMetaPtr index_meta) override;
|
||||
|
||||
Status
|
||||
FillTargetEntry(const query::Plan* Plan, QueryResult& results) override {
|
||||
PanicInfo("unimplemented");
|
||||
}
|
||||
|
||||
Status
|
||||
DropRawData(std::string_view field_name) override {
|
||||
// TODO: NO-OP
|
||||
|
|
|
@ -344,39 +344,5 @@ SegmentSmallIndex::Search(const query::Plan* plan,
|
|||
results = visitor.get_moved_result(*plan->plan_node_);
|
||||
return Status::OK();
|
||||
}
|
||||
Status
|
||||
SegmentSmallIndex::FillTargetEntry(const query::Plan* plan, QueryResult& results) {
|
||||
AssertInfo(plan, "empty plan");
|
||||
auto size = results.result_distances_.size();
|
||||
Assert(results.internal_seg_offsets_.size() == size);
|
||||
Assert(results.result_offsets_.size() == size);
|
||||
Assert(results.row_data_.size() == 0);
|
||||
|
||||
if (plan->schema_.get_is_auto_id()) {
|
||||
auto& uids = record_.uids_;
|
||||
for (int64_t i = 0; i < size; ++i) {
|
||||
auto seg_offset = results.internal_seg_offsets_[i];
|
||||
auto row_id = uids[seg_offset];
|
||||
std::vector<char> blob(sizeof(row_id));
|
||||
memcpy(blob.data(), &row_id, sizeof(row_id));
|
||||
results.row_data_.emplace_back(std::move(blob));
|
||||
}
|
||||
} else {
|
||||
auto key_offset_opt = schema_->get_primary_key_offset();
|
||||
Assert(key_offset_opt.has_value());
|
||||
auto key_offset = key_offset_opt.value();
|
||||
auto field_meta = schema_->operator[](key_offset);
|
||||
Assert(field_meta.get_data_type() == DataType::INT64);
|
||||
auto uids = record_.get_scalar_entity<int64_t>(key_offset);
|
||||
for (int64_t i = 0; i < size; ++i) {
|
||||
auto seg_offset = results.internal_seg_offsets_[i];
|
||||
auto row_id = uids->operator[](seg_offset);
|
||||
std::vector<char> blob(sizeof(row_id));
|
||||
memcpy(blob.data(), &row_id, sizeof(row_id));
|
||||
results.row_data_.emplace_back(std::move(blob));
|
||||
}
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -33,6 +33,29 @@
|
|||
#include <memory>
|
||||
|
||||
namespace milvus::segcore {
|
||||
// struct ColumnBasedDataChunk {
|
||||
// std::vector<std::vector<float>> entity_vecs;
|
||||
//
|
||||
// static ColumnBasedDataChunk
|
||||
// from(const RowBasedRawData& source, const Schema& schema) {
|
||||
// ColumnBasedDataChunk dest;
|
||||
// auto count = source.count;
|
||||
// auto raw_data = reinterpret_cast<const char*>(source.raw_data);
|
||||
// auto align = source.sizeof_per_row;
|
||||
// for (auto& field : schema) {
|
||||
// auto len = field.get_sizeof();
|
||||
// Assert(len % sizeof(float) == 0);
|
||||
// std::vector<float> new_col(len * count / sizeof(float));
|
||||
// for (int64_t i = 0; i < count; ++i) {
|
||||
// memcpy(new_col.data() + i * len / sizeof(float), raw_data + i * align, len);
|
||||
// }
|
||||
// dest.entity_vecs.push_back(std::move(new_col));
|
||||
// // offset the raw_data
|
||||
// raw_data += len / sizeof(float);
|
||||
// }
|
||||
// return dest;
|
||||
// }
|
||||
//};
|
||||
|
||||
class SegmentSmallIndex : public SegmentBase {
|
||||
public:
|
||||
|
@ -141,13 +164,20 @@ class SegmentSmallIndex : public SegmentBase {
|
|||
std::shared_ptr<DeletedRecord::TmpBitmap>
|
||||
get_deleted_bitmap(int64_t del_barrier, Timestamp query_timestamp, int64_t insert_barrier, bool force = false);
|
||||
|
||||
// Status
|
||||
// QueryBruteForceImpl(query::QueryPtr query, Timestamp timestamp, QueryResult& results);
|
||||
|
||||
// Status
|
||||
// QueryBruteForceImpl(const query::QueryInfo& info,
|
||||
// const float* query_data,
|
||||
// int64_t num_queries,
|
||||
// Timestamp timestamp,
|
||||
// QueryResult& results);
|
||||
|
||||
template <typename Type>
|
||||
knowhere::IndexPtr
|
||||
BuildVecIndexImpl(const IndexMeta::Entry& entry);
|
||||
|
||||
Status
|
||||
FillTargetEntry(const query::Plan* Plan, QueryResult& results) override;
|
||||
|
||||
private:
|
||||
SchemaPtr schema_;
|
||||
std::atomic<SegmentState> state_ = SegmentState::Open;
|
||||
|
|
|
@ -141,11 +141,8 @@ struct QueryResult {
|
|||
QueryResult() = default;
|
||||
QueryResult(uint64_t num_queries, uint64_t topK) : topK_(topK), num_queries_(num_queries) {
|
||||
auto count = get_row_count();
|
||||
result_distances_.resize(count);
|
||||
internal_seg_offsets_.resize(count);
|
||||
|
||||
// TODO: deprecated
|
||||
result_ids_.resize(count);
|
||||
result_distances_.resize(count);
|
||||
}
|
||||
|
||||
[[nodiscard]] uint64_t
|
||||
|
@ -156,24 +153,10 @@ struct QueryResult {
|
|||
uint64_t num_queries_;
|
||||
uint64_t topK_;
|
||||
// uint64_t total_row_count_; // total_row_count_ = topK * num_queries_
|
||||
|
||||
// vector<tuple<Score, SegId, Offset>> data_reduced;
|
||||
|
||||
// vector<tuple<Score, SegId, Offset, RawData>>
|
||||
|
||||
// map<SegId, vector<tuple<DataOffset, ResLoc>>>
|
||||
uint64_t seg_id_;
|
||||
std::vector<float> result_distances_;
|
||||
|
||||
// TODO(gexi): utilize these field
|
||||
std::vector<int64_t> internal_seg_offsets_;
|
||||
std::vector<int64_t> result_offsets_;
|
||||
std::vector<std::vector<char>> row_data_;
|
||||
|
||||
// TODO: deprecated, use row_data directly
|
||||
std::vector<idx_t> result_ids_;
|
||||
engine::ResultIds result_ids_; // top1, top2, ..;
|
||||
engine::ResultDistances result_distances_;
|
||||
// engine::DataChunkPtr data_chunk_;
|
||||
};
|
||||
|
||||
using QueryResultPtr = std::shared_ptr<QueryResult>;
|
||||
|
||||
} // namespace engine
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "query/generated/ExecPlanNodeVisitor.h"
|
||||
#include "query/PlanImpl.h"
|
||||
#include "segcore/SegmentSmallIndex.h"
|
||||
#include "pb/schema.pb.h"
|
||||
|
||||
using namespace milvus;
|
||||
using namespace milvus::query;
|
||||
|
@ -323,81 +322,3 @@ TEST(Query, ExecWihtoutPredicate) {
|
|||
Json json{results};
|
||||
std::cout << json.dump(2);
|
||||
}
|
||||
|
||||
TEST(Query, FillSegment) {
|
||||
namespace pb = milvus::proto;
|
||||
pb::schema::CollectionSchema proto;
|
||||
proto.set_name("col");
|
||||
proto.set_description("asdfhsalkgfhsadg");
|
||||
proto.set_autoid(true);
|
||||
|
||||
{
|
||||
auto field = proto.add_fields();
|
||||
field->set_name("fakevec");
|
||||
field->set_is_primary_key(false);
|
||||
field->set_description("asdgfsagf");
|
||||
field->set_data_type(pb::schema::DataType::VECTOR_FLOAT);
|
||||
auto param = field->add_type_params();
|
||||
param->set_key("dim");
|
||||
param->set_value("16");
|
||||
}
|
||||
|
||||
{
|
||||
auto field = proto.add_fields();
|
||||
field->set_name("the_key");
|
||||
field->set_is_primary_key(true);
|
||||
field->set_description("asdgfsagf");
|
||||
field->set_data_type(pb::schema::DataType::INT32);
|
||||
}
|
||||
|
||||
auto schema = Schema::ParseFrom(proto);
|
||||
auto segment = CreateSegment(schema);
|
||||
int N = 100000;
|
||||
auto dataset = DataGen(schema, N);
|
||||
segment->PreInsert(N);
|
||||
segment->Insert(0, N, dataset.row_ids_.data(), dataset.timestamps_.data(), dataset.raw_);
|
||||
std::string dsl = R"({
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"vector": {
|
||||
"fakevec": {
|
||||
"metric_type": "L2",
|
||||
"params": {
|
||||
"nprobe": 10
|
||||
},
|
||||
"query": "$0",
|
||||
"topk": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
})";
|
||||
auto plan = CreatePlan(*schema, dsl);
|
||||
auto ph_proto = CreatePlaceholderGroup(10, 16, 443);
|
||||
auto ph = ParsePlaceholderGroup(plan.get(), ph_proto.SerializeAsString());
|
||||
std::vector<const PlaceholderGroup*> groups = {ph.get()};
|
||||
std::vector<Timestamp> timestamps = {N * 2UL};
|
||||
QueryResult result;
|
||||
segment->Search(plan.get(), groups.data(), timestamps.data(), 1, result);
|
||||
|
||||
// TODO: deprecated result_ids_
|
||||
ASSERT_EQ(result.result_ids_, result.internal_seg_offsets_);
|
||||
auto topk = 5;
|
||||
auto num_queries = 10;
|
||||
|
||||
result.result_offsets_.resize(topk * num_queries);
|
||||
segment->FillTargetEntry(plan.get(), result);
|
||||
auto ans = result.row_data_;
|
||||
ASSERT_EQ(ans.size(), topk * num_queries);
|
||||
int64_t std_index = 0;
|
||||
for (auto& vec : ans) {
|
||||
ASSERT_EQ(vec.size(), sizeof(int64_t));
|
||||
int64_t val;
|
||||
memcpy(&val, vec.data(), sizeof(int64_t));
|
||||
auto std_val = result.result_ids_[std_index];
|
||||
ASSERT_EQ(val, std_val);
|
||||
++std_index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,10 @@ enum DataType {
|
|||
*/
|
||||
message FieldSchema {
|
||||
string name = 1;
|
||||
bool is_primary_key = 2;
|
||||
string description = 3;
|
||||
DataType data_type = 4;
|
||||
repeated common.KeyValuePair type_params = 5;
|
||||
repeated common.KeyValuePair index_params = 6;
|
||||
string description = 2;
|
||||
DataType data_type = 3;
|
||||
repeated common.KeyValuePair type_params = 4;
|
||||
repeated common.KeyValuePair index_params = 5;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,11 +79,10 @@ func (DataType) EnumDescriptor() ([]byte, []int) {
|
|||
// @brief Field schema
|
||||
type FieldSchema struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
IsPrimaryKey bool `protobuf:"varint,2,opt,name=is_primary_key,json=isPrimaryKey,proto3" json:"is_primary_key,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
DataType DataType `protobuf:"varint,4,opt,name=data_type,json=dataType,proto3,enum=milvus.proto.schema.DataType" json:"data_type,omitempty"`
|
||||
TypeParams []*commonpb.KeyValuePair `protobuf:"bytes,5,rep,name=type_params,json=typeParams,proto3" json:"type_params,omitempty"`
|
||||
IndexParams []*commonpb.KeyValuePair `protobuf:"bytes,6,rep,name=index_params,json=indexParams,proto3" json:"index_params,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
DataType DataType `protobuf:"varint,3,opt,name=data_type,json=dataType,proto3,enum=milvus.proto.schema.DataType" json:"data_type,omitempty"`
|
||||
TypeParams []*commonpb.KeyValuePair `protobuf:"bytes,4,rep,name=type_params,json=typeParams,proto3" json:"type_params,omitempty"`
|
||||
IndexParams []*commonpb.KeyValuePair `protobuf:"bytes,5,rep,name=index_params,json=indexParams,proto3" json:"index_params,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
@ -121,13 +120,6 @@ func (m *FieldSchema) GetName() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *FieldSchema) GetIsPrimaryKey() bool {
|
||||
if m != nil {
|
||||
return m.IsPrimaryKey
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *FieldSchema) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
|
@ -230,34 +222,31 @@ func init() {
|
|||
func init() { proto.RegisterFile("schema.proto", fileDescriptor_1c5fb4d8cc22d66a) }
|
||||
|
||||
var fileDescriptor_1c5fb4d8cc22d66a = []byte{
|
||||
// 451 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xdf, 0x6a, 0xd4, 0x40,
|
||||
0x18, 0xc5, 0xcd, 0xfe, 0x09, 0xd9, 0x2f, 0xb1, 0x8c, 0xa3, 0x48, 0x10, 0x84, 0x58, 0xbc, 0x58,
|
||||
0x04, 0x37, 0xb8, 0x95, 0x52, 0xbc, 0xb2, 0xe9, 0x6e, 0x25, 0x74, 0x49, 0x96, 0x69, 0x2c, 0xe8,
|
||||
0x4d, 0x98, 0x4d, 0x46, 0x77, 0x30, 0xff, 0x48, 0x26, 0x62, 0xfa, 0x16, 0xde, 0xfa, 0x12, 0xbe,
|
||||
0xa2, 0xcc, 0x24, 0x85, 0xaa, 0x45, 0xbc, 0xfb, 0x7d, 0xdf, 0xcc, 0x39, 0xcc, 0x39, 0x03, 0x56,
|
||||
0x93, 0xec, 0x59, 0x4e, 0x17, 0x55, 0x5d, 0x8a, 0x12, 0x3f, 0xcc, 0x79, 0xf6, 0xb5, 0x6d, 0xfa,
|
||||
0x69, 0xd1, 0x1f, 0x3d, 0xb1, 0x92, 0x32, 0xcf, 0xcb, 0xa2, 0x5f, 0x1e, 0xfe, 0x1c, 0x81, 0x79,
|
||||
0xce, 0x59, 0x96, 0x5e, 0xaa, 0x53, 0x8c, 0x61, 0x52, 0xd0, 0x9c, 0xd9, 0x9a, 0xa3, 0xcd, 0x67,
|
||||
0x44, 0x31, 0x7e, 0x0e, 0x07, 0xbc, 0x89, 0xab, 0x9a, 0xe7, 0xb4, 0xee, 0xe2, 0x2f, 0xac, 0xb3,
|
||||
0x47, 0x8e, 0x36, 0x37, 0x88, 0xc5, 0x9b, 0x6d, 0xbf, 0xbc, 0x60, 0x1d, 0x76, 0xc0, 0x4c, 0x59,
|
||||
0x93, 0xd4, 0xbc, 0x12, 0xbc, 0x2c, 0xec, 0xb1, 0x32, 0xb8, 0xbd, 0xc2, 0x6f, 0x60, 0x96, 0x52,
|
||||
0x41, 0x63, 0xd1, 0x55, 0xcc, 0x9e, 0x38, 0xda, 0xfc, 0x60, 0xf9, 0x74, 0x71, 0xc7, 0x13, 0x17,
|
||||
0x2b, 0x2a, 0x68, 0xd4, 0x55, 0x8c, 0x18, 0xe9, 0x40, 0xd8, 0x03, 0x53, 0xca, 0xe2, 0x8a, 0xd6,
|
||||
0x34, 0x6f, 0xec, 0xa9, 0x33, 0x9e, 0x9b, 0xcb, 0x67, 0xbf, 0xab, 0x87, 0x60, 0x17, 0xac, 0xbb,
|
||||
0xa2, 0x59, 0xcb, 0xb6, 0x94, 0xd7, 0x04, 0xa4, 0x6a, 0xab, 0x44, 0x78, 0x05, 0x16, 0x2f, 0x52,
|
||||
0xf6, 0xed, 0xc6, 0x44, 0xff, 0x5f, 0x13, 0x53, 0xc9, 0x7a, 0x97, 0xc3, 0x1f, 0x1a, 0xa0, 0xb3,
|
||||
0x32, 0xcb, 0x58, 0x22, 0x43, 0xfd, 0xa3, 0xb6, 0x3f, 0x0a, 0x19, 0xfd, 0x5d, 0xc8, 0x63, 0xd0,
|
||||
0x69, 0x2b, 0x4a, 0x7f, 0xa5, 0xda, 0x32, 0xc8, 0x30, 0xe1, 0x13, 0xd0, 0x3f, 0xc9, 0x3f, 0x69,
|
||||
0xec, 0x89, 0x7a, 0xa2, 0x73, 0x67, 0x4b, 0xb7, 0xbe, 0x8d, 0x0c, 0xf7, 0x5f, 0x7c, 0xd7, 0xc0,
|
||||
0xb8, 0x69, 0x0f, 0x1b, 0x30, 0x09, 0xc2, 0x60, 0x8d, 0xee, 0x49, 0xf2, 0xc2, 0x70, 0x83, 0x34,
|
||||
0x49, 0x7e, 0x10, 0x9d, 0xa0, 0x11, 0x9e, 0xc1, 0xd4, 0x0f, 0xa2, 0x57, 0xc7, 0x68, 0x3c, 0xe0,
|
||||
0xd1, 0x12, 0x4d, 0x06, 0x3c, 0x7e, 0x8d, 0xa6, 0x12, 0xcf, 0x37, 0xe1, 0x69, 0x84, 0x00, 0x03,
|
||||
0xe8, 0xab, 0xf0, 0xbd, 0xb7, 0x59, 0x23, 0x53, 0xf2, 0x65, 0x44, 0xfc, 0xe0, 0x1d, 0x7a, 0x84,
|
||||
0x1f, 0xc0, 0xfd, 0xab, 0xf5, 0x59, 0x14, 0x92, 0xd8, 0xf3, 0x83, 0x53, 0xf2, 0x01, 0xa5, 0x18,
|
||||
0x81, 0x35, 0xac, 0x7a, 0x31, 0xf3, 0xbc, 0x8f, 0x6f, 0x3f, 0x73, 0xb1, 0x6f, 0x77, 0xb2, 0x5b,
|
||||
0xf7, 0x9a, 0x67, 0x19, 0xbf, 0x16, 0x2c, 0xd9, 0xbb, 0x7d, 0xa8, 0x97, 0x29, 0x6f, 0x44, 0xcd,
|
||||
0x77, 0xad, 0x60, 0xa9, 0xcb, 0x0b, 0xc1, 0xea, 0x82, 0x66, 0xae, 0x4a, 0xea, 0xf6, 0x49, 0xab,
|
||||
0xdd, 0x4e, 0x57, 0xf3, 0xd1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x14, 0xa6, 0xc9, 0x55, 0xe0,
|
||||
0x02, 0x00, 0x00,
|
||||
// 416 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0x5f, 0x8b, 0xd4, 0x30,
|
||||
0x14, 0xc5, 0xed, 0xfc, 0x63, 0xe6, 0x76, 0x94, 0x18, 0x45, 0x06, 0x41, 0xa8, 0xfb, 0x34, 0x08,
|
||||
0xb6, 0x38, 0x2b, 0xcb, 0xe2, 0x93, 0xdb, 0xed, 0xac, 0x14, 0x87, 0x76, 0xc9, 0xd6, 0x05, 0x7d,
|
||||
0x19, 0xd2, 0x26, 0x3a, 0x81, 0xf4, 0x0f, 0x6d, 0x2a, 0xce, 0x7e, 0x03, 0x1f, 0x7d, 0xf5, 0xd3,
|
||||
0x4a, 0xd2, 0x0e, 0xac, 0x30, 0x0f, 0x82, 0x6f, 0xbf, 0x7b, 0x6f, 0xce, 0x4d, 0xce, 0x09, 0xcc,
|
||||
0x9b, 0x6c, 0xc7, 0x73, 0xea, 0x56, 0x75, 0xa9, 0x4a, 0xfc, 0x24, 0x17, 0xf2, 0x7b, 0xdb, 0x74,
|
||||
0x95, 0xdb, 0x8d, 0x9e, 0xcf, 0xb3, 0x32, 0xcf, 0xcb, 0xa2, 0x6b, 0x9e, 0xfc, 0x1c, 0x80, 0x7d,
|
||||
0x25, 0xb8, 0x64, 0x37, 0x66, 0x8a, 0x31, 0x8c, 0x0a, 0x9a, 0xf3, 0x85, 0xe5, 0x58, 0xcb, 0x19,
|
||||
0x31, 0x8c, 0x1d, 0xb0, 0x19, 0x6f, 0xb2, 0x5a, 0x54, 0x4a, 0x94, 0xc5, 0x62, 0x60, 0x46, 0xf7,
|
||||
0x5b, 0xf8, 0x1d, 0xcc, 0x18, 0x55, 0x74, 0xab, 0xf6, 0x15, 0x5f, 0x0c, 0x1d, 0x6b, 0xf9, 0x68,
|
||||
0xf5, 0xc2, 0x3d, 0x72, 0xb9, 0x1b, 0x50, 0x45, 0x93, 0x7d, 0xc5, 0xc9, 0x94, 0xf5, 0x84, 0x7d,
|
||||
0xb0, 0xb5, 0x6c, 0x5b, 0xd1, 0x9a, 0xe6, 0xcd, 0x62, 0xe4, 0x0c, 0x97, 0xf6, 0xea, 0xe5, 0xdf,
|
||||
0xea, 0xfe, 0xc9, 0x1f, 0xf9, 0xfe, 0x96, 0xca, 0x96, 0x5f, 0x53, 0x51, 0x13, 0xd0, 0xaa, 0x6b,
|
||||
0x23, 0xc2, 0x01, 0xcc, 0x45, 0xc1, 0xf8, 0x8f, 0xc3, 0x92, 0xf1, 0xbf, 0x2e, 0xb1, 0x8d, 0xac,
|
||||
0xdb, 0x72, 0xf2, 0xdb, 0x02, 0x74, 0x59, 0x4a, 0xc9, 0x33, 0x6d, 0xea, 0xbf, 0x02, 0x79, 0x06,
|
||||
0x13, 0xda, 0xaa, 0x32, 0x0c, 0x4c, 0x1a, 0x53, 0xd2, 0x57, 0xf8, 0x1c, 0x26, 0x5f, 0x75, 0xda,
|
||||
0x07, 0x9f, 0xce, 0xd1, 0x94, 0xee, 0x7d, 0x08, 0xe9, 0xcf, 0xbf, 0xfa, 0x65, 0xc1, 0xf4, 0x90,
|
||||
0x1e, 0x9e, 0xc2, 0x28, 0x8a, 0xa3, 0x35, 0x7a, 0xa0, 0xc9, 0x8f, 0xe3, 0x0d, 0xb2, 0x34, 0x85,
|
||||
0x51, 0x72, 0x8e, 0x06, 0x78, 0x06, 0xe3, 0x30, 0x4a, 0xde, 0x9c, 0xa1, 0x61, 0x8f, 0xa7, 0x2b,
|
||||
0x34, 0xea, 0xf1, 0xec, 0x2d, 0x1a, 0x6b, 0xbc, 0xda, 0xc4, 0x17, 0x09, 0x02, 0x0c, 0x30, 0x09,
|
||||
0xe2, 0x4f, 0xfe, 0x66, 0x8d, 0x6c, 0xcd, 0x37, 0x09, 0x09, 0xa3, 0x0f, 0xe8, 0x29, 0x7e, 0x0c,
|
||||
0x0f, 0x6f, 0xd7, 0x97, 0x49, 0x4c, 0xb6, 0x7e, 0x18, 0x5d, 0x90, 0xcf, 0x88, 0x61, 0x04, 0xf3,
|
||||
0xbe, 0xd5, 0x89, 0xb9, 0xef, 0x7f, 0x79, 0xff, 0x4d, 0xa8, 0x5d, 0x9b, 0xea, 0x6c, 0xbd, 0x3b,
|
||||
0x21, 0xa5, 0xb8, 0x53, 0x3c, 0xdb, 0x79, 0x9d, 0xa9, 0xd7, 0x4c, 0x34, 0xaa, 0x16, 0x69, 0xab,
|
||||
0x38, 0xf3, 0x44, 0xa1, 0x78, 0x5d, 0x50, 0xe9, 0x19, 0xa7, 0x5e, 0xe7, 0xb4, 0x4a, 0xd3, 0x89,
|
||||
0xa9, 0x4f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x74, 0xb3, 0xe8, 0x78, 0xba, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@ func (p *Proxy) CreateCollection(ctx context.Context, req *schemapb.CollectionSc
|
|||
}
|
||||
|
||||
func (p *Proxy) Search(ctx context.Context, req *servicepb.Query) (*servicepb.QueryResult, error) {
|
||||
log.Printf("receive search request: %v", req)
|
||||
qt := &QueryTask{
|
||||
Condition: NewTaskCondition(ctx),
|
||||
SearchRequest: internalpb.SearchRequest{
|
||||
|
|
|
@ -383,13 +383,11 @@ func (qt *QueryTask) PostExecute() error {
|
|||
qt.result = &servicepb.QueryResult{}
|
||||
return nil
|
||||
}
|
||||
|
||||
n := len(searchResults[0].Hits) // n
|
||||
if n <= 0 {
|
||||
qt.result = &servicepb.QueryResult{}
|
||||
return nil
|
||||
}
|
||||
|
||||
hits := make([][]*servicepb.Hits, rlen)
|
||||
for i, searchResult := range searchResults {
|
||||
hits[i] = make([]*servicepb.Hits, n)
|
||||
|
@ -401,15 +399,18 @@ func (qt *QueryTask) PostExecute() error {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
k := len(hits[0][0].IDs)
|
||||
qt.result = &servicepb.QueryResult{
|
||||
queryResult := &servicepb.QueryResult{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: 0,
|
||||
},
|
||||
Hits: make([][]byte, 0),
|
||||
}
|
||||
|
||||
// reduce by score, TODO: use better algorithm
|
||||
// use merge-sort here, the number of ways to merge is `rlen`
|
||||
// in this process, we must make sure:
|
||||
// len(queryResult.Hits) == n
|
||||
// len(queryResult.Hits[i].Ids) == k for i in range(n)
|
||||
for i := 0; i < n; i++ { // n
|
||||
locs := make([]int, rlen)
|
||||
reducedHits := &servicepb.Hits{
|
||||
|
@ -417,7 +418,6 @@ func (qt *QueryTask) PostExecute() error {
|
|||
RowData: make([][]byte, 0),
|
||||
Scores: make([]float32, 0),
|
||||
}
|
||||
|
||||
for j := 0; j < k; j++ { // k
|
||||
choice, minDistance := 0, float32(math.MaxFloat32)
|
||||
for q, loc := range locs { // query num, the number of ways to merge
|
||||
|
@ -439,11 +439,12 @@ func (qt *QueryTask) PostExecute() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
qt.result.Hits = append(qt.result.Hits, reducedHitsBs)
|
||||
queryResult.Hits = append(queryResult.Hits, reducedHitsBs)
|
||||
}
|
||||
return nil
|
||||
qt.result = queryResult
|
||||
}
|
||||
}
|
||||
//return nil
|
||||
}
|
||||
|
||||
type HasCollectionTask struct {
|
||||
|
|
|
@ -293,7 +293,7 @@ func (sched *TaskScheduler) processTask(t task, q TaskQueue) {
|
|||
}
|
||||
|
||||
q.AddActiveTask(t)
|
||||
log.Printf("task add to active list ...")
|
||||
log.Printf("query task add to active list ...")
|
||||
defer func() {
|
||||
q.PopActiveTask(t.EndTs())
|
||||
log.Printf("pop from active list ...")
|
||||
|
@ -304,9 +304,8 @@ func (sched *TaskScheduler) processTask(t task, q TaskQueue) {
|
|||
log.Printf("execute definition task failed, error = %v", err)
|
||||
return
|
||||
}
|
||||
log.Printf("task execution done ...")
|
||||
log.Printf("scheduler task done ...")
|
||||
err = t.PostExecute()
|
||||
log.Printf("post execute task done ...")
|
||||
}
|
||||
|
||||
func (sched *TaskScheduler) definitionLoop() {
|
||||
|
|
|
@ -19,9 +19,8 @@ func TestCollectionReplica_getCollectionNum(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -31,9 +30,8 @@ func TestCollectionReplica_getCollectionNum(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -43,8 +41,7 @@ func TestCollectionReplica_getCollectionNum(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -75,9 +72,8 @@ func TestCollectionReplica_addCollection(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -87,9 +83,8 @@ func TestCollectionReplica_addCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -99,8 +94,7 @@ func TestCollectionReplica_addCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -136,9 +130,8 @@ func TestCollectionReplica_removeCollection(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -148,9 +141,8 @@ func TestCollectionReplica_removeCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -160,8 +152,7 @@ func TestCollectionReplica_removeCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -201,9 +192,8 @@ func TestCollectionReplica_getCollectionByID(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -213,9 +203,8 @@ func TestCollectionReplica_getCollectionByID(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -225,8 +214,7 @@ func TestCollectionReplica_getCollectionByID(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -268,9 +256,8 @@ func TestCollectionReplica_getCollectionByName(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -280,9 +267,8 @@ func TestCollectionReplica_getCollectionByName(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -292,8 +278,7 @@ func TestCollectionReplica_getCollectionByName(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -335,9 +320,8 @@ func TestCollectionReplica_hasCollection(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -347,9 +331,8 @@ func TestCollectionReplica_hasCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -359,8 +342,7 @@ func TestCollectionReplica_hasCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -396,9 +378,8 @@ func TestCollectionReplica_getPartitionNum(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -408,9 +389,8 @@ func TestCollectionReplica_getPartitionNum(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -420,8 +400,7 @@ func TestCollectionReplica_getPartitionNum(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -470,9 +449,8 @@ func TestCollectionReplica_addPartition(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -482,9 +460,8 @@ func TestCollectionReplica_addPartition(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -494,8 +471,7 @@ func TestCollectionReplica_addPartition(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -541,9 +517,8 @@ func TestCollectionReplica_removePartition(t *testing.T) {
|
|||
collectionID := UniqueID(0)
|
||||
partitionTag := "default"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -553,9 +528,8 @@ func TestCollectionReplica_removePartition(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -565,8 +539,7 @@ func TestCollectionReplica_removePartition(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -613,9 +586,8 @@ func TestCollectionReplica_addPartitionsByCollectionMeta(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -625,9 +597,8 @@ func TestCollectionReplica_addPartitionsByCollectionMeta(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -637,8 +608,7 @@ func TestCollectionReplica_addPartitionsByCollectionMeta(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -689,9 +659,8 @@ func TestCollectionReplica_removePartitionsByCollectionMeta(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -701,9 +670,8 @@ func TestCollectionReplica_removePartitionsByCollectionMeta(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -713,8 +681,7 @@ func TestCollectionReplica_removePartitionsByCollectionMeta(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -765,9 +732,8 @@ func TestCollectionReplica_getPartitionByTag(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -777,9 +743,8 @@ func TestCollectionReplica_getPartitionByTag(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -789,8 +754,7 @@ func TestCollectionReplica_getPartitionByTag(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -836,9 +800,8 @@ func TestCollectionReplica_hasPartition(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -848,9 +811,8 @@ func TestCollectionReplica_hasPartition(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -860,8 +822,7 @@ func TestCollectionReplica_hasPartition(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -906,9 +867,8 @@ func TestCollectionReplica_addSegment(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -918,9 +878,8 @@ func TestCollectionReplica_addSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -930,8 +889,7 @@ func TestCollectionReplica_addSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -980,9 +938,8 @@ func TestCollectionReplica_removeSegment(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -992,9 +949,8 @@ func TestCollectionReplica_removeSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -1004,8 +960,7 @@ func TestCollectionReplica_removeSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -1056,9 +1011,8 @@ func TestCollectionReplica_getSegmentByID(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -1068,9 +1022,8 @@ func TestCollectionReplica_getSegmentByID(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -1080,8 +1033,7 @@ func TestCollectionReplica_getSegmentByID(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -1130,9 +1082,8 @@ func TestCollectionReplica_hasSegment(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -1142,9 +1093,8 @@ func TestCollectionReplica_hasSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -1154,8 +1104,7 @@ func TestCollectionReplica_hasSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -1208,9 +1157,8 @@ func TestCollectionReplica_freeAll(t *testing.T) {
|
|||
collectionName := "collection0"
|
||||
collectionID := UniqueID(0)
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -1220,9 +1168,8 @@ func TestCollectionReplica_freeAll(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -1232,8 +1179,7 @@ func TestCollectionReplica_freeAll(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -17,9 +17,8 @@ func TestCollection_Partitions(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -29,9 +28,8 @@ func TestCollection_Partitions(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -41,8 +39,7 @@ func TestCollection_Partitions(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -80,9 +77,8 @@ func TestCollection_Partitions(t *testing.T) {
|
|||
|
||||
func TestCollection_newCollection(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -92,9 +88,8 @@ func TestCollection_newCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -104,8 +99,7 @@ func TestCollection_newCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -129,9 +123,8 @@ func TestCollection_newCollection(t *testing.T) {
|
|||
|
||||
func TestCollection_deleteCollection(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -141,9 +134,8 @@ func TestCollection_deleteCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -153,8 +145,7 @@ func TestCollection_deleteCollection(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -38,9 +38,8 @@ func TestDataSyncService_Start(t *testing.T) {
|
|||
// init meta
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -50,9 +49,8 @@ func TestDataSyncService_Start(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -62,8 +60,7 @@ func TestDataSyncService_Start(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -120,9 +120,8 @@ func TestMetaService_isSegmentChannelRangeInQueryNodeChannelRange(t *testing.T)
|
|||
func TestMetaService_printCollectionStruct(t *testing.T) {
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -132,9 +131,8 @@ func TestMetaService_printCollectionStruct(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -144,8 +142,7 @@ func TestMetaService_printCollectionStruct(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -231,9 +228,8 @@ func TestMetaService_processSegmentCreate(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -243,9 +239,8 @@ func TestMetaService_processSegmentCreate(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -255,8 +250,7 @@ func TestMetaService_processSegmentCreate(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -357,9 +351,8 @@ func TestMetaService_processSegmentModify(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -369,9 +362,8 @@ func TestMetaService_processSegmentModify(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -381,8 +373,7 @@ func TestMetaService_processSegmentModify(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -665,9 +656,8 @@ func TestMetaService_processSegmentDelete(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -677,9 +667,8 @@ func TestMetaService_processSegmentDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -689,8 +678,7 @@ func TestMetaService_processSegmentDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -17,9 +17,8 @@ func TestPartition_Segments(t *testing.T) {
|
|||
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -29,9 +28,8 @@ func TestPartition_Segments(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -41,8 +39,7 @@ func TestPartition_Segments(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -16,9 +16,8 @@ import (
|
|||
|
||||
func TestPlan_Plan(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -28,9 +27,8 @@ func TestPlan_Plan(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -40,8 +38,7 @@ func TestPlan_Plan(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -74,9 +71,8 @@ func TestPlan_Plan(t *testing.T) {
|
|||
|
||||
func TestPlan_PlaceholderGroup(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -86,9 +82,8 @@ func TestPlan_PlaceholderGroup(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -98,8 +93,7 @@ func TestPlan_PlaceholderGroup(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -17,9 +17,8 @@ import (
|
|||
|
||||
func TestReduce_AllFunc(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -29,9 +28,8 @@ func TestReduce_AllFunc(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -41,8 +39,7 @@ func TestReduce_AllFunc(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -30,9 +30,8 @@ func TestSearch_Search(t *testing.T) {
|
|||
// init meta
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -42,9 +41,8 @@ func TestSearch_Search(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -54,8 +52,7 @@ func TestSearch_Search(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -20,9 +20,8 @@ import (
|
|||
//-------------------------------------------------------------------------------------- constructor and destructor
|
||||
func TestSegment_newSegment(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -32,9 +31,8 @@ func TestSegment_newSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -44,8 +42,7 @@ func TestSegment_newSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -75,9 +72,8 @@ func TestSegment_newSegment(t *testing.T) {
|
|||
|
||||
func TestSegment_deleteSegment(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -87,9 +83,8 @@ func TestSegment_deleteSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -99,8 +94,7 @@ func TestSegment_deleteSegment(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -132,9 +126,8 @@ func TestSegment_deleteSegment(t *testing.T) {
|
|||
//-------------------------------------------------------------------------------------- stats functions
|
||||
func TestSegment_getRowCount(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -144,9 +137,8 @@ func TestSegment_getRowCount(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -156,8 +148,7 @@ func TestSegment_getRowCount(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -220,9 +211,8 @@ func TestSegment_getRowCount(t *testing.T) {
|
|||
|
||||
func TestSegment_getDeletedCount(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -232,9 +222,8 @@ func TestSegment_getDeletedCount(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -244,8 +233,7 @@ func TestSegment_getDeletedCount(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -314,9 +302,8 @@ func TestSegment_getDeletedCount(t *testing.T) {
|
|||
|
||||
func TestSegment_getMemSize(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -326,9 +313,8 @@ func TestSegment_getMemSize(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -338,8 +324,7 @@ func TestSegment_getMemSize(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -403,9 +388,8 @@ func TestSegment_getMemSize(t *testing.T) {
|
|||
//-------------------------------------------------------------------------------------- dm & search functions
|
||||
func TestSegment_segmentInsert(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -415,9 +399,8 @@ func TestSegment_segmentInsert(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -427,8 +410,7 @@ func TestSegment_segmentInsert(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -487,9 +469,8 @@ func TestSegment_segmentInsert(t *testing.T) {
|
|||
|
||||
func TestSegment_segmentDelete(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -499,9 +480,8 @@ func TestSegment_segmentDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -511,8 +491,7 @@ func TestSegment_segmentDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -580,9 +559,8 @@ func TestSegment_segmentSearch(t *testing.T) {
|
|||
defer cancel()
|
||||
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -592,9 +570,8 @@ func TestSegment_segmentSearch(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -604,8 +581,7 @@ func TestSegment_segmentSearch(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -707,9 +683,8 @@ func TestSegment_segmentSearch(t *testing.T) {
|
|||
//-------------------------------------------------------------------------------------- preDm functions
|
||||
func TestSegment_segmentPreInsert(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -719,9 +694,8 @@ func TestSegment_segmentPreInsert(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -731,8 +705,7 @@ func TestSegment_segmentPreInsert(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -786,9 +759,8 @@ func TestSegment_segmentPreInsert(t *testing.T) {
|
|||
|
||||
func TestSegment_segmentPreDelete(t *testing.T) {
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -798,9 +770,8 @@ func TestSegment_segmentPreDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -810,8 +781,7 @@ func TestSegment_segmentPreDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: "collection0",
|
||||
AutoID: true,
|
||||
Name: "collection0",
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
|
@ -33,8 +33,8 @@ func TestStatsService_start(t *testing.T) {
|
|||
// init meta
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -44,9 +44,8 @@ func TestStatsService_start(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -56,8 +55,7 @@ func TestStatsService_start(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
@ -116,9 +114,8 @@ func TestSegmentManagement_SegmentStatisticService(t *testing.T) {
|
|||
// init meta
|
||||
collectionName := "collection0"
|
||||
fieldVec := schemapb.FieldSchema{
|
||||
Name: "vec",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
Name: "vec",
|
||||
DataType: schemapb.DataType_VECTOR_FLOAT,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -128,9 +125,8 @@ func TestSegmentManagement_SegmentStatisticService(t *testing.T) {
|
|||
}
|
||||
|
||||
fieldInt := schemapb.FieldSchema{
|
||||
Name: "age",
|
||||
IsPrimaryKey: false,
|
||||
DataType: schemapb.DataType_INT32,
|
||||
Name: "age",
|
||||
DataType: schemapb.DataType_INT32,
|
||||
TypeParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: "dim",
|
||||
|
@ -140,8 +136,7 @@ func TestSegmentManagement_SegmentStatisticService(t *testing.T) {
|
|||
}
|
||||
|
||||
schema := schemapb.CollectionSchema{
|
||||
Name: collectionName,
|
||||
AutoID: true,
|
||||
Name: collectionName,
|
||||
Fields: []*schemapb.FieldSchema{
|
||||
&fieldVec, &fieldInt,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue