lidavidm commented on code in PR #13986: URL: https://github.com/apache/arrow/pull/13986#discussion_r965234157
########## python/pyarrow/_flight.pyx: ########## @@ -360,13 +410,16 @@ cdef class BasicAuth(_Weakrefable): @staticmethod def deserialize(serialized): auth = BasicAuth() - check_flight_status( - CBasicAuth.Deserialize(serialized).Value(auth.basic_auth.get())) + auth.basic_auth.reset(new CBasicAuth(GetResultValue( + CBasicAuth.Deserialize(tobytes(serialized))))) return auth def serialize(self): return GetResultValue(self.basic_auth.get().SerializeToString()) + def __eq__(self, BasicAuth other): + return self.basic_auth.get() == other.basic_auth.get() Review Comment: Same issue here I think ########## python/pyarrow/_flight.pyx: ########## @@ -327,6 +352,31 @@ cdef class Result(_Weakrefable): """Get the Buffer containing the result.""" return pyarrow_wrap_buffer(self.result.get().body) + 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.result.get().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 Result result = Result.__new__(Result) + result.result.reset(new CFlightResult(GetResultValue( + CFlightResult.Deserialize(tobytes(serialized))))) + return result + + def __eq__(self, Result other): + return self.result.get() == other.result.get() Review Comment: I think this needs to have `dereference` because right now it's probably comparing the pointers ########## python/pyarrow/_flight.pyx: ########## @@ -721,6 +796,28 @@ cdef class SchemaResult(_Weakrefable): check_flight_status(self.result.get().GetSchema(&dummy_memo).Value(&schema)) return pyarrow_wrap_schema(schema) + 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.result.get().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 SchemaResult result = SchemaResult.__new__(SchemaResult) + # result.result.reset(new CSchemaResult(GetResultValue( + # CSchemaResult.Deserialize(tobytes(serialized))))) + # return result Review Comment: Commented code? -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org