kou commented on code in PR #36009:
URL: https://github.com/apache/arrow/pull/36009#discussion_r1228899238
##########
cpp/src/arrow/flight/client.cc:
##########
@@ -569,6 +569,36 @@ Status FlightClient::DoAction(const FlightCallOptions&
options, const Action& ac
return DoAction(options, action).Value(results);
}
+arrow::Result<std::unique_ptr<ActionCancelFlightInfoResult>>
+FlightClient::CancelFlightInfo(const FlightCallOptions& options, const
FlightInfo& info) {
+ ARROW_ASSIGN_OR_RAISE(auto body, info.SerializeToString());
+ Action action{ActionType::kCancelFlightInfo.type, Buffer::FromString(body)};
+ ARROW_ASSIGN_OR_RAISE(auto stream, DoAction(options, action));
+ ARROW_ASSIGN_OR_RAISE(auto result, stream->Next());
Review Comment:
It makes sense.
I've added `ResultStream::Drain()`.
I noticed that we may not need to share `ReadResult()`. Why all `DoAction`
results in Flight SQL wraps result message by `google.protobuf.Any`? Can we put
`FlightInfo`/`FlightEndpoint` to `Result.body` directly?
If we need to wrap `FlightInfo`/`FlightEndpoint` by `google.protobuf.Any`,
servers that implement
`CancelFlightInfo`/`CloseFlightInfo`/`RefreshFlightEndpoint` need to use
Protobuf headers. I think that we want to avoid it.
(We can avoid it by adding
`ServerBase::{CancelFlightInfo,CloseFlightInfo,RefreshFlightEndpoint}` like
`FlightSqlServerBase` but providing the default
`ServerBase::{DoAction,ListActions}` with
`CancelFlightInfo`/`CloseFlightInfo`/`RefreshFlightEndpoint` may not be a good
idea...)
##########
format/Flight.proto:
##########
@@ -189,6 +191,31 @@ message Result {
bytes body = 1;
}
+/*
+ * The result of the CancelFlightInfo action.
+ *
+ * The result should be stored in Result.body.
+ */
+message ActionCancelFlightInfoResult {
Review Comment:
OK. I've removed `Action`.
##########
format/Flight.proto:
##########
@@ -189,6 +191,31 @@ message Result {
bytes body = 1;
}
+/*
+ * The result of the CancelFlightInfo action.
+ *
+ * The result should be stored in Result.body.
+ */
+message ActionCancelFlightInfoResult {
+ enum CancelResult {
Review Comment:
Oh...
##########
format/Flight.proto:
##########
@@ -189,6 +191,31 @@ message Result {
bytes body = 1;
}
+/*
+ * The result of the CancelFlightInfo action.
+ *
+ * The result should be stored in Result.body.
+ */
+message ActionCancelFlightInfoResult {
+ enum CancelResult {
+ // The cancellation status is unknown. Servers should avoid using
+ // this value (send a NOT_FOUND error if the requested query is
+ // not known). Clients can retry the request.
+ CANCEL_RESULT_UNSPECIFIED = 0;
Review Comment:
I moved `CancelResult` to top-level to reduce
`ActionCancelFlightInfoResult::...` prefix.
Is it OK?
##########
format/Flight.proto:
##########
@@ -189,6 +191,31 @@ message Result {
bytes body = 1;
}
+/*
+ * The result of the CancelFlightInfo action.
+ *
+ * The result should be stored in Result.body.
+ */
+message ActionCancelFlightInfoResult {
+ enum CancelResult {
+ // The cancellation status is unknown. Servers should avoid using
+ // this value (send a NOT_FOUND error if the requested query is
+ // not known). Clients can retry the request.
+ CANCEL_RESULT_UNSPECIFIED = 0;
Review Comment:
Can we use `CancelStatus` or something instead of `CancelResult` to use
`Result` in `CancelResult` and `ActionCancelFlightInfoResult`?
--
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]