diff --git a/arrow-flight/Cargo.toml b/arrow-flight/Cargo.toml index fbb295036a9b..25c1fdba8388 100644 --- a/arrow-flight/Cargo.toml +++ b/arrow-flight/Cargo.toml @@ -78,6 +78,7 @@ tracing-log = { version = "0.2" } tracing-subscriber = { version = "0.3.1", default-features = false, features = ["ansi", "env-filter", "fmt"] } tokio = { version = "1.0", default-features = false, features = ["macros", "rt", "rt-multi-thread"] } tokio-stream = { version = "0.1", features = ["net"] } +tonic-reflection = "0.12.3" tower = { version = "0.5.0", features = ["util"] } uuid = { version = "1.10.0", features = ["v4"] } diff --git a/arrow-flight/gen/src/main.rs b/arrow-flight/gen/src/main.rs index a69134e7acbe..afa948fec0bd 100644 --- a/arrow-flight/gen/src/main.rs +++ b/arrow-flight/gen/src/main.rs @@ -29,6 +29,7 @@ fn main() -> Result<(), Box> { // protoc in Ubuntu builder needs this option .protoc_arg("--experimental_allow_proto3_optional") .out_dir("src") + .file_descriptor_set_path("src/flight_descriptor.bin") .compile_protos_with_config(prost_config(), &[proto_path], &[proto_dir])?; // read file contents to string @@ -52,6 +53,7 @@ fn main() -> Result<(), Box> { // protoc in Ubuntu builder needs this option .protoc_arg("--experimental_allow_proto3_optional") .out_dir("src/sql") + .file_descriptor_set_path("src/sql/flight_sql_descriptor.bin") .compile_protos_with_config(prost_config(), &[proto_path], &[proto_dir])?; // read file contents to string diff --git a/arrow-flight/src/flight_descriptor.bin b/arrow-flight/src/flight_descriptor.bin new file mode 100644 index 000000000000..06460116bb41 Binary files /dev/null and b/arrow-flight/src/flight_descriptor.bin differ diff --git a/arrow-flight/src/lib.rs b/arrow-flight/src/lib.rs index 1dd2700794f3..f63332cf2407 100644 --- a/arrow-flight/src/lib.rs +++ b/arrow-flight/src/lib.rs @@ -58,12 +58,24 @@ mod gen { // Since this file is auto-generated, we suppress all warnings #![allow(missing_docs)] include!("arrow.flight.protocol.rs"); + + /// The descriptor used for making the Arrow Flight gRPC API available for [gRPC + /// reflection](https://grpc.io/docs/guides/reflection/). + /// + /// ``` + /// let reflection_server = tonic_reflection::server::Builder::configure() + /// .register_encoded_file_descriptor_set(arrow_flight::flight_descriptor::FILE_DESCRIPTOR_SET) + /// .build_v1() + /// .unwrap(); + /// ``` + pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("flight_descriptor.bin"); } /// Defines a `Flight` for generation or retrieval. pub mod flight_descriptor { use super::gen; pub use gen::flight_descriptor::DescriptorType; + pub use gen::FILE_DESCRIPTOR_SET; } /// Low Level [tonic] [`FlightServiceClient`](gen::flight_service_client::FlightServiceClient). diff --git a/arrow-flight/src/sql/flight_sql_descriptor.bin b/arrow-flight/src/sql/flight_sql_descriptor.bin new file mode 100644 index 000000000000..49360ac42a0b Binary files /dev/null and b/arrow-flight/src/sql/flight_sql_descriptor.bin differ diff --git a/arrow-flight/src/sql/mod.rs b/arrow-flight/src/sql/mod.rs index 94bb96a4f852..65405a313a73 100644 --- a/arrow-flight/src/sql/mod.rs +++ b/arrow-flight/src/sql/mod.rs @@ -49,6 +49,17 @@ mod gen { // Since this file is auto-generated, we suppress all warnings #![allow(missing_docs)] include!("arrow.flight.protocol.sql.rs"); + + /// The descriptor used for making the Arrow Flight SQL gRPC API available for [gRPC + /// reflection](https://grpc.io/docs/guides/reflection/). + /// + /// ``` + /// let reflection_server = tonic_reflection::server::Builder::configure() + /// .register_encoded_file_descriptor_set(arrow_flight::sql::FILE_DESCRIPTOR_SET) + /// .build_v1() + /// .unwrap(); + /// ``` + pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("flight_sql_descriptor.bin"); } pub use gen::action_end_transaction_request::EndTransaction; @@ -109,6 +120,7 @@ pub use gen::TicketStatementQuery; pub use gen::UpdateDeleteRules; pub use gen::XdbcDataType; pub use gen::XdbcDatetimeSubcode; +pub use gen::FILE_DESCRIPTOR_SET; pub mod client; pub mod metadata;