Jefffrey commented on code in PR #5413:
URL: https://github.com/apache/arrow-rs/pull/5413#discussion_r1495696496


##########
arrow-flight/src/lib.rs:
##########
@@ -472,9 +547,6 @@ impl FlightInfo {
     ///   // Encode the Arrow schema
     ///   .try_with_schema(&get_schema())
     ///   .expect("encoding failed")
-    ///   .with_descriptor(
-    ///      FlightDescriptor::new_cmd("a command")
-    ///   )

Review Comment:
   Since was also calling `with_descriptor(...)` again below



##########
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:
   Thoughts on this? Since `close()` doesn't exactly close anything at the 
moment, so maybe better to force closure via taking self



##########
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:
   Wasn't sure if to add these to the SQL client & server as well? Maybe in a 
followup PR to keep size down?



-- 
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