quanghgx commented on code in PR #13986:
URL: https://github.com/apache/arrow/pull/13986#discussion_r967672187


##########
python/pyarrow/_flight.pyx:
##########
@@ -289,6 +289,33 @@ cdef class Action(_Weakrefable):
                 type(action)))
         return (<Action> action).action
 
+    def serialize(self):
+        """Get the wire-format representation of this type.
+
+        Useful when interoperating with non-Flight systems (e.g. REST
+        services) that may want to return Flight types.
+
+        """
+        return GetResultValue(self.action.SerializeToString())
+
+    @classmethod
+    def deserialize(cls, serialized):
+        """Parse the wire-format representation of this type.
+
+        Useful when interoperating with non-Flight systems (e.g. REST
+        services) that may want to return Flight types.
+
+        """
+        cdef Action action = Action.__new__(Action)
+        action.action = GetResultValue(
+            CAction.Deserialize(tobytes(serialized)))
+        return action
+
+    def __eq__(self, Action other):
+        # TODO (qhoang): question for myself, do we need to push this down

Review Comment:
   Thank you so much, going to add notes for (1. and 2.) in the MR description.
   
   That's exactly the key point. I was confused by unique_ptr syntax in Cython. 
Frankly, I had to go over a couple of Cython-101 documents specifically for 
this issue.
   
   Thanks once again David.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to