crepererum commented on code in PR #5413:
URL: https://github.com/apache/arrow-rs/pull/5413#discussion_r1499327584
##########
arrow-flight/src/sql/client.rs:
##########
@@ -391,6 +391,7 @@ impl FlightSqlServiceClient<Channel> {
/// Explicitly shut down and clean up the client.
pub async fn close(&mut self) -> Result<(), ArrowError> {
+ // TODO: consume self instead of &mut self to explicitly prevent reuse?
Review Comment:
I agree that `close` should be consuming :+1:
Let's do that in a follow-up PR though.
##########
arrow-flight/src/client.rs:
##########
@@ -540,6 +602,82 @@ impl FlightClient {
Ok(result_stream.boxed())
}
+ /// Make a `CancelFlightInfo` call to the server and return
+ /// a [`CancelFlightInfoResult`].
+ ///
+ /// # Example:
+ /// ```no_run
+ /// # async fn run() {
+ /// # use arrow_flight::{CancelFlightInfoRequest, FlightClient,
FlightDescriptor};
+ /// # let channel: tonic::transport::Channel = unimplemented!();
+ /// let mut client = FlightClient::new(channel);
+ ///
+ /// // Send a 'CMD' request to the server
+ /// let request = FlightDescriptor::new_cmd(b"MOAR DATA".to_vec());
+ /// let flight_info = client
+ /// .get_flight_info(request)
+ /// .await
+ /// .expect("error handshaking");
+ ///
+ /// // Cancel the query
+ /// let request = CancelFlightInfoRequest::new(flight_info);
+ /// let result = client
+ /// .cancel_flight_info(request)
+ /// .await
+ /// .expect("error cancelling");
+ /// # }
+ /// ```
+ pub async fn cancel_flight_info(
+ &mut self,
+ request: CancelFlightInfoRequest,
+ ) -> Result<CancelFlightInfoResult> {
+ let action = Action::new("CancelFlightInfo", request.encode_to_vec());
+ let response = self.do_action(action).await?.try_next().await?;
+ let response = response.ok_or(FlightError::protocol(
+ "Received no response for cancel_flight_info call",
+ ))?;
+ CancelFlightInfoResult::decode(response)
+ .map_err(|e| FlightError::DecodeError(e.to_string()))
+ }
+
+ /// Make a `RenewFlightEndpoint` call to the server and return
+ /// the renewed [`FlightEndpoint`].
+ ///
+ /// # Example:
+ /// ```no_run
+ /// # async fn run() {
+ /// # use arrow_flight::{FlightClient, FlightDescriptor,
RenewFlightEndpointRequest};
+ /// # let channel: tonic::transport::Channel = unimplemented!();
+ /// let mut client = FlightClient::new(channel);
+ ///
+ /// // Send a 'CMD' request to the server
+ /// let request = FlightDescriptor::new_cmd(b"MOAR DATA".to_vec());
+ /// let flight_endpoint = client
+ /// .get_flight_info(request)
+ /// .await
+ /// .expect("error handshaking")
+ /// .endpoint[0];
+ ///
+ /// // Renew the endpoint
+ /// let request = RenewFlightEndpointRequest::new(flight_endpoint);
+ /// let flight_endpoint = client
+ /// .renew_flight_endpoint(request)
+ /// .await
+ /// .expect("error renewing");
+ /// # }
+ /// ```
+ pub async fn renew_flight_endpoint(
+ &mut self,
+ request: RenewFlightEndpointRequest,
+ ) -> Result<FlightEndpoint> {
+ let action = Action::new("RenewFlightEndpoint",
request.encode_to_vec());
+ let response = self.do_action(action).await?.try_next().await?;
+ let response = response.ok_or(FlightError::protocol(
+ "Received no response for renew_flight_endpoint call",
+ ))?;
+ FlightEndpoint::decode(response).map_err(|e|
FlightError::DecodeError(e.to_string()))
Review Comment:
yes, I think the SQL interface should support this feature as well. Let's
keep that out of this PR though.
--
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]