From c89b6ccd88ea022faf61f956755c9a76ba7ade7d Mon Sep 17 00:00:00 2001 From: ml-metadata-team Date: Mon, 18 Dec 2023 15:33:51 -0800 Subject: [PATCH] fix the OSS dependency issue PiperOrigin-RevId: 592028309 --- ml_metadata/metadata_store/BUILD | 2 -- .../metadata_store_test_suite.cc | 29 +++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/ml_metadata/metadata_store/BUILD b/ml_metadata/metadata_store/BUILD index b923b295b..21031d621 100644 --- a/ml_metadata/metadata_store/BUILD +++ b/ml_metadata/metadata_store/BUILD @@ -459,7 +459,6 @@ cc_library( ":test_util", ":types", "@com_google_googletest//:gtest", - "@com_google_absl//absl/algorithm:container", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", @@ -468,7 +467,6 @@ cc_library( "//ml_metadata/proto:metadata_store_proto", "//ml_metadata/proto:metadata_store_service_proto", "//ml_metadata/simple_types/proto:simple_types_proto", - "//third_party/protobuf:protobuf_lite", ], ) diff --git a/ml_metadata/metadata_store/metadata_store_test_suite.cc b/ml_metadata/metadata_store/metadata_store_test_suite.cc index 8b26b8fa5..ca670e626 100644 --- a/ml_metadata/metadata_store/metadata_store_test_suite.cc +++ b/ml_metadata/metadata_store/metadata_store_test_suite.cc @@ -24,7 +24,6 @@ limitations under the License. #include #include -#include "absl/algorithm/container.h" #include "absl/status/status.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" @@ -40,7 +39,6 @@ limitations under the License. #include "ml_metadata/proto/metadata_store.pb.h" #include "ml_metadata/proto/metadata_store_service.pb.h" #include "ml_metadata/simple_types/proto/simple_types.pb.h" -#include "google/protobuf/repeated_ptr_field.h" namespace ml_metadata { namespace testing { @@ -104,8 +102,9 @@ template <> void InsertNodeAndSetNodeID(MetadataStore* metadata_store, std::vector& nodes) { PutArtifactsRequest put_nodes_request; - absl::c_copy(nodes, google::protobuf::RepeatedFieldBackInserter( - put_nodes_request.mutable_artifacts())); + for (const Artifact& artifact : nodes) { + *put_nodes_request.add_artifacts() = artifact; + } PutArtifactsResponse put_nodes_response; ASSERT_EQ(absl::OkStatus(), metadata_store->PutArtifacts( put_nodes_request, &put_nodes_response)); @@ -118,8 +117,9 @@ template <> void InsertNodeAndSetNodeID(MetadataStore* metadata_store, std::vector& nodes) { PutExecutionsRequest put_nodes_request; - absl::c_copy(nodes, google::protobuf::RepeatedFieldBackInserter( - put_nodes_request.mutable_executions())); + for (const Execution& execution : nodes) { + *put_nodes_request.add_executions() = execution; + } PutExecutionsResponse put_nodes_response; ASSERT_EQ(absl::OkStatus(), metadata_store->PutExecutions( put_nodes_request, &put_nodes_response)); @@ -132,8 +132,9 @@ template <> void InsertNodeAndSetNodeID(MetadataStore* metadata_store, std::vector& nodes) { PutContextsRequest put_nodes_request; - absl::c_copy(nodes, google::protobuf::RepeatedFieldBackInserter( - put_nodes_request.mutable_contexts())); + for (const Context& context : nodes) { + *put_nodes_request.add_contexts() = context; + } PutContextsResponse put_nodes_response; ASSERT_EQ(absl::OkStatus(), metadata_store->PutContexts(put_nodes_request, &put_nodes_response)); @@ -6742,14 +6743,18 @@ TEST_P(MetadataStoreTestSuite, // Verifies the parent/child contexts by looking up and stored result. GetParentContextsByContextsRequest get_parents_request; - absl::c_copy(context_ids, google::protobuf::RepeatedFieldBackInserter( - get_parents_request.mutable_context_ids())); + get_parents_request.mutable_context_ids()->Reserve(context_ids.size()); + for (const int64_t context_id : context_ids) { + get_parents_request.add_context_ids(context_id); + } GetParentContextsByContextsResponse get_parents_response; ASSERT_EQ(absl::OkStatus(), metadata_store_->GetParentContextsByContexts( get_parents_request, &get_parents_response)); GetChildrenContextsByContextsRequest get_children_request; - absl::c_copy(context_ids, google::protobuf::RepeatedFieldBackInserter( - get_children_request.mutable_context_ids())); + get_children_request.mutable_context_ids()->Reserve(context_ids.size()); + for (const int64_t context_id : context_ids) { + get_children_request.add_context_ids(context_id); + } GetChildrenContextsByContextsResponse get_children_response; ASSERT_EQ(metadata_store_->GetChildrenContextsByContexts( get_children_request, &get_children_response),