-
Notifications
You must be signed in to change notification settings - Fork 76
CSV is written without column separators if first column is null #33
Comments
Thank you for reporting this, and especially for providing unit tests. It sounds like a bug indeed. |
Add unit test from #33 to failing unit tests folder
Thanks again -- there was a bug in code that appends (or not...) column separators, for cases where buffering is needed for out-of-order writes. Fixed it in master (for 2.4), as well as 2.3 branch for 2.3.3. |
Thanks for the quick fix! :) |
Many thanks for reporting this -- I hope to get CSV module as reliable as possible, and we get there one fixed bug at a time. :) |
Why is the default behavior to leave out the commas for null columns at the end, ie. in the last assertion we see:
why is it not:
It seems inconsistent to leave out the last comma if the provided entry has a missing value there because you then end up with rows that have different number of commas. |
It is quite common in CSV to leave out commas for null columns at the end, it would be nice if the behaviour was configurable though. |
I think Jackson should not optimize by leaving out nulls here, so I'd consider this a bug. Although a feature to allow omitting such values would be acceptable as well; but default to writing "full" rows. So @hkothari feel free to file a bug against this behavior. |
There seems to be a bug in CsvWriter in the code dealing with the buffer. When the first column is null, the row is output without column separators. See unit tests below.
testWrite_NullFirstColumn
fails (all others pass). Expected output is,42,hello\n
, actual output is42hello\n
.Tested against jackson-dataformat-csv v2.3.2.
The text was updated successfully, but these errors were encountered: