alamb commented on a change in pull request #975:
URL: https://github.com/apache/arrow-rs/pull/975#discussion_r756456262



##########
File path: arrow/src/util/pretty.rs
##########
@@ -42,6 +43,12 @@ pub fn print_batches(results: &[RecordBatch]) -> Result<()> {
     Ok(())
 }
 
+pub fn write_batches<W: Write>(buf: &mut W, results: &[RecordBatch]) -> 
Result<()> {

Review comment:
       I wonder what you both would think about implementing `Display` instead 
of a new free function?
   
   Something like
   
   ```rust
   fn displayable(batches: &[RecordBatch]) -> impl Display {
   ...
   }
   ```
   
   Then we could use that directly in format calls, like 
   
   ```rust
   println!("Batches: {}", displayable(batches));
   ```
   
   As well as writing:
   ```rust
   write!(&mut w, "{}", displayable(batches));
   ```
   
   
   Basically it feels to me like if we are going to add something new to pretty 
print it would be nice to make it as flexible as possible.
   
   You can do this displayable trick with a newtype wrapper, for example 
https://github.com/apache/arrow-datafusion/blob/master/datafusion/src/logical_plan/display.rs#L96-L119
   




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