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

Allow ArrowCSV writer to control the display of NULL values #3268

Closed
Tracked by #4460
alamb opened this issue Dec 4, 2022 · 1 comment · Fixed by #3342
Closed
Tracked by #4460

Allow ArrowCSV writer to control the display of NULL values #3268

alamb opened this issue Dec 4, 2022 · 1 comment · Fixed by #3342
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 Dec 4, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I am working on sqllogictest based testing in DataFusion - apache/datafusion#4460

We are using the Arrow CSV writer 👍

However, in order to implement the spec correctly, we need to display NULLs as "NULL"

Currently the CSV writer writes out NULLs as empty strings ""

I would like a way to control what string was used.

Describe the solution you'd like
Extend https://docs.rs/arrow-csv/28.0.0/arrow_csv/writer/struct.WriterBuilder.html

        let builder = WriterBuilder::new()
          .has_headers(false)
          .with_delimiter(b' ')
          // new setting to control NULL output
          .with_null(b'NULL');

So instead of wrting out the values `A, null, B' as

A

B

As is done today this would be written like

A
NULL
B

Describe alternatives you've considered
I could effectively fork the entire CSV writer into the datafusion testing harness and make it do what I want but I would rather get it in arrow.

Additional context
apache/datafusion#4500

@alamb alamb added arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog labels Dec 4, 2022
@askoa
Copy link
Contributor

askoa commented Dec 14, 2022

I'll pick this up.

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
Development

Successfully merging a pull request may close this issue.

2 participants