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

Function prepare_batch_for_flight

arrow-flight/tests/encode_decode.rs:483–494  ·  view source on GitHub ↗

Workaround for https://github.com/apache/arrow-rs/issues/1206

(
    batch: &RecordBatch,
    schema: SchemaRef,
)

Source from the content-addressed store, hash-verified

481
482/// Workaround for https://github.com/apache/arrow-rs/issues/1206
483fn prepare_batch_for_flight(
484 batch: &RecordBatch,
485 schema: SchemaRef,
486) -> Result<RecordBatch, FlightError> {
487 let columns = batch
488 .columns()
489 .iter()
490 .map(hydrate_dictionary)
491 .collect::<Result<Vec<_>, _>>()?;
492
493 Ok(RecordBatch::try_new(schema, columns)?)
494}
495
496fn hydrate_dictionary(array: &ArrayRef) -> Result<ArrayRef, FlightError> {
497 let arr = if let DataType::Dictionary(_, value) = array.data_type() {

Callers 1

roundtrip_dictionaryFunction · 0.85

Calls 3

try_newFunction · 0.85
iterMethod · 0.45
columnsMethod · 0.45

Tested by

no test coverage detected