From af647bbc431193de45973b11e3430e4b85d8e28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Thu, 4 Jul 2024 18:03:08 +0800 Subject: [PATCH] Add FlightSqlServiceClient::new_from_inner --- 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 c01f20e0541..df5c1767689 100644 --- a/arrow-flight/src/sql/client.rs +++ b/arrow-flight/src/sql/client.rs @@ -69,10 +69,14 @@ pub struct FlightSqlServiceClient { impl FlightSqlServiceClient { /// 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) -> Self { + Self { token: None, - flight_client, + flight_client: inner, headers: HashMap::default(), } }