tustvold commented on code in PR #3948:
URL: https://github.com/apache/arrow-rs/pull/3948#discussion_r1152026535
##########
arrow-flight/src/sql/client.rs:
##########
@@ -223,6 +223,47 @@ impl FlightSqlServiceClient {
.into_inner())
}
+ /// Push a stream to the flight service associated with a particular
flight stream.
+ pub async fn do_put(
+ &mut self,
+ request: impl tonic::IntoStreamingRequest<Message = FlightData>,
+ ) -> Result<Streaming<PutResult>, ArrowError> {
+ let req = self.set_request_headers(request.into_streaming_request())?;
+ Ok(self
+ .flight_client
+ .do_put(req)
+ .await
+ .map_err(status_to_arrow_error)?
+ .into_inner())
+ }
+
+ /// DoAction allows a flight client to do a specific action against a
flight service
+ pub async fn do_action(
+ &mut self,
+ request: impl IntoRequest<Action>,
+ ) -> Result<Streaming<crate::Result>, ArrowError> {
+ let req = self.set_request_headers(request.into_request())?;
+ Ok(self
+ .flight_client
+ .do_action(req)
+ .await
+ .map_err(status_to_arrow_error)?
+ .into_inner())
+ }
+
+ async fn get_flight_info(
Review Comment:
Is it worth modifying `get_flight_info_for_command` to call this method?
##########
arrow-flight/examples/flight_sql_server.rs:
##########
@@ -573,6 +596,7 @@ mod tests {
let channel = endpoint.connect().await.unwrap();
let mut client = FlightSqlServiceClient::new(channel);
let token = client.handshake("admin", "password").await.unwrap();
+ client.set_token(String::from_utf8(token.to_vec()).unwrap());
Review Comment:
Is it worth adding a test that not setting this token or setting it to an
invalid token results in an error?
##########
arrow-flight/src/sql/client.rs:
##########
@@ -223,6 +223,47 @@ impl FlightSqlServiceClient {
.into_inner())
}
+ /// Push a stream to the flight service associated with a particular
flight stream.
+ pub async fn do_put(
+ &mut self,
+ request: impl tonic::IntoStreamingRequest<Message = FlightData>,
+ ) -> Result<Streaming<PutResult>, ArrowError> {
+ let req = self.set_request_headers(request.into_streaming_request())?;
+ Ok(self
+ .flight_client
+ .do_put(req)
+ .await
+ .map_err(status_to_arrow_error)?
+ .into_inner())
+ }
+
+ /// DoAction allows a flight client to do a specific action against a
flight service
+ pub async fn do_action(
+ &mut self,
+ request: impl IntoRequest<Action>,
Review Comment:
```suggestion
request: Action,
```
This seems to be more consistent with the other methods, perhaps? Although I
appreciate it does potentially lose the ability to set request options outside
of the client
--
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]