alamb commented on PR #2476:
URL: https://github.com/apache/arrow-rs/pull/2476#issuecomment-1221521240

   > Similarly we could add an option to quote strings, this would then provide 
an unambiguous NULL representation.
   
   I agree this would be great. 
   
   Maybe we could take the opportunity to make a more extendable API too. What 
do you all think about something like:
   
   ```rust
   struct PrettyPrinter {
    // details here
   }
   
   impl PrettyPrinter {
     /// Configure which string is used to represent `NULL` (default is "")
     pub fn with_null(mut self, null_string: impl Into<String>) -> Self {
       self.null_string = null_string;
       self
     }
   
     /// Configure which character, if any, is used to escape strings
     pub fn with_escape(mut self, escape: Option<char>) -> Self {
       self.escape = escape;
       self
     }
   
      /// Create a visual representation of record batches
      pub fn pretty_format_batches(results: &[RecordBatch]) -> Result<impl 
Display> {
        // details
      }
     // .. more details here
   }
   ```
   
   Then we could implement the existing API in terms of it like
   
   ```rust
   
   
   
   ///! Create a visual representation of record batches
   pub fn pretty_format_batches(results: &[RecordBatch]) -> Result<impl 
Display> {
     PrettyPrinter::new()
       .with_null(""),
       .with_escape(None)
       .format_batches(results)
   }
   ```
   
   
   I can file this as a ticket if it seems reasonable


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