Skip to content

Commit

Permalink
[chore][format] format vector index code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Haijun Yu committed Apr 15, 2024
1 parent 2d3b5d1 commit 91d444f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion scripts/format_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/client/coordinator_client_function_meta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void SendCreateIndex(std::shared_ptr<dingodb::CoordinatorInteraction> 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);
Expand Down Expand Up @@ -996,12 +996,12 @@ void SendCreateIndex(std::shared_ptr<dingodb::CoordinatorInteraction> 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);
Expand Down
7 changes: 3 additions & 4 deletions src/coprocessor/aggregation.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::vector<std::shared_ptr<BaseSchema>>>& result_serial_schemas,
const ::google::protobuf::RepeatedPtrField<pb::store::AggregationOperator>& aggregation_operators);
butil::Status Open(size_t start_aggregation_operators_index,
const std::shared_ptr<std::vector<std::shared_ptr<BaseSchema>>>& result_serial_schemas,
const ::google::protobuf::RepeatedPtrField<pb::store::AggregationOperator>& aggregation_operators);

butil::Status Execute(const std::vector<std::function<bool(const std::any&, std::any*)>>& aggregation_functions,
const std::vector<std::any>& group_by_operator_record);
Expand Down
2 changes: 1 addition & 1 deletion src/vector/vector_index_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void LoadAsyncBuildVectorIndexTask::Run() {
// Pull snapshot from peers.
// New region don't pull snapshot, directly build.
auto raft_meta = Server::GetInstance().GetRaftMeta(vector_index_wrapper_->Id());
int64_t applied_index = (raft_meta != nullptr) ? raft_meta->AppliedId() : -1;
int64_t applied_index = (raft_meta != nullptr) ? raft_meta->AppliedId() : -1;

if (region->Epoch().version() > 1 || applied_index > FLAGS_vector_pull_snapshot_min_log_gap) {
auto snapshot_set = vector_index_wrapper_->SnapshotSet();
Expand Down
3 changes: 2 additions & 1 deletion src/vector/vector_index_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions test/unit_test/test_vector_index_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 91d444f

Please sign in to comment.