pitrou commented on code in PR #36986:
URL: https://github.com/apache/arrow/pull/36986#discussion_r1290425851
##########
python/pyarrow/src/arrow/python/flight.cc:
##########
@@ -383,6 +383,25 @@ Status CreateSchemaResult(const
std::shared_ptr<arrow::Schema>& schema,
return arrow::flight::SchemaResult::Make(*schema).Value(out);
}
+void AsyncGetFlightInfo(arrow::flight::FlightClient* client,
+ const arrow::flight::FlightCallOptions& options,
+ const arrow::flight::FlightDescriptor& descriptor,
+ PyObject* context, AsyncGetFlightInfoCallback
callback) {
+ OwnedRefNoGIL py_context(context);
+ auto future = client->GetFlightInfoAsync(options, descriptor);
+ future.AddCallback([callback, py_context = std::move(py_context)](
+ arrow::Result<arrow::flight::FlightInfo> result) {
+ std::ignore = SafeCallIntoPython([&] {
+ if (result.ok()) {
+ callback(py_context.obj(), &result.ValueOrDie(), result.status());
+ } else {
+ callback(py_context.obj(), nullptr, result.status());
+ }
+ return Status::OK();
Review Comment:
Perhaps this instead, to catch and bubble up the exception neatly?
```suggestion
return CheckPyError();
```
--
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]