alamb commented on issue #3674:
URL: https://github.com/apache/arrow-rs/issues/3674#issuecomment-1423058446

   I wonder if the latency can be reduces by calling `flush()` on the 
underlying Decoder when the driver program knows (somehow) that it has received 
the end of a record and is not in the middle of decoding. 
   
   
https://docs.rs/arrow-csv/32.0.0/arrow_csv/reader/struct.Decoder.html#method.flush
   
   Perhaps something like
   
   ```rust
           let mut next = move || {
               loop {
                   // force flush to produce RecordBatches if we have fed the 
entire input
                   // that is available and are sure the data has only complete 
rows
                   let decoded = if check_have_read_to_boundary() {
                     decoder.flush()
                     decoder.decode(buf)
                   } else {
                     let buf = reader.fill_buf()?;
                     decoder.decode(buf); 
                   }?;
                   if decoded == 0 {
                       break;
                   }
                   reader.consume(decoded);
               }
               decoder.flush()
           };
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to