Workaround for https://github.com/apache/arrow-rs/issues/1206
(
batch: &RecordBatch,
schema: SchemaRef,
)
| 481 | |
| 482 | /// Workaround for https://github.com/apache/arrow-rs/issues/1206 |
| 483 | fn 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 | |
| 496 | fn hydrate_dictionary(array: &ArrayRef) -> Result<ArrayRef, FlightError> { |
| 497 | let arr = if let DataType::Dictionary(_, value) = array.data_type() { |
no test coverage detected