Skip to main content

adapt_batch_to_schema

Function adapt_batch_to_schema 

Source
pub fn adapt_batch_to_schema(
    batch: RecordBatch,
    target_schema: &SchemaRef,
) -> Result<RecordBatch>
Expand description

Adapts a RecordBatch to conform to target_schema, verifying that each target field type contains the incoming column data type (as verified by arrow::datatypes::DataType::contains) and transforms the metadata/types of differing columns to match target_schema without copying primitive buffer data.

If batch has an incompatible column count or incompatible column data types, an error is returned.