This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f1a223
commit 1dad93f
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use arrow2::array::Array; | ||
use arrow2::chunk::Chunk; | ||
use arrow2::datatypes::Schema; | ||
use arrow2::error::Error; | ||
|
||
use arrow2::io::flight::*; | ||
use arrow2::io::ipc::write::{default_ipc_fields, WriteOptions}; | ||
|
||
use super::ipc::read_gzip_json; | ||
|
||
fn round_trip(schema: Schema, chunk: Chunk<Box<dyn Array>>) -> Result<(), Error> { | ||
let fields = default_ipc_fields(&schema.fields); | ||
let serialized = serialize_schema(&schema, Some(&fields)); | ||
let (result, ipc_schema) = deserialize_schemas(&serialized.data_header)?; | ||
assert_eq!(schema, result); | ||
|
||
let (_, batch) = serialize_batch(&chunk, &fields, &WriteOptions { compression: None })?; | ||
|
||
let result = deserialize_batch(&batch, &result.fields, &ipc_schema, &Default::default())?; | ||
assert_eq!(result, chunk); | ||
Ok(()) | ||
} | ||
|
||
#[test] | ||
fn generated_nested_dictionary() -> Result<(), Error> { | ||
let (schema, _, mut batches) = | ||
read_gzip_json("1.0.0-littleendian", "generated_nested").unwrap(); | ||
|
||
round_trip(schema, batches.pop().unwrap())?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,6 @@ mod avro; | |
feature = "io_csv_read_async" | ||
))] | ||
mod csv; | ||
|
||
#[cfg(feature = "io_flight")] | ||
mod flight; |