tobixdev opened a new pull request, #8829:
URL: https://github.com/apache/arrow-rs/pull/8829

   # Which issue does this PR close?
   
   - Closes #8821.
   
   # Rationale for this change
   
   Allows users that require custom pretty-printing logic for batches to supply 
this implementation.
   
   # What changes are included in this PR?
   
   Changes to existing code:
   
   - Make fields in `FormatOptions` public. This is necessary as the custom 
`ArrayFormatter` must also have access to the formatting options. (see `<NULL>` 
in the test)
   - Deprecate `types_info()` method as the field is now public
   - Allow directly creating `ArrayFormatter` with a `DisplayIndex` 
implementation
   - Make `FormatError`, `FormatResult`, and `DisplayIndex` public. I do have 
some second thoughts about `DisplayIndex` not having any concept of length even 
though its taking an index as input. However, it may be fine for now.
   
   New code:
   
   - `ArrayFormatterFactory`: Allows creating `ArrayFormatters` with custom 
behavior
   - `pretty_format_batches_with_options_and_formatters` pretty printing with 
custom formatters
   - Similar thing for format column
   
   # Are these changes tested?
   
   Yes, existing tests cover the default formatting path.
   
   Three new tests:
   - Format record batch with custom type (append € sign)
   - Format column with custom formatter (append (32-Bit) for `Int32`)
   - Allow overriding the custom types with a custom schema (AFAIK this is not 
possible with the current API but might make sense).
   - Added a sanity check that the number of fields in a custom schema must 
match the number of columns in the record batch.
   
   # Are there any user-facing changes?
   
   Yes, multiple things become public, `types_info()` becomes deprecated, and 
there are new APIs for custom pretty printing of batches.
   


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