This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new a85768db9f Add FlightSqlServiceClient::new_from_inner (#6003)
a85768db9f is described below

commit a85768db9f99c637751e4938bda0351ea3011fe2
Author: 张林伟 <[email protected]>
AuthorDate: Sat Jul 6 20:07:30 2024 +0800

    Add FlightSqlServiceClient::new_from_inner (#6003)
---
 arrow-flight/src/sql/client.rs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arrow-flight/src/sql/client.rs b/arrow-flight/src/sql/client.rs
index c01f20e054..df5c176768 100644
--- a/arrow-flight/src/sql/client.rs
+++ b/arrow-flight/src/sql/client.rs
@@ -69,10 +69,14 @@ pub struct FlightSqlServiceClient<T> {
 impl FlightSqlServiceClient<Channel> {
     /// Creates a new FlightSql client that connects to a server over an 
arbitrary tonic `Channel`
     pub fn new(channel: Channel) -> Self {
-        let flight_client = FlightServiceClient::new(channel);
-        FlightSqlServiceClient {
+        Self::new_from_inner(FlightServiceClient::new(channel))
+    }
+
+    /// Creates a new higher level client with the provided lower level client
+    pub fn new_from_inner(inner: FlightServiceClient<Channel>) -> Self {
+        Self {
             token: None,
-            flight_client,
+            flight_client: inner,
             headers: HashMap::default(),
         }
     }

Reply via email to