Encodes batch into one or more `FlightData` messages in self.queue
(&mut self, batch: RecordBatch)
| 368 | |
| 369 | /// Encodes batch into one or more `FlightData` messages in self.queue |
| 370 | fn encode_batch(&mut self, batch: RecordBatch) -> Result<()> { |
| 371 | let schema = match &self.schema { |
| 372 | Some(schema) => schema.clone(), |
| 373 | // encode the schema if this is the first time we have seen it |
| 374 | None => self.encode_schema(batch.schema_ref()), |
| 375 | }; |
| 376 | |
| 377 | let batch = match self.dictionary_handling { |
| 378 | DictionaryHandling::Resend => batch, |
| 379 | DictionaryHandling::Hydrate => hydrate_dictionaries(&batch, schema)?, |
| 380 | }; |
| 381 | |
| 382 | for batch in split_batch_for_grpc_response(batch, self.max_flight_data_size) { |
| 383 | let (flight_dictionaries, flight_batch) = self.encoder.encode_batch(&batch)?; |
| 384 | |
| 385 | self.queue_messages(flight_dictionaries); |
| 386 | self.queue_message(flight_batch); |
| 387 | } |
| 388 | |
| 389 | Ok(()) |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | impl Stream for FlightDataEncoder { |
no test coverage detected