Path: blob/main/crates/polars-arrow/src/io/ipc/read/array/mod.rs
6940 views
mod primitive;12use std::collections::VecDeque;34pub use primitive::*;5mod boolean;6pub use boolean::*;7mod utf8;8pub use utf8::*;9mod binary;10pub use binary::*;11mod fixed_size_binary;12pub use fixed_size_binary::*;13mod list;14pub use list::*;15mod fixed_size_list;16pub use fixed_size_list::*;17mod struct_;18pub use struct_::*;19mod null;20pub use null::*;21mod dictionary;22pub use dictionary::*;23mod union;24pub use union::*;25mod binview;26mod map;27pub use binview::*;28pub use map::*;29use polars_error::{PolarsResult, *};3031use super::{Compression, IpcBuffer, Node, OutOfSpecKind};32use crate::datatypes::ArrowDataType;3334fn try_get_field_node<'a>(35field_nodes: &mut VecDeque<Node<'a>>,36dtype: &ArrowDataType,37) -> PolarsResult<Node<'a>> {38field_nodes.pop_front().ok_or_else(|| {39polars_err!(ComputeError: "IPC: unable to fetch the field for {:?}\n\nThe file or stream is corrupted.", dtype)40})41}4243fn try_get_array_length(field_node: Node, limit: Option<usize>) -> PolarsResult<usize> {44let length: usize = field_node45.length()46.try_into()47.map_err(|_| polars_err!(oos = OutOfSpecKind::NegativeFooterLength))?;48Ok(limit.map(|limit| limit.min(length)).unwrap_or(length))49}505152