Skip to content

Custom Pretty-Printing Implementation for Column when Formatting Record Batches #8821

@tobixdev

Description

@tobixdev

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

When calling pretty_format_columns_with_options, I would like to have the ability to provide a custom pretty printing function that overrides the default behavior. In the case of DataFusion, this would help for pretty-printing extension types in record batches. For example, in a UUID which has a DataType of FixedSizeBinary, the printer could insert the - to separate the groups.

Describe the solution you'd like

Allow users to provide custom functions for formatting values in an array. This custom function could work based on the existing ArrayFormatter or an Fn(ArrayRef, usize) -> String.

If this is an approach that would work for you, I am happy to draft an implementation.

Describe alternatives you've considered

An alternative would be to let dependent systems handle the issue themselves. I.e., DataFusion builds its own formatter.

Additional context

We are exploring extension type support in DataFusion and pretty-printing record batches could be the first issue. See apache/datafusion#18223 for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions