Missings.jl
Missings.jl copied to clipboard
Operations on Array{Union{T,Missing},N} return Array{Any,N}
Example is pretty self explanatory I think. Output of @code_warntype
says something isn't being inferred correctly.
julia> a=[1,missing,2]
3-element Array{Union{Int64, Missings.Missing},1}:
1
missing
2
julia> a+2
3-element Array{Any,1}:
3
missing
4
julia> a=[1 missing 2; 3 4 missing]
2×3 Array{Union{Int64, Missings.Missing},2}:
1 missing 2
3 4 missing
julia> a+2
2×3 Array{Any,2}:
3 missing 4
5 6 missing
I'm Julia 0.6.2 and Missings 0.2.4.
Is it inferred correctly on 0.7? I'm not sure what we can do about inference on 0.6.
Unfortunately, I haven't been able to get 0.7 running at all on my machine. Someone else would have to test
It's not an inference issue, it's due to calling typejoin
to choose the element type. https://github.com/JuliaLang/julia/pull/25553 should fix this.
Oh, sorry to hear that. If you're having specific troubles I recommend asking on Discourse.
I just checked on 0.7 and it does indeed get inferred as Any
there too.