JuliaAI / ScientificTypes.jl

An API for dispatching on the "scientific" type of data instead of the machine type
MIT License
96 stars 8 forks source link

dispatch error while `scitype` on an `SentinelArray` which is used by CSV.jl #104

Closed OkonSamuel closed 3 years ago

OkonSamuel commented 3 years ago
julia> using MLJScientificTypes, SentinelArrays

julia> b =SentinelArray([1,2,3,4])
4-element SentinelArray{Int64,1,Int64,Missing,Array{Int64,1}}:
 1
 2
 3
 4

julia> scitype(b)
Unknown

julia> scitype(b, MLJScientificTypes.ScientificTypes.convention())
Unknown

julia> scitype(b, MLJScientificTypes.ScientificTypes.convention(), Val(trait(b)))
AbstractArray{Union{Missing, Count},1}

I thinking this is a julia bug. Making a small tweak to the code resolves the issue but i can't seem to understand why this is an issue in the first place. @ablaom , @tlienart thoughts??

OkonSamuel commented 3 years ago

This issue has been fixed in the recent julia 1.5.1 patch release.

julia> using MLJScientificTypes, SentinelArrays

julia> b =SentinelArray([1,2,3,4])
4-element SentinelArray{Int64,1,Int64,Missing,Array{Int64,1}}:
 1
 2
 3
 4

julia> scitype(b)
AbstractArray{Union{Missing, Count},1}

julia> scitype(b, MLJScientificTypes.ScientificTypes.convention())
AbstractArray{Union{Missing, Count},1}

julia> scitype(b, MLJScientificTypes.ScientificTypes.convention(), Val(trait(b)))
AbstractArray{Union{Missing, Count},1}

julia> InteractiveUtils.versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, broadwell)
OkonSamuel commented 3 years ago

closing this. Since it's been resolved