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


##########
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:
   1. Don't think so
   2. If it's not in Python then don't add it
   3. What exactly does not work, how does it fail, what have you tried? It 
seems the definition of Result is slightly off, it should dereference these 
before comparison, because right now it's comparing the pointers not the 
values: 
https://github.com/apache/arrow/blob/03e204c731186e133b41fdbfdfa896da5404a819/python/pyarrow/_flight.pyx#L377-L378
   



-- 
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