-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.9.0
-
Component/s: Tools
-
Environment:n/a
-
Fully Compatible
-
ALL
I have been able to confirm that this is likely a bug, however, as we all know one programmers bug is another's feature. That said.... Here are the particulars:
FILE: tools/import.cpp
This piece of code... while reading the input file, (skip the JSON part), it trims all of the leading whitespace. However, if this is a TSV then the tab will be gobbled up. I don't think this was the intended behavior.
292 if (_jsonArray) {
293 while (buf[0] != '{' && buf[0] != '\0')
297 if (buf[0] == '\0')
298 break;
299 }
300 else {
301 while (isspace( buf[0] ))
305 if (buf[0] == '\0')
306 continue;
307 len += strlen( buf );
308 }
309
http://creativyst.com/Doc/Articles/CSV/CSV01.htm
I do not every reading a formal spec for CSV but this link is pretty good. In general, however, it's a bug in the design to trim the leading part of the record in this location in the code. The parser should be located as tightly and closely as possible... for the obvious reasons.
/r
- related to
-
TOOLS-61 mongoimport tab-delimited files retains quotes and ignores escaped tabs
- Closed