Skip to content

Commit

Permalink
fix (source-operator): Fix csv parsing with quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
s-minoo committed Jun 11, 2024
1 parent 88b54e3 commit 1a28029
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/operator/sourceOperator.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ export class SourceOp extends Operator {
quoteLevel = quoteLevel + 1
}
if (line[i] === "," && quoteLevel % 2 === 0) { // field has ended
if(quoteLevel === 0){
v[csvFields[fieldIndex]] = line.substring(fieldStart + quoteLevel / 2, i - quoteLevel / 2)
fieldIndex++;
fieldStart = i + 1;
quoteLevel = 0
}
}
}
v[csvFields[fieldIndex]] = line.substring(fieldStart + quoteLevel / 2, line.length - quoteLevel / 2)
Expand Down Expand Up @@ -174,4 +172,4 @@ export class SourceOp extends Operator {
throw new Error("Reference formulation not supported.")
}
}
}
}

0 comments on commit 1a28029

Please sign in to comment.