Fix newline bug in mg_import_csv
Summary: Handle special case when delimiter is the last character in line. This means that another empty column needs to be added. Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1678
This commit is contained in:
parent
60ec94fb30
commit
d8293f1b6b
@ -188,6 +188,12 @@ std::vector<std::string> ReadRow(std::istream &stream) {
|
||||
} else if (c == FLAGS_csv_delimiter.front()) {
|
||||
row.emplace_back(column.begin(), column.end());
|
||||
column.clear();
|
||||
// Handle special case when delimiter is the last
|
||||
// character in line. This means that another
|
||||
// empty column needs to be added.
|
||||
if (i == line_size - 1) {
|
||||
row.emplace_back("");
|
||||
}
|
||||
} else {
|
||||
column.push_back(c);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
id:ID(FORUM_ID)|title:string|:LABEL
|
||||
0|General|Forum
|
||||
1|Support|Forum
|
||||
2|Music|Forum
|
||||
3|Film|Forum
|
||||
4|Programming|Forum
|
||||
id:ID(FORUM_ID)|title:string|:LABEL|emptyColumn
|
||||
0|General|Forum|
|
||||
1|Support|Forum|
|
||||
2|Music|Forum|
|
||||
3|Film|Forum|
|
||||
4|Programming|Forum|
|
||||
|
|
Loading…
Reference in New Issue
Block a user