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

Method encode_batch

arrow-flight/src/encode.rs:370–390  ·  view source on GitHub ↗

Encodes batch into one or more `FlightData` messages in self.queue

(&mut self, batch: RecordBatch)

Source from the content-addressed store, hash-verified

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
393impl Stream for FlightDataEncoder {

Callers 1

poll_nextMethod · 0.80

Calls 10

hydrate_dictionariesFunction · 0.85
encode_schemaMethod · 0.80
schema_refMethod · 0.80
queue_messagesMethod · 0.80
queue_messageMethod · 0.80
collectMethod · 0.80
cloneMethod · 0.45
encodeMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected