-
Notifications
You must be signed in to change notification settings - Fork 847
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
Remove delimiter from csv Writer #1342
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1342 +/- ##
=======================================
Coverage 83.04% 83.04%
=======================================
Files 181 181
Lines 52937 52937
=======================================
Hits 43960 43960
Misses 8977 8977
Continue to review full report at Codecov.
|
I think the delimiter is not used in the builder (when converting to Writer), so I think the original issue description is correct? |
/// Create a new `Writer`
pub fn build<W: Write>(self, writer: W) -> Writer<W> {
let delimiter = self.delimiter.unwrap_or(b','); // looks like it's used
let mut builder = csv_crate::WriterBuilder::new();
let writer = builder.delimiter(delimiter).from_writer(writer);
... |
Yes it's used in the builder, but looks to me it's not passed to the |
Hm, but what about this line let writer = builder.delimiter(delimiter).from_writer(writer); If I understand correctly, |
Ah yeah, you are right 👍 missed that this was the Maybe we could add a test for writing a csv with another separator? |
There's already a test for custom options, including the delimiter: https://github.com/apache/arrow-rs/blob/master/arrow/src/csv/writer.rs#L637 |
Perfect, thanks! |
Which issue does this PR close?
Closes #1328.
I think that I wrote the issue above in a bit of a rush, the part about changes to
Writer::new()
. The doc comment forWriter::new()
clearly states that a new CsvWriter is initialized with default options, with,
being the default delimiter.A custom delimiter can be configured using already existing
WriterBuilder::with_delimiter
. So, in my view, the scope of the issue is to simply remove unused code without any changes to the API.Rationale for this change
There is no use for the
delimiter
field in csvWriter
.What changes are included in this PR?
The unused
delimiter
field is removed.Are there any user-facing changes?
No.