This is an automated email from the ASF dual-hosted git repository.

felipecrv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new e96c6395ee GH-43331: [C++] Add missing serde methods to Location 
(#43332)
e96c6395ee is described below

commit e96c6395eee87776c59d83a655d951fe04391d7e
Author: Felipe Oliveira Carvalho <[email protected]>
AuthorDate: Fri Jul 19 09:12:49 2024 -0300

    GH-43331: [C++] Add missing serde methods to Location (#43332)
    
    ### Rationale for this change
    
    Completeness and fixing a build issue that only affects MSVC.
    
    ### What changes are included in this PR?
    
    The fix.
    
    ### Are these changes tested?
    
    By existing tests.
    
    Authored-by: Felipe Oliveira Carvalho <[email protected]>
    Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
---
 cpp/src/arrow/flight/serialization_internal.h |  1 +
 cpp/src/arrow/flight/types.cc                 |  8 ++++++++
 cpp/src/arrow/flight/types.h                  | 13 +++++++++++++
 3 files changed, 22 insertions(+)

diff --git a/cpp/src/arrow/flight/serialization_internal.h 
b/cpp/src/arrow/flight/serialization_internal.h
index ffde47d43c..9922cb61ac 100644
--- a/cpp/src/arrow/flight/serialization_internal.h
+++ b/cpp/src/arrow/flight/serialization_internal.h
@@ -94,6 +94,7 @@ Status ToProto(const Result& result, pb::Result* pb_result);
 Status ToProto(const CancelFlightInfoResult& result,
                pb::CancelFlightInfoResult* pb_result);
 Status ToProto(const Criteria& criteria, pb::Criteria* pb_criteria);
+Status ToProto(const Location& location, pb::Location* pb_location);
 Status ToProto(const SchemaResult& result, pb::SchemaResult* pb_result);
 Status ToProto(const Ticket& ticket, pb::Ticket* pb_ticket);
 Status ToProto(const BasicAuth& basic_auth, pb::BasicAuth* pb_basic_auth);
diff --git a/cpp/src/arrow/flight/types.cc b/cpp/src/arrow/flight/types.cc
index 170fbfe239..dc1173ebe1 100644
--- a/cpp/src/arrow/flight/types.cc
+++ b/cpp/src/arrow/flight/types.cc
@@ -775,6 +775,14 @@ bool FlightEndpoint::Equals(const FlightEndpoint& other) 
const {
   return true;
 }
 
+arrow::Status Location::SerializeToString(std::string* out) const {
+  return SerializeToProtoString<pb::Location>("Location", *this, out);
+}
+
+arrow::Status Location::Deserialize(std::string_view serialized, Location* 
out) {
+  return DeserializeProtoString<pb::Location, Location>("Location", 
serialized, out);
+}
+
 arrow::Status FlightEndpoint::SerializeToString(std::string* out) const {
   return SerializeToProtoString<pb::FlightEndpoint>("FlightEndpoint", *this, 
out);
 }
diff --git a/cpp/src/arrow/flight/types.h b/cpp/src/arrow/flight/types.h
index 8061df4dde..bc8e234d97 100644
--- a/cpp/src/arrow/flight/types.h
+++ b/cpp/src/arrow/flight/types.h
@@ -555,6 +555,19 @@ struct ARROW_FLIGHT_EXPORT Location : public 
internal::BaseType<Location> {
 
   bool Equals(const Location& other) const;
 
+  using SuperT::Deserialize;
+  using SuperT::SerializeToString;
+
+  /// \brief Serialize this message to its wire-format representation.
+  ///
+  /// Use `SerializeToString()` if you want a Result-returning version.
+  arrow::Status SerializeToString(std::string* out) const;
+
+  /// \brief Deserialize this message from its wire-format representation.
+  ///
+  /// Use `Deserialize(serialized)` if you want a Result-returning version.
+  static arrow::Status Deserialize(std::string_view serialized, Location* out);
+
  private:
   friend class FlightClient;
   friend class FlightServerBase;

Reply via email to