Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alamb opened this issue Aug 24, 2023 · 2 comments · Fixed by #4909
Closed

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

alamb opened this issue Aug 24, 2023 · 2 comments · Fixed by #4909
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@alamb
Copy link
Contributor

alamb commented Aug 24, 2023

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

@alamb alamb added the enhancement Any new improvement worthy of a entry in the changelog label Aug 24, 2023
@fansehep
Copy link
Contributor

fansehep commented Oct 9, 2023

Looks it is easy.

tustvold added a commit to tustvold/arrow-rs that referenced this issue Oct 9, 2023
tustvold added a commit that referenced this issue Oct 11, 2023
…#4909)

* Cleanup CSV WriterBuilder (#4735)

* Update test

* Review feedback

* Clippy
@tustvold tustvold added the arrow Changes to the arrow crate label Oct 18, 2023
@tustvold
Copy link
Contributor

label_issue.py automatically added labels {'arrow'} from #4909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
3 participants