Skip to content

Commit

Permalink
Allow malformed CSVs with too many headers in the CSV parser (#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
kustosz authored Aug 12, 2021
1 parent eb7e7d0 commit 7c45b92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

- Added support for writing tables to file as JSON
([#1937](https://github.com/enso-org/enso/pull/1937)).
- Added support for parsing CSV files with too many headers declared
([#1942](https://github.com/enso-org/enso/pull/1942)).

# Enso 0.2.23 (2021-08-09)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ public Table parse(InputStream inputStream) {
builders = initBuilders(row.length);
}
for (int i = 0; i < builders.length; i++) {
builders[i] = builders[i].parseAndAppend(handleNa(row[i]));
String item = i < row.length ? handleNa(row[i]) : null;
builders[i] = builders[i].parseAndAppend(item);
}
while ((row = parser.parseNext()) != null) {
for (int i = 0; i < builders.length; i++) {
builders[i] = builders[i].parseAndAppend(handleNa(row[i]));
String item = i < row.length ? handleNa(row[i]) : null;
builders[i] = builders[i].parseAndAppend(item);
}
}
Column[] columns = new Column[builders.length];
Expand Down

0 comments on commit 7c45b92

Please sign in to comment.