Commit b5c831a
authored
Allow Users to Provide Custom
# 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.ArrayFormatters when Pretty-Printing Record Batches (#8829)1 parent 389f404 commit b5c831a
File tree
3 files changed
+781
-62
lines changed- arrow-array/src/array
- arrow-cast/src
3 files changed
+781
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
176 | 185 | | |
177 | 186 | | |
178 | 187 | | |
| |||
0 commit comments