tustvold commented on issue #3740:
URL: https://github.com/apache/arrow-rs/issues/3740#issuecomment-1441619053

   > I couldn't think of a solution on how to keep buffer ownership while 
writing with the usual Writer
   
   Perhaps something like (not tested)
   
   ```
   let mut buffer = Vec::with_capacity(1024);
   
   while let Some(batch) = stream.next().await.transpose()? {
       let writer = Writer::new(&mut buffer);
       writer.write(&batch)?;
       std::mem::drop(writer);
       flush(&buffer).await?;
       buffer.clear();
   }
   ```
   
   Whilst creating the `Writer` each time is perhaps a little unfortunate, I am 
skeptical it will be relevant when amortised over the cost of encoding an 
entire batch - CSV encoding is very expensive.


-- 
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