Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
8 changes: 4 additions & 4 deletions dev/release/00-prepare-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ def test_version_pre_tag
hunks: [
["-version = \"#{@snapshot_version}\"",
"+version = \"#{@release_version}\""],
["-arrow = { path = \"../arrow\", version = \"#{@snapshot_version}\" }",
"+arrow = { path = \"../arrow\", version = \"#{@release_version}\" }"],
],
},
{
path: "rust/arrow/Cargo.toml",
hunks: [
["-version = \"#{@snapshot_version}\"",
"+version = \"#{@release_version}\""],
["-arrow-flight = { path = \"../arrow-flight\", optional = true, version = \"#{@snapshot_version}\" }",
"+arrow-flight = { path = \"../arrow-flight\", optional = true, version = \"#{@release_version}\" }"],
],
},
{
Expand Down Expand Up @@ -474,15 +474,15 @@ def test_version_post_tag
hunks: [
["-version = \"#{@release_version}\"",
"+version = \"#{@next_snapshot_version}\""],
["-arrow = { path = \"../arrow\", version = \"#{@release_version}\" }",
"+arrow = { path = \"../arrow\", version = \"#{@next_snapshot_version}\" }"],
],
},
{
path: "rust/arrow/Cargo.toml",
hunks: [
["-version = \"#{@release_version}\"",
"+version = \"#{@next_snapshot_version}\""],
["-arrow-flight = { path = \"../arrow-flight\", optional = true, version = \"#{@release_version}\" }",
"+arrow-flight = { path = \"../arrow-flight\", optional = true, version = \"#{@next_snapshot_version}\" }"],
],
},
{
Expand Down
7 changes: 4 additions & 3 deletions rust/arrow-flight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repository = "https://github.com/apache/arrow"
license = "Apache-2.0"

[dependencies]
arrow = { path = "../arrow", version = "2.0.0-SNAPSHOT" }
tonic = "0.2"
bytes = "0.5"
prost = "0.6"
Expand All @@ -39,6 +40,6 @@ tonic-build = "0.2"
# (and checked in) arrow.flight.protocol.rs from changing
proc-macro2 = "=1.0.18"

[lib]
name = "flight"
path = "src/lib.rs"
#[lib]
#name = "flight"
#path = "src/lib.rs"
9 changes: 7 additions & 2 deletions rust/arrow-flight/examples/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use futures::Stream;
use tonic::transport::Server;
use tonic::{Request, Response, Status, Streaming};

use flight::{
use arrow_flight::{
flight_service_server::FlightService, flight_service_server::FlightServiceServer,
Action, ActionType, Criteria, Empty, FlightData, FlightDescriptor, FlightInfo,
HandshakeRequest, HandshakeResponse, PutResult, SchemaResult, Ticket,
Expand All @@ -42,7 +42,12 @@ impl FlightService for FlightServiceImpl {
type DoPutStream =
Pin<Box<dyn Stream<Item = Result<PutResult, Status>> + Send + Sync + 'static>>;
type DoActionStream = Pin<
Box<dyn Stream<Item = Result<flight::Result, Status>> + Send + Sync + 'static>,
Box<
dyn Stream<Item = Result<arrow_flight::Result, Status>>
+ Send
+ Sync
+ 'static,
>,
>;
type ListActionsStream =
Pin<Box<dyn Stream<Item = Result<ActionType, Status>> + Send + Sync + 'static>>;
Expand Down
6 changes: 2 additions & 4 deletions rust/arrow-flight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// specific language governing permissions and limitations
// under the License.

mod flight {
include!("arrow.flight.protocol.rs");
}
include!("arrow.flight.protocol.rs");

pub use crate::flight::*;
pub mod utils;
12 changes: 6 additions & 6 deletions rust/arrow/src/flight/mod.rs → rust/arrow-flight/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

use std::convert::TryFrom;

use flight::{FlightData, SchemaResult};
use crate::{FlightData, SchemaResult};

use crate::datatypes::{Schema, SchemaRef};
use crate::error::{ArrowError, Result};
use crate::ipc::{convert, reader, writer};
use crate::record_batch::RecordBatch;
use arrow::datatypes::{Schema, SchemaRef};
use arrow::error::{ArrowError, Result};
use arrow::ipc::{convert, reader, writer};
use arrow::record_batch::RecordBatch;

/// Convert a `RecordBatch` to `FlightData` by getting the header and body as bytes
impl From<&RecordBatch> for FlightData {
Expand Down Expand Up @@ -95,7 +95,7 @@ pub fn flight_data_to_batch(
schema: SchemaRef,
) -> Result<Option<RecordBatch>> {
// check that the data_header is a record batch message
let message = crate::ipc::get_root_as_message(&data.data_header[..]);
let message = arrow::ipc::get_root_as_message(&data.data_header[..]);
let dictionaries_by_field = Vec::new();
let batch_header = message.header_as_record_batch().ok_or_else(|| {
ArrowError::ParseError(
Expand Down
4 changes: 1 addition & 3 deletions rust/arrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ packed_simd = { version = "0.3", optional = true }
chrono = "0.4"
flatbuffers = "0.6"
hex = "0.4"
arrow-flight = { path = "../arrow-flight", optional = true, version = "2.0.0-SNAPSHOT" }
prettytable-rs = { version = "0.8.0", optional = true }

[features]
simd = ["packed_simd"]
flight = ["arrow-flight"]
prettyprint = ["prettytable-rs"]
default = ["flight", "prettyprint"]
default = ["prettyprint"]

[dev-dependencies]
criterion = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion rust/arrow/src/ipc/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ fn create_dictionary_array(
}

/// Creates a record batch from binary data using the `ipc::RecordBatch` indexes and the `Schema`
pub(crate) fn read_record_batch(
pub fn read_record_batch(
buf: &[u8],
batch: ipc::RecordBatch,
schema: SchemaRef,
Expand Down
4 changes: 2 additions & 2 deletions rust/arrow/src/ipc/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl<W: Write> Drop for StreamWriter<W> {
}
}

pub(crate) fn schema_to_bytes(schema: &Schema) -> Vec<u8> {
pub fn schema_to_bytes(schema: &Schema) -> Vec<u8> {
let mut fbb = FlatBufferBuilder::new();
let schema = {
let fb = ipc::convert::schema_to_fb_offset(&mut fbb, schema);
Expand Down Expand Up @@ -270,7 +270,7 @@ fn write_padded_data<R: Write>(
}

/// Write a `RecordBatch` into a tuple of bytes, one for the header (ipc::Message) and the other for the batch's data
pub(crate) fn record_batch_to_bytes(batch: &RecordBatch) -> (Vec<u8>, Vec<u8>) {
pub fn record_batch_to_bytes(batch: &RecordBatch) -> (Vec<u8>, Vec<u8>) {
let mut fbb = FlatBufferBuilder::new();

let mut nodes: Vec<ipc::FieldNode> = vec![];
Expand Down
2 changes: 0 additions & 2 deletions rust/arrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ pub mod compute;
pub mod csv;
pub mod datatypes;
pub mod error;
#[cfg(feature = "flight")]
pub mod flight;
#[allow(clippy::redundant_closure)]
#[allow(clippy::needless_lifetimes)]
#[allow(clippy::extra_unused_lifetimes)]
Expand Down
8 changes: 4 additions & 4 deletions rust/datafusion/examples/flight_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ use std::convert::TryFrom;
use std::sync::Arc;

use arrow::datatypes::Schema;
use arrow::flight::flight_data_to_batch;
use arrow::util::pretty;

use flight::flight_descriptor;
use flight::flight_service_client::FlightServiceClient;
use flight::{FlightDescriptor, Ticket};
use arrow_flight::flight_descriptor;
use arrow_flight::flight_service_client::FlightServiceClient;
use arrow_flight::utils::flight_data_to_batch;
use arrow_flight::{FlightDescriptor, Ticket};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
9 changes: 7 additions & 2 deletions rust/datafusion/examples/flight_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use datafusion::datasource::parquet::ParquetTable;
use datafusion::datasource::TableProvider;
use datafusion::execution::context::ExecutionContext;

use flight::{
use arrow_flight::{
flight_service_server::FlightService, flight_service_server::FlightServiceServer,
Action, ActionType, Criteria, Empty, FlightData, FlightDescriptor, FlightInfo,
HandshakeRequest, HandshakeResponse, PutResult, SchemaResult, Ticket,
Expand All @@ -50,7 +50,12 @@ impl FlightService for FlightServiceImpl {
type DoPutStream =
Pin<Box<dyn Stream<Item = Result<PutResult, Status>> + Send + Sync + 'static>>;
type DoActionStream = Pin<
Box<dyn Stream<Item = Result<flight::Result, Status>> + Send + Sync + 'static>,
Box<
dyn Stream<Item = Result<arrow_flight::Result, Status>>
+ Send
+ Sync
+ 'static,
>,
>;
type ListActionsStream =
Pin<Box<dyn Stream<Item = Result<ActionType, Status>> + Send + Sync + 'static>>;
Expand Down