lidavidm commented on a change in pull request #12659:
URL: https://github.com/apache/arrow/pull/12659#discussion_r830267707



##########
File path: python/pyarrow/_flight.pyx
##########
@@ -1707,16 +1735,26 @@ cdef class ClientAuthSender(_Weakrefable):
         return result
 
 
-cdef CStatus _data_stream_next(void* self, CFlightPayload* payload) except *:
+cdef CStatus _data_stream_next(void* c_state,
+                               CFlightPayload* payload) except *:
     """Callback for implementing FlightDataStream in Python."""
+    server_state = <object> c_state
+    try:
+        if not isinstance(server_state.this, GeneratorStream):
+            raise RuntimeError(
+                "self object in callback is not GeneratorStream")
+        stream = <GeneratorStream> server_state.this
+        return _data_stream_do_next(stream, server_state, payload)
+    except Exception as e:
+        server_state.log_exception("do_get", e)

Review comment:
       Yes, basically DoGet returns a Stream and the Stream is consumed by the 
C++ side to finish off the call. So this is still within the DoGet RPC even if 
control flow is outside the Cython do_get 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: [email protected]

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


Reply via email to