Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csv reader: fix EOF on quotes #5185

Merged
merged 1 commit into from
Jul 18, 2024
Merged

csv reader: fix EOF on quotes #5185

merged 1 commit into from
Jul 18, 2024

Conversation

mattnibs
Copy link
Collaborator

This commit fixes an with the csv reader where and EOF occurring on a quoted field would cause a parsing error.

Closes #4732

This commit fixes an with the csv reader where and EOF occurring on a
quoted field would cause a parsing error.

Closes #4732
@mattnibs mattnibs requested a review from a team July 17, 2024 21:50
@philrz
Copy link
Contributor

philrz commented Jul 17, 2024

The branch seems to fix the two user examples from #4732 so it's a functional 👍 for me!

$ zq -version
Version: v1.16.0-16-gf7d8e511

$ zq -i csv 'count()' chatgpt-vcs-2.csv
629(uint64)

$ echo -e -n "foo,bar\n\"foo\",\"bar\"" | zq -i csv -z 'yield this' -
{foo:"foo",bar:"bar"}

Compared to baseline on main:

$ zq -version
Version: v1.17.0

$ zq -i csv 'count()' chatgpt-vcs-2.csv
chatgpt-vcs-2.csv: parse error on line 630, column 27: bare " in non-quoted-field

$ echo -e -n "foo,bar\n\"foo\",\"bar\"" | zq -i csv -z 'yield this' -
stdio:stdin: parse error on line 2, column 10: bare " in non-quoted-field

@mattnibs mattnibs merged commit 9766d17 into main Jul 18, 2024
3 checks passed
@mattnibs mattnibs deleted the csvio-eof-quotes branch July 18, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSV reader error when file doesn't end in newline: bare " in non-quoted-field
3 participants