-
Notifications
You must be signed in to change notification settings - Fork 140
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
InexactError: trunc(Int64, NaN)
#705
Comments
Seems to only happen locally and not on the CI |
A more minimal reproduction. Occurs on macOS 10.14.6 on Julia 1.3.1, 1.4.2, and 1.5.0-rc2 with CSV.jl 0.7.2 onwards: julia> using CSV
julia> CSV.File(joinpath("test", "testfiles", "promotions.csv"); threaded=true)
ERROR: InexactError: trunc(Int64, NaN)
Stacktrace:
[1] trunc at ./float.jl:703 [inlined]
[2] ceil at ./float.jl:365 [inlined]
[3] multithreadparse(::Array{Type,1}, ::Array{UInt8,1}, ::Array{UInt8,1}, ::Int64, ::Int64, ::Parsers.Options{false,false,true,false,Missing,UInt8,Nothing}, ::Nothing, ::Int64, ::Int64, ::Float64, ::Array{CSV.RefPool,1}, ::Int64, ::Dict{Type,Type}, ::Bool, ::Type, ::Nothing, ::Int64, ::Bool) at /Users/omus/.julia/dev/CSV/src/file.jl:419
[4] CSV.File(::CSV.Header{false,Parsers.Options{false,false,true,false,Missing,UInt8,Nothing},Array{UInt8,1}}; startingbyteposition::Nothing, endingbyteposition::Nothing, limit::Nothing, threaded::Bool, typemap::Dict{Type,Type}, tasks::Int64, debug::Bool) at /Users/omus/.julia/dev/CSV/src/file.jl:255
[5] CSV.File(::String; header::Int64, normalizenames::Bool, datarow::Int64, skipto::Nothing, footerskip::Int64, transpose::Bool, comment::Nothing, use_mmap::Nothing, ignoreemptylines::Bool, select::Nothing, drop::Nothing, missingstrings::Array{String,1}, missingstring::String, delim::Nothing, ignorerepeated::Bool, quotechar::Char, openquotechar::Nothing, closequotechar::Nothing, escapechar::Char, dateformat::Nothing, dateformats::Nothing, decimal::UInt8, truestrings::Array{String,1}, falsestrings::Array{String,1}, type::Nothing, types::Nothing, typemap::Dict{Type,Type}, categorical::Nothing, pool::Float64, lazystrings::Bool, strict::Bool, silencewarnings::Bool, debug::Bool, parsingdebug::Bool, kw::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:threaded,),Tuple{Bool}}}) at /Users/omus/.julia/dev/CSV/src/file.jl:217
[6] top-level scope at REPL[2]:1 |
Can you share how many threads you're running julia with? CI runs w/ 2 by default, so it seems like it might depend on # of threads. (this is adjustable by passing |
The failure only occurs when nthreads is 1. I tried with 2 and 4 and no error occurred. |
The issue here is that a user can pass `threaded=true`, which means we'll do parsing across `tasks` chunks of a file in parallel, which causes this error when the number of tasks happens to be 1. This could be the user passing `tasks=1` manually, in which case they should not do, or it defaulted to `Threads.nthreads()` and the user's Julia session started with only 1 thread. We already do a few other hard-checks for multithreaded parsing, like ensuring your Julia version is > 1.3, so the fix is pretty simple: if a user passes `threaded=true`, then we'll also require the `tasks` parameter to be `> 1`. Fixes #705
Issue when running tests on the latest master (da0967a)
The text was updated successfully, but these errors were encountered: