Skip to main content

polars_arrow/io/ipc/read/
mod.rs

1//! APIs to read Arrow's IPC format.
2//!
3//! The two important File-based structs here are the [`FileReader`](reader::FileReader),
4//! which provides arbitrary access to any of its messages, and the
5//! [`StreamReader`](stream::StreamReader), which only supports reading
6//! data in the order it was written in.
7//! In addition, there is a Block-based struct [`BlockReader`](reader::BlockReader), which
8//! enabled random access to a standalone IPC Block.
9use crate::array::Array;
10
11mod array;
12pub mod common;
13mod deserialize;
14mod error;
15pub(crate) mod file;
16#[cfg(feature = "io_flight")]
17mod flight;
18mod read_basic;
19mod reader;
20mod schema;
21mod stream;
22
23pub(crate) use common::first_dict_field;
24pub use common::{ProjectionInfo, prepare_projection};
25pub use error::OutOfSpecKind;
26pub use file::{
27    FileMetadata, deserialize_footer, get_row_count, get_row_count_from_blocks, read_batch,
28    read_dictionary_block, read_file_dictionaries, read_file_metadata,
29};
30use polars_utils::aliases::PlHashMap;
31pub use reader::{BlockReader, FileReader};
32pub use schema::deserialize_schema;
33pub use stream::{StreamMetadata, StreamReader, StreamState, read_stream_metadata};
34
35/// how dictionaries are tracked in this crate
36pub type Dictionaries = PlHashMap<i64, Box<dyn Array>>;
37
38pub(crate) type Node<'a> = arrow_format::ipc::FieldNodeRef<'a>;
39pub(crate) type IpcBuffer<'a> = arrow_format::ipc::BufferRef<'a>;
40pub(crate) type Compression<'a> = arrow_format::ipc::BodyCompressionRef<'a>;
41pub(crate) type Version = arrow_format::ipc::MetadataVersion;
42
43#[cfg(feature = "io_flight")]
44pub use flight::*;
45
46pub trait SendableIterator: Send + Iterator {}
47
48impl<T: Iterator + Send> SendableIterator for T {}