JuliaData / CSV.jl

Utility library for working with CSV and other delimited files in the Julia programming language
https://csv.juliadata.org/
Other
459 stars 141 forks source link

Selectively reduce multithreaded parsing @error #1099

Closed Liozou closed 1 year ago

Liozou commented 1 year ago

Reduce the @error introduced in https://github.com/JuliaData/CSV.jl/pull/1073 to a @warning whenever previous warnings may explain why multithreaded parsing failed (typically, unequal number of columns per row). In those cases, it will print:

┌ Warning: Multithreaded parsing failed and fell back to single-threaded parsing, check previous warnings for possible reasons.

If there is no possible explanation, this still shows a red @error saying:

┌ Error: Multithreaded parsing failed and fell back to single-threaded parsing. This can happen if the input contains multi-line fields; otherwise, please report this issue.

In both cases, a debug statement is printed as soon as multithread parsing failed (if the Context debug kwarg is set), whereas the @warning or @error only appears at the end of the fallback single-threaded parsing.

I think this compromise allows us to still get error reports like https://github.com/JuliaData/CSV.jl/issues/1095, which are crucial to detect and allow use to fix underlying issues where multithreaded parsing should not fail (like https://github.com/JuliaData/CSV.jl/pull/1098 in this instance), while avoiding to stress the user with an @error when there is nothing to report.

Close https://github.com/JuliaData/CSV.jl/issues/1095.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01 :tada:

Comparison is base (07fb6c2) 90.40% compared to head (5093e6b) 90.42%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1099 +/- ## ========================================== + Coverage 90.40% 90.42% +0.01% ========================================== Files 9 9 Lines 2294 2298 +4 ========================================== + Hits 2074 2078 +4 Misses 220 220 ``` | [Impacted Files](https://app.codecov.io/gh/JuliaData/CSV.jl/pull/1099?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaData) | Coverage Δ | | |---|---|---| | [src/context.jl](https://app.codecov.io/gh/JuliaData/CSV.jl/pull/1099?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaData#diff-c3JjL2NvbnRleHQuamw=) | `88.99% <100.00%> (ø)` | | | [src/file.jl](https://app.codecov.io/gh/JuliaData/CSV.jl/pull/1099?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaData#diff-c3JjL2ZpbGUuamw=) | `94.46% <100.00%> (+0.03%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.