From 1e70686153f40b0c4a27655153bb1e80abf529fc Mon Sep 17 00:00:00 2001 From: Haijun Yu Date: Mon, 15 Apr 2024 15:48:42 +0800 Subject: [PATCH] [chore][format] format vector index code. --- scripts/format_code.sh | 3 ++- src/client/coordinator_client_function_meta.cc | 6 +++--- src/coprocessor/aggregation.h | 7 +++---- src/vector/vector_index_utils.h | 3 ++- test/unit_test/test_vector_index_utils.cc | 6 +++--- 5 files changed, 13 insertions(+), 12 deletions(-) mode change 100755 => 100644 src/coprocessor/aggregation.h diff --git a/scripts/format_code.sh b/scripts/format_code.sh index f1a78a06c..188b62dc9 100755 --- a/scripts/format_code.sh +++ b/scripts/format_code.sh @@ -4,4 +4,5 @@ BASE_DIR=$(dirname $(cd $(dirname $0); pwd)) find $BASE_DIR/src -name "*.cc" | xargs clang-format -style=file -i find $BASE_DIR/src -name "*.h" | xargs clang-format -style=file -i - +find $BASE_DIR/test -name "*.cc" | xargs clang-format -style=file -i +find $BASE_DIR/test -name "*.h" | xargs clang-format -style=file -i diff --git a/src/client/coordinator_client_function_meta.cc b/src/client/coordinator_client_function_meta.cc index 64beca2fd..9e9915c88 100644 --- a/src/client/coordinator_client_function_meta.cc +++ b/src/client/coordinator_client_function_meta.cc @@ -966,7 +966,7 @@ void SendCreateIndex(std::shared_ptr coordinato field->set_field_type(::dingodb::pb::common::ScalarFieldType::DOUBLE); field->set_enable_speed_up(true); - field = scalar_parameter->add_fields(); + field = scalar_parameter->add_fields(); field->set_key("speedup_key_string"); field->set_field_type(::dingodb::pb::common::ScalarFieldType::STRING); field->set_enable_speed_up(true); @@ -996,12 +996,12 @@ void SendCreateIndex(std::shared_ptr coordinato field->set_field_type(::dingodb::pb::common::ScalarFieldType::FLOAT32); field->set_enable_speed_up(false); - field = scalar_parameter->add_fields(); + field = scalar_parameter->add_fields(); field->set_key("key_double"); field->set_field_type(::dingodb::pb::common::ScalarFieldType::DOUBLE); field->set_enable_speed_up(false); - field = scalar_parameter->add_fields(); + field = scalar_parameter->add_fields(); field->set_key("key_string"); field->set_field_type(::dingodb::pb::common::ScalarFieldType::STRING); field->set_enable_speed_up(false); diff --git a/src/coprocessor/aggregation.h b/src/coprocessor/aggregation.h old mode 100755 new mode 100644 index 419da1eac..57611c7c0 --- a/src/coprocessor/aggregation.h +++ b/src/coprocessor/aggregation.h @@ -37,10 +37,9 @@ class Aggregation { Aggregation(Aggregation&& rhs) = delete; Aggregation& operator=(Aggregation&& rhs) = delete; - butil::Status Open( - size_t start_aggregation_operators_index, - const std::shared_ptr>>& result_serial_schemas, - const ::google::protobuf::RepeatedPtrField& aggregation_operators); + butil::Status Open(size_t start_aggregation_operators_index, + const std::shared_ptr>>& result_serial_schemas, + const ::google::protobuf::RepeatedPtrField& aggregation_operators); butil::Status Execute(const std::vector>& aggregation_functions, const std::vector& group_by_operator_record); diff --git a/src/vector/vector_index_utils.h b/src/vector/vector_index_utils.h index 563317e08..ff917f8af 100644 --- a/src/vector/vector_index_utils.h +++ b/src/vector/vector_index_utils.h @@ -183,7 +183,8 @@ class VectorIndexUtils { const pb::common::VectorIndexParameter& target); static butil::Status ValidateVectorIndexParameter(const pb::common::VectorIndexParameter& vector_index_parameter); - [[deprecated("Use another function with the same name")]] static butil::Status ValidateScalarIndexParameter(const pb::common::ScalarIndexParameter& scalar_index_parameter); + [[deprecated("Use another function with the same name")]] static butil::Status ValidateScalarIndexParameter( + const pb::common::ScalarIndexParameter& scalar_index_parameter); static butil::Status ValidateVectorScalarSchema(const pb::common::ScalarSchema& scalar_schema); diff --git a/test/unit_test/test_vector_index_utils.cc b/test/unit_test/test_vector_index_utils.cc index 8e3c0cd4b..29744c056 100644 --- a/test/unit_test/test_vector_index_utils.cc +++ b/test/unit_test/test_vector_index_utils.cc @@ -772,9 +772,9 @@ TEST_F(VectorIndexUtilsTest, IsNeedToScanKeySpeedUpCF2) { // key empty. error. { vector_scalar_data.Clear(); - //vector_scalar_data.mutable_scalar_data()->insert({"key1", {}}); - //vector_scalar_data.mutable_scalar_data()->insert({"key2", {}}); - //vector_scalar_data.mutable_scalar_data()->insert({"key3", {}}); + // vector_scalar_data.mutable_scalar_data()->insert({"key1", {}}); + // vector_scalar_data.mutable_scalar_data()->insert({"key2", {}}); + // vector_scalar_data.mutable_scalar_data()->insert({"key3", {}}); vector_scalar_data.mutable_scalar_data()->insert({"", {}}); ok = VectorIndexUtils::IsNeedToScanKeySpeedUpCF(scalar_schema, vector_scalar_data, is_need);