Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FlightSQL module docs and links to arrow-flight crates #4012

Merged
merged 6 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions arrow-flight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
//!
//! 2. Low level [tonic] generated [`flight_service_client`] and
//! [`flight_service_server`].
//!
//! 3. Experimental support for [Flight SQL] in [`sql`]. Requires the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to make this not experimental BTW. It's just a struct and impl in a library AFAIK, so it shouldn't hurt anyone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we were just trying to give people the heads up that we would likely be making substantial changes to the API -- but then we do that with other parts of arrow, so maybe the extra "experimental" part is unecessary.

What do you think @tustvold / @viirya -- should we rename the feature flag from experimental (and maybe turn it on by default?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did we get to with an integration test of FlightSQL? I think that would help justify graduating this functionality perhaps?

I'm somewhat apprehensive there may still be areas we have interpreted the specification differently, one was fixed last week. The experimental flag allows us to "fix" such things without needing to preserve backwards compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The experimental flag allows us to "fix" such things without needing to preserve backwards compatibility

Well, I guess I was thinking we break backwards compatibility fairly regularly (as in there are several API changes per release)

So it isn't like I think the flight sql feature is fully ready and the API won't change -- more like I wonder if we should treat it specially from the rest of arrow-flight

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backwards compatibility fairly 

We break Rust API compatibility for sure, protocol compatibility is a different beast imo, as providing an incremental migration story becomes very important for upgrades to actually be possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see -- you are perhaps imagining that the FlightSQL protocol itself may change, not just the rust implementation. The spec is marked as experimental in many places. 🤷

https://github.com/apache/arrow/blob/ad115be1214b13ce393537bdb9c34ae919e4997f/format/FlightSql.proto#LL46

//! `flight-sql-experimental` feature of this crate to be activated.
//!
//! [Flight SQL]: https://arrow.apache.org/docs/format/FlightSql.html
#![allow(rustdoc::invalid_html_tags)]

use arrow_ipc::{convert, writer, writer::EncodedData, writer::IpcWriteOptions};
Expand Down
2 changes: 2 additions & 0 deletions arrow-flight/src/sql/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.

//! A FlightSQL Client [`FlightSqlServiceClient`]

use base64::prelude::BASE64_STANDARD;
use base64::Engine;
use bytes::Bytes;
Expand Down
25 changes: 23 additions & 2 deletions arrow-flight/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@
// specific language governing permissions and limitations
// under the License.

//! Support for execute SQL queries using [Apache Arrow] [Flight SQL].
//!
//! [Flight SQL] is built on top of Arrow Flight RPC framework, by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be easier to read if the link anchors were moved to the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea -- done in 7c8f3e1

//! defining specific messages, encoded using the protobuf format,
//! sent in the[`FlightDescriptor::cmd`] field to [`FlightService`]
//! endpoints such as[`get_flight_info`] and [`do_get`].
//!
//! This module contains:
//! 1. [prost] generated structs for FlightSQL messages such as [`CommandStatementQuery`]
//! 2. Helpers for encoding and decoding FlightSQL messages: [`Any`] and [`Command`]
//! 3. A [`FlightSqlServiceClient`] for interacting with FlightSQL servers.
//! 4. A [`FlightSqlService`] to help building FlightSQL servers from [`FlightService`].
//!
//! [Flight SQL]: https://arrow.apache.org/docs/format/FlightSql.html
//! [Apache Arrow]: https://arrow.apache.org
//! [`FlightDescriptor::cmd`]: crate::FlightDescriptor::cmd
//! [`FlightService`]: crate::flight_service_server::FlightService
//! [`get_flight_info`]: crate::flight_service_server::FlightService::get_flight_info
//! [`do_get`]: crate::flight_service_server::FlightService::do_get
//! [`FlightSqlServiceClient`]: client::FlightSqlServiceClient
//! [`FlightSqlService`]: server::FlightSqlService
use arrow_schema::ArrowError;
use bytes::Bytes;
use paste::paste;
Expand Down Expand Up @@ -90,8 +111,8 @@ macro_rules! prost_message_ext {
)*

as_item! {
/// Helper to convert to/from protobuf [`Any`]
/// to a strongly typed enum.
/// Helper to convert to/from protobuf [`Any`] message
/// to a specific FlightSQL command message.
///
/// # Example
/// ```rust
Expand Down
2 changes: 2 additions & 0 deletions arrow-flight/src/sql/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.

//! Helper trait [`FlightSqlService`] for implementing a [`FlightService`] that implements FlightSQL.

use std::pin::Pin;

use crate::sql::{Any, Command};
Expand Down