Path: blob/main/crates/polars-arrow/src/io/avro/write/mod.rs
6940 views
//! APIs to write to Avro format.1use avro_schema::file::Block;23mod schema;4pub use schema::to_record;5mod serialize;6pub use serialize::{BoxSerializer, can_serialize, new_serializer};78/// consumes a set of [`BoxSerializer`] into an [`Block`].9/// # Panics10/// Panics iff the number of items in any of the serializers is not equal to the number of rows11/// declared in the `block`.12pub fn serialize(serializers: &mut [BoxSerializer], block: &mut Block) {13let Block {14data,15number_of_rows,16} = block;1718data.clear(); // restart it1920// _the_ transpose (columns -> rows)21for _ in 0..*number_of_rows {22for serializer in &mut *serializers {23let item_data = serializer.next().unwrap();24data.extend(item_data);25}26}27}282930