Skip to content

Commit

Permalink
support reading ragged tab/csv files (uneven columns)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssadedin committed Mar 20, 2018
1 parent c3ddd46 commit 4c05cd8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/main/groovy/graxxia/TSV.groovy
Expand Up @@ -177,11 +177,9 @@ class TSV implements Iterable {
@CompileStatic
List<Object> convertColumns(String [] values, List columnTypes) {
List<Object> newValues = values as List
final int numColumns = columnTypes.size()
final int numColumns = Math.min(columnTypes.size(), values.size())
for(int index = 0; index<numColumns; ++index) {
def type = columnTypes[index]
if(values.size()<=index)
return
try {
if(type instanceof Class)
newValues[index] = values[index].asType((Class)type)
Expand Down

0 comments on commit 4c05cd8

Please sign in to comment.