From 2d3b5d13f59296fa2af4ba9c6a20dde0fb3a75fa Mon Sep 17 00:00:00 2001 From: wchuande Date: Fri, 12 Apr 2024 18:41:12 +0800 Subject: [PATCH] [feat][sdk] Support create vector index with scalar schema --- src/example/sdk_vector_example.cc | 4 + src/sdk/vector.h | 43 +++++++---- src/sdk/vector/vector_common.h | 77 ++++++++++++++++--- src/sdk/vector/vector_index_creator.cc | 5 ++ .../vector_index_creator_internal_data.h | 7 ++ test/unit_test/main.cc | 2 +- .../sdk/vector/test_vector_common.cc | 62 ++++++++++----- 7 files changed, 159 insertions(+), 41 deletions(-) diff --git a/src/example/sdk_vector_example.cc b/src/example/sdk_vector_example.cc index 840980ba6..cbdb9c0f6 100644 --- a/src/example/sdk_vector_example.cc +++ b/src/example/sdk_vector_example.cc @@ -49,6 +49,9 @@ static void PrepareVectorIndex() { CHECK_NOTNULL(creator); dingodb::ScopeGuard guard([&]() { delete creator; }); + dingodb::sdk::VectorScalarSchema schema; + // NOTE: may be add more + schema.cols.push_back({g_scalar_col[0], dingodb::sdk::ScalarFieldType::kInt64, true}); Status create = creator->SetSchemaId(g_schema_id) .SetName(g_index_name) .SetReplicaNum(3) @@ -56,6 +59,7 @@ static void PrepareVectorIndex() { .SetFlatParam(g_flat_param) .SetAutoIncrement(true) .SetAutoIncrementStart(1) + .SetScalarSchema(schema) .Create(g_index_id); DINGO_LOG(INFO) << "Create index status: " << create.ToString() << ", index_id:" << g_index_id; sleep(20); diff --git a/src/sdk/vector.h b/src/sdk/vector.h index 52a9f476c..7cd1c18ed 100644 --- a/src/sdk/vector.h +++ b/src/sdk/vector.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "sdk/status.h" @@ -120,6 +121,33 @@ struct BruteForceParam { static VectorIndexType Type() { return VectorIndexType::kBruteForce; } }; +enum class ScalarFieldType : uint8_t { + kNone, + kBool, + kInt8, + kInt16, + kInt32, + kInt64, + kFloat32, + kDouble, + kString, + kBytes +}; + +struct VectorScalarColumnSchema { + std::string key; + ScalarFieldType type; + bool speed; + + VectorScalarColumnSchema(std::string& key, ScalarFieldType type, bool speed = false) + : key(key), type(type), speed(speed) {} +}; + +// TODO: maybe use builder to build VectorScalarSchema +struct VectorScalarSchema { + std::vector cols; +}; + enum ValueType : uint8_t { kNoneValueType, kFloat, kUint8 }; std::string ValueTypeToString(ValueType type); @@ -158,19 +186,6 @@ struct Vector { std::string ToString() const; }; -enum class ScalarFieldType : uint8_t { - kNone, - kBool, - kInt8, - kInt16, - kInt32, - kInt64, - kFloat32, - kDouble, - kString, - kBytes -}; - struct ScalarField { bool bool_data; int32_t int_data; @@ -467,6 +482,8 @@ class VectorIndexCreator { // start_id should greater than 0, when set auto_increment is set to true VectorIndexCreator& SetAutoIncrementStart(int64_t start_id); + VectorIndexCreator& SetScalarSchema(const VectorScalarSchema& schema); + Status Create(int64_t& out_index_id); private: diff --git a/src/sdk/vector/vector_common.h b/src/sdk/vector/vector_common.h index 496d1b46b..3eebd0695 100644 --- a/src/sdk/vector/vector_common.h +++ b/src/sdk/vector/vector_common.h @@ -100,6 +100,60 @@ static VectorIndexType InternalVectorIndexTypePB2VectorIndexType(pb::common::Vec } } +static pb::common::ScalarFieldType ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType type) { + switch (type) { + case ScalarFieldType::kNone: + return pb::common::ScalarFieldType::NONE; + case ScalarFieldType::kBool: + return pb::common::ScalarFieldType::BOOL; + case ScalarFieldType::kInt8: + return pb::common::ScalarFieldType::INT8; + case ScalarFieldType::kInt16: + return pb::common::ScalarFieldType::INT16; + case ScalarFieldType::kInt32: + return pb::common::ScalarFieldType::INT32; + case ScalarFieldType::kInt64: + return pb::common::ScalarFieldType::INT64; + case ScalarFieldType::kFloat32: + return pb::common::ScalarFieldType::FLOAT32; + case ScalarFieldType::kDouble: + return pb::common::ScalarFieldType::DOUBLE; + case ScalarFieldType::kString: + return pb::common::ScalarFieldType::STRING; + case ScalarFieldType::kBytes: + return pb::common::ScalarFieldType::BYTES; + default: + CHECK(false) << "unsupported scalar field type:" << static_cast(type); + } +} + +static ScalarFieldType InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType type) { + switch (type) { + case pb::common::ScalarFieldType::NONE: + return ScalarFieldType::kNone; + case pb::common::ScalarFieldType::BOOL: + return ScalarFieldType::kBool; + case pb::common::ScalarFieldType::INT8: + return ScalarFieldType::kInt8; + case pb::common::ScalarFieldType::INT16: + return ScalarFieldType::kInt16; + case pb::common::ScalarFieldType::INT32: + return ScalarFieldType::kInt32; + case pb::common::ScalarFieldType::INT64: + return ScalarFieldType::kInt64; + case pb::common::ScalarFieldType::FLOAT32: + return ScalarFieldType::kFloat32; + case pb::common::ScalarFieldType::DOUBLE: + return ScalarFieldType::kDouble; + case pb::common::ScalarFieldType::STRING: + return ScalarFieldType::kString; + case pb::common::ScalarFieldType::BYTES: + return ScalarFieldType::kBytes; + default: + CHECK(false) << "unsupported scalar field type:" << pb::common::ScalarFieldType_Name(type); + } +} + static void FillFlatParmeter(pb::common::VectorIndexParameter* parameter, const FlatParam& param) { parameter->set_vector_index_type(pb::common::VECTOR_INDEX_TYPE_FLAT); auto* flat = parameter->mutable_flat_parameter(); @@ -181,48 +235,41 @@ static pb::common::ValueType ValueType2InternalValueTypePB(ValueType value_type) static pb::common::ScalarValue ScalarValue2InternalScalarValuePB(const sdk::ScalarValue& scalar_value) { pb::common::ScalarValue result; + result.set_field_type(ScalarFieldType2InternalScalarFieldTypePB(scalar_value.type)); + if (scalar_value.type == sdk::ScalarFieldType::kBool) { - result.set_field_type(pb::common::ScalarFieldType::BOOL); for (const auto& field : scalar_value.fields) { result.add_fields()->set_bool_data(field.bool_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kInt8) { - result.set_field_type(pb::common::ScalarFieldType::INT8); for (const auto& field : scalar_value.fields) { result.add_fields()->set_int_data(field.int_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kInt16) { - result.set_field_type(pb::common::ScalarFieldType::INT16); for (const auto& field : scalar_value.fields) { result.add_fields()->set_int_data(field.int_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kInt32) { - result.set_field_type(pb::common::ScalarFieldType::INT32); for (const auto& field : scalar_value.fields) { result.add_fields()->set_int_data(field.int_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kInt64) { - result.set_field_type(pb::common::ScalarFieldType::INT64); for (const auto& field : scalar_value.fields) { result.add_fields()->set_long_data(field.long_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kFloat32) { - result.set_field_type(pb::common::ScalarFieldType::FLOAT32); for (const auto& field : scalar_value.fields) { result.add_fields()->set_float_data(field.float_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kDouble) { - result.set_field_type(pb::common::ScalarFieldType::DOUBLE); for (const auto& field : scalar_value.fields) { result.add_fields()->set_double_data(field.double_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kString) { - result.set_field_type(pb::common::ScalarFieldType::STRING); for (const auto& field : scalar_value.fields) { result.add_fields()->set_string_data(field.string_data); } } else if (scalar_value.type == sdk::ScalarFieldType::kBytes) { - result.set_field_type(pb::common::ScalarFieldType::BYTES); for (const auto& field : scalar_value.fields) { result.add_fields()->set_bytes_data(field.bytes_data); } @@ -231,6 +278,18 @@ static pb::common::ScalarValue ScalarValue2InternalScalarValuePB(const sdk::Scal return result; } +static void FillScalarSchemaItem(pb::common::ScalarSchemaItem* pb, const VectorScalarColumnSchema& schema) { + pb->set_key(schema.key); + pb->set_field_type(ScalarFieldType2InternalScalarFieldTypePB(schema.type)); + pb->set_enable_speed_up(schema.speed); +} + +static void FillScalarSchema(pb::common::ScalarSchema* pb, const VectorScalarSchema& schema) { + for (const auto& col : schema.cols) { + FillScalarSchemaItem(pb->add_fields(), col); + } +} + static void FillVectorWithIdPB(pb::common::VectorWithId* pb, const VectorWithId& vector_with_id, bool with_id = true) { if (with_id) { pb->set_id(vector_with_id.id); diff --git a/src/sdk/vector/vector_index_creator.cc b/src/sdk/vector/vector_index_creator.cc index 822c65fac..747551862 100644 --- a/src/sdk/vector/vector_index_creator.cc +++ b/src/sdk/vector/vector_index_creator.cc @@ -84,6 +84,11 @@ VectorIndexCreator& VectorIndexCreator::SetAutoIncrement(bool auto_incr) { return *this; } +VectorIndexCreator& VectorIndexCreator::SetScalarSchema(const VectorScalarSchema& schema) { + data_->schema = schema; + return *this; +} + VectorIndexCreator& VectorIndexCreator::SetAutoIncrementStart(int64_t start_id) { data_->auto_incr = true; data_->auto_incr_start = start_id; diff --git a/src/sdk/vector/vector_index_creator_internal_data.h b/src/sdk/vector/vector_index_creator_internal_data.h index 938155c0a..a3b9b09de 100644 --- a/src/sdk/vector/vector_index_creator_internal_data.h +++ b/src/sdk/vector/vector_index_creator_internal_data.h @@ -67,6 +67,11 @@ class VectorIndexCreator::Data { } else { CHECK(false) << "unsupported index type, " << index_type; } + + if(schema.has_value()) { + VectorScalarSchema& s = schema.value(); + FillScalarSchema(parameter->mutable_scalar_schema(), s); + } } const ClientStub& stub; @@ -88,6 +93,8 @@ class VectorIndexCreator::Data { bool auto_incr{false}; std::optional auto_incr_start; + std::optional schema; + bool wait; }; diff --git a/test/unit_test/main.cc b/test/unit_test/main.cc index e0a52f7c3..ee6b68181 100644 --- a/test/unit_test/main.cc +++ b/test/unit_test/main.cc @@ -114,7 +114,7 @@ int main(int argc, char* argv[]) { default_run_case += ":RegionTest.*"; default_run_case += ":StoreRpcControllerTest.*"; default_run_case += ":ThreadPoolActuatorTest.*"; - default_run_case += ":VectorCommonTest.*"; + default_run_case += ":SDKVectorCommonTest.*"; default_run_case += ":VectorIndexCacheKeyTest.*"; default_run_case += ":VectorIndexTest.*"; default_run_case += ":TxnBufferTest.*"; diff --git a/test/unit_test/sdk/vector/test_vector_common.cc b/test/unit_test/sdk/vector/test_vector_common.cc index daaf343cc..4afafc196 100644 --- a/test/unit_test/sdk/vector/test_vector_common.cc +++ b/test/unit_test/sdk/vector/test_vector_common.cc @@ -20,7 +20,7 @@ namespace dingodb { namespace sdk { -TEST(VectorCommonTest, TestMetricType2InternalMetricTypePB) { +TEST(SDKVectorCommonTest, TestMetricType2InternalMetricTypePB) { EXPECT_EQ(MetricType2InternalMetricTypePB(MetricType::kL2), pb::common::MetricType::METRIC_TYPE_L2); EXPECT_EQ(MetricType2InternalMetricTypePB(MetricType::kInnerProduct), @@ -29,7 +29,7 @@ TEST(VectorCommonTest, TestMetricType2InternalMetricTypePB) { EXPECT_EQ(MetricType2InternalMetricTypePB(MetricType::kCosine), pb::common::MetricType::METRIC_TYPE_COSINE); } -TEST(VectorCommonTest, TestInternalMetricTypePB2MetricType) { +TEST(SDKVectorCommonTest, TestInternalMetricTypePB2MetricType) { EXPECT_EQ(InternalMetricTypePB2MetricType(pb::common::MetricType::METRIC_TYPE_NONE), MetricType::kNoneMetricType); EXPECT_EQ(InternalMetricTypePB2MetricType(pb::common::MetricType::METRIC_TYPE_L2), MetricType::kL2); EXPECT_EQ(InternalMetricTypePB2MetricType(pb::common::MetricType::METRIC_TYPE_INNER_PRODUCT), @@ -37,7 +37,7 @@ TEST(VectorCommonTest, TestInternalMetricTypePB2MetricType) { EXPECT_EQ(InternalMetricTypePB2MetricType(pb::common::MetricType::METRIC_TYPE_COSINE), MetricType::kCosine); } -TEST(VectorCommonTest, TestVectorIndexType2InternalVectorIndexTypePB) { +TEST(SDKVectorCommonTest, TestVectorIndexType2InternalVectorIndexTypePB) { EXPECT_EQ(VectorIndexType2InternalVectorIndexTypePB(VectorIndexType::kNoneIndexType), pb::common::VECTOR_INDEX_TYPE_NONE); @@ -57,7 +57,7 @@ TEST(VectorCommonTest, TestVectorIndexType2InternalVectorIndexTypePB) { pb::common::VECTOR_INDEX_TYPE_BRUTEFORCE); } -TEST(VectorCommonTest, TestInternalVectorIndexTypePB2VectorIndexType) { +TEST(SDKVectorCommonTest, TestInternalVectorIndexTypePB2VectorIndexType) { EXPECT_EQ(InternalVectorIndexTypePB2VectorIndexType(pb::common::VECTOR_INDEX_TYPE_NONE), VectorIndexType::kNoneIndexType); @@ -77,7 +77,7 @@ TEST(VectorCommonTest, TestInternalVectorIndexTypePB2VectorIndexType) { VectorIndexType::kBruteForce); } -TEST(VectorCommonTest, TestFillFlatParmeter) { +TEST(SDKVectorCommonTest, TestFillFlatParmeter) { pb::common::VectorIndexParameter parameter; FlatParam param{128, MetricType::kL2}; @@ -88,7 +88,7 @@ TEST(VectorCommonTest, TestFillFlatParmeter) { EXPECT_EQ(parameter.flat_parameter().metric_type(), MetricType2InternalMetricTypePB(param.metric_type)); } -TEST(VectorCommonTest, TestFillIvfFlatParmeter) { +TEST(SDKVectorCommonTest, TestFillIvfFlatParmeter) { pb::common::VectorIndexParameter parameter; IvfFlatParam param{128, MetricType::kL2}; @@ -100,7 +100,7 @@ TEST(VectorCommonTest, TestFillIvfFlatParmeter) { EXPECT_EQ(parameter.ivf_flat_parameter().ncentroids(), param.ncentroids); } -TEST(VectorCommonTest, TestFillIvfPqParmeter) { +TEST(SDKVectorCommonTest, TestFillIvfPqParmeter) { pb::common::VectorIndexParameter parameter; IvfPqParam param{128, MetricType::kL2}; @@ -113,7 +113,7 @@ TEST(VectorCommonTest, TestFillIvfPqParmeter) { EXPECT_EQ(parameter.ivf_pq_parameter().nsubvector(), param.nsubvector); } -TEST(VectorCommonTest, TestFillHnswParmeter) { +TEST(SDKVectorCommonTest, TestFillHnswParmeter) { pb::common::VectorIndexParameter parameter; HnswParam param{128, MetricType::kL2, 200}; @@ -127,7 +127,7 @@ TEST(VectorCommonTest, TestFillHnswParmeter) { EXPECT_EQ(parameter.hnsw_parameter().max_elements(), param.max_elements); } -TEST(VectorCommonTest, TestFillButeForceParmeter) { +TEST(SDKVectorCommonTest, TestFillButeForceParmeter) { pb::common::VectorIndexParameter parameter; BruteForceParam param{128, MetricType::kL2}; @@ -138,7 +138,7 @@ TEST(VectorCommonTest, TestFillButeForceParmeter) { EXPECT_EQ(parameter.bruteforce_parameter().metric_type(), MetricType2InternalMetricTypePB(param.metric_type)); } -TEST(VectorCommonTest, TestFillRangePartitionRule) { +TEST(SDKVectorCommonTest, TestFillRangePartitionRule) { pb::meta::PartitionRule partition_rule; std::vector seperator_ids = {10, 20, 30}; std::vector index_and_part_ids = {1, 2, 3, 4, 5}; @@ -176,12 +176,12 @@ TEST(VectorCommonTest, TestFillRangePartitionRule) { } } -TEST(VectorCommonTest, TestValueType2InternalValueTypePB) { +TEST(SDKVectorCommonTest, TestValueType2InternalValueTypePB) { EXPECT_EQ(ValueType2InternalValueTypePB(ValueType::kFloat), pb::common::ValueType::FLOAT); EXPECT_EQ(ValueType2InternalValueTypePB(ValueType::kUint8), pb::common::ValueType::UINT8); } -TEST(VectorCommonTest, TestFillearchFlatParamPB) { +TEST(SDKVectorCommonTest, TestFillearchFlatParamPB) { SearchParam param; param.extra_params[SearchExtraParamType::kParallelOnQueries] = 1; @@ -191,7 +191,7 @@ TEST(VectorCommonTest, TestFillearchFlatParamPB) { EXPECT_EQ(pb.parallel_on_queries(), 1); } -TEST(VectorCommonTest, TestFillsVectorWithIdPB) { +TEST(SDKVectorCommonTest, TestFillsVectorWithIdPB) { VectorWithId vector_with_id; vector_with_id.id = 100; vector_with_id.vector.dimension = 2; @@ -209,7 +209,7 @@ TEST(VectorCommonTest, TestFillsVectorWithIdPB) { EXPECT_EQ(pb.vector().float_values(1), 2.0); } -TEST(VectorCommonTest, TestInternalVectorIdPB2VectorWithId) { +TEST(SDKVectorCommonTest, TestInternalVectorIdPB2VectorWithId) { pb::common::VectorWithId pb; pb.set_id(100); auto* vector_pb = pb.mutable_vector(); @@ -228,7 +228,7 @@ TEST(VectorCommonTest, TestInternalVectorIdPB2VectorWithId) { EXPECT_EQ(vector_with_id.vector.float_values[1], 2.0); } -TEST(VectorCommonTest, TestInternalVectorWithDistance2VectorWithDistance) { +TEST(SDKVectorCommonTest, TestInternalVectorWithDistance2VectorWithDistance) { pb::common::VectorWithDistance pb; auto* vector_with_id_pb = pb.mutable_vector_with_id(); vector_with_id_pb->set_id(100); @@ -252,7 +252,7 @@ TEST(VectorCommonTest, TestInternalVectorWithDistance2VectorWithDistance) { EXPECT_EQ(vector_with_distance.metric_type, MetricType::kL2); } -TEST(VectorCommonTest, InternalVectorIndexMetrics2IndexMetricsResult) { +TEST(SDKVectorCommonTest, InternalVectorIndexMetrics2IndexMetricsResult) { pb::common::VectorIndexMetrics pb; pb.set_vector_index_type(pb::common::VectorIndexType::VECTOR_INDEX_TYPE_FLAT); pb.set_current_count(100); @@ -271,7 +271,7 @@ TEST(VectorCommonTest, InternalVectorIndexMetrics2IndexMetricsResult) { EXPECT_EQ(result.memory_bytes, 5000); } -TEST(VectorCommonTest, TestFillSearchIvfFlatParamPB) { +TEST(SDKVectorCommonTest, TestFillSearchIvfFlatParamPB) { SearchParam param; param.extra_params[SearchExtraParamType::kNprobe] = 10; param.extra_params[SearchExtraParamType::kParallelOnQueries] = 1; @@ -283,7 +283,7 @@ TEST(VectorCommonTest, TestFillSearchIvfFlatParamPB) { EXPECT_EQ(pb.parallel_on_queries(), 1); } -TEST(VectorCommonTest, TestFillSearchIvfPqParamPB) { +TEST(SDKVectorCommonTest, TestFillSearchIvfPqParamPB) { SearchParam param; param.extra_params[SearchExtraParamType::kNprobe] = 10; param.extra_params[SearchExtraParamType::kParallelOnQueries] = 1; @@ -297,6 +297,32 @@ TEST(VectorCommonTest, TestFillSearchIvfPqParamPB) { EXPECT_EQ(pb.recall_num(), 5); } +TEST(SDKVectorCommonTest, ScalarFieldType2InternalScalarFieldTypePB) { + EXPECT_EQ(pb::common::ScalarFieldType::NONE, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kNone)); + EXPECT_EQ(pb::common::ScalarFieldType::BOOL, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kBool)); + EXPECT_EQ(pb::common::ScalarFieldType::INT8, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kInt8)); + EXPECT_EQ(pb::common::ScalarFieldType::INT16, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kInt16)); + EXPECT_EQ(pb::common::ScalarFieldType::INT32, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kInt32)); + EXPECT_EQ(pb::common::ScalarFieldType::INT64, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kInt64)); + EXPECT_EQ(pb::common::ScalarFieldType::FLOAT32, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kFloat32)); + EXPECT_EQ(pb::common::ScalarFieldType::DOUBLE, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kDouble)); + EXPECT_EQ(pb::common::ScalarFieldType::STRING, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kString)); + EXPECT_EQ(pb::common::ScalarFieldType::BYTES, ScalarFieldType2InternalScalarFieldTypePB(ScalarFieldType::kBytes)); +} + +TEST(SDKVectorCommonTest, InternalScalarFieldTypePB2ScalarFieldType) { + EXPECT_EQ(ScalarFieldType::kNone, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::NONE)); + EXPECT_EQ(ScalarFieldType::kBool, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::BOOL)); + EXPECT_EQ(ScalarFieldType::kInt8, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::INT8)); + EXPECT_EQ(ScalarFieldType::kInt16, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::INT16)); + EXPECT_EQ(ScalarFieldType::kInt32, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::INT32)); + EXPECT_EQ(ScalarFieldType::kInt64, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::INT64)); + EXPECT_EQ(ScalarFieldType::kFloat32, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::FLOAT32)); + EXPECT_EQ(ScalarFieldType::kDouble, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::DOUBLE)); + EXPECT_EQ(ScalarFieldType::kString, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::STRING)); + EXPECT_EQ(ScalarFieldType::kBytes, InternalScalarFieldTypePB2ScalarFieldType(pb::common::ScalarFieldType::BYTES)); +} + TEST(FillSearchHnswParamPBTest, TestFillSearchHnswParamPB) { SearchParam param; param.extra_params[SearchExtraParamType::kEfSearch] = 20;