MCPcopy Create free account
hub / github.com/apache/arrow-rs / read_record_batch

Function read_record_batch

arrow-ipc/src/reader.rs:767–779  ·  view source on GitHub ↗

Creates a record batch from binary data using the `crate::RecordBatch` indexes and the `Schema`. If `require_alignment` is true, this function will return an error if any array data in the input `buf` is not properly aligned. Under the hood it will use [`arrow_data::ArrayDataBuilder::build`] to construct [`arrow_data::ArrayData`]. If `require_alignment` is false, this function will automatically

(
    buf: &Buffer,
    batch: crate::RecordBatch,
    schema: SchemaRef,
    dictionaries_by_id: &HashMap<i64, ArrayRef>,
    projection: Option<&[usize]>,
    metadata: &MetadataVersion,
)

Source from the content-addressed store, hash-verified

765/// (Properly aligned array data will remain zero-copy.)
766/// Under the hood it will use [`arrow_data::ArrayDataBuilder::align_buffers`] to construct [`arrow_data::ArrayData`].
767pub fn read_record_batch(
768 buf: &Buffer,
769 batch: crate::RecordBatch,
770 schema: SchemaRef,
771 dictionaries_by_id: &HashMap<i64, ArrayRef>,
772 projection: Option<&[usize]>,
773 metadata: &MetadataVersion,
774) -> Result<RecordBatch, ArrowError> {
775 RecordBatchDecoder::try_new(buf, batch, schema, dictionaries_by_id, metadata)?
776 .with_projection(projection)
777 .with_require_alignment(false)
778 .read_record_batch()
779}
780
781/// Read the dictionary from the buffer and provided metadata,
782/// updating the `dictionaries_by_id` with the resulting dictionary

Callers 3

Calls 4

try_newFunction · 0.85
read_record_batchMethod · 0.80
with_projectionMethod · 0.45

Tested by 1