Skip to content

Implement Basic FlightSQL Client #1413

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
The Arrow Flight SQL protocol makes use of protobuf.Any which is somewhat messy to use in Rust, meaning implementing FlightSQL clients in Rust is somewhat messy

@wangfenjin implemented a FlightSqlServer trait to assist with the server side of this in #1386. It would be nice to implement the equivalent on the client side.

Describe the solution you'd like
To make it easier for people to write flight SQL clients and servers, it would be nice if the arrow-rs crate provided a trait that handled the Any conversion.

Perhaps we can als include an flight_sql_client.cpp inspiration from @lidavidm 's https://github.com/apache/arrow/blob/master/cpp/examples/arrow/flight_sql_example.cc in the cpp implementation, as shown in wangfenjin/arrow-datafusion#1

Something like

pub struct FlightSqlClient { .. }

impl FlightSqlClient {
    /// Creates a new client with the provided connection
    pub fn new(channel: Connection) -> Self {
      .. 
    }

    /// Do the appropriate requests of
    /// `DoPut` to send `CommandStatementQuery` and then call `GetFlightInfo` to get back the stream of results
    async fn query(
        &mut self,
        query: CommandStatementQuery,
        request: FlightDescriptor,
    ) -> Result<SendableRecordBatchStream, Status>;

 ... probably other things
}

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
See server implementation here #1386

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrow-flightChanges to the arrow-flight crateenhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions