Skip to content

Add read access to settings in csv::WriterBuilder #4735

@alamb

Description

@alamb

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

While implementing CSV writing in DataFusion (see https://github.com/apache/arrow-datafusion/pull/7390/files), we would like to be able to check the value of has_headers before actually constructing a csv writer. However, the current API has no way to do read the current values (only modify them): https://docs.rs/arrow-csv/45.0.0/arrow_csv/writer/struct.WriterBuilder.html

Describe the solution you'd like
It would be nice to have read only access to the fields. Maybe something like

    let builder = WriterBuilder::new().has_headers(false);
 
    let has_headers = builder.get_has_headers()

It is somewhat unfortunate that the builder already uses has_headers to set the field names rather than with_has_headers

Describe alternatives you've considered
We can keep a copy of has_headers around as @devinjdangelo has done in https://github.com/apache/arrow-datafusion/pull/7390/files

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow crateenhancementAny 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