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

Fix ambiguity error on construction from ChainedVector #369

Merged
merged 2 commits into from
Sep 17, 2021

Conversation

nalimilan
Copy link
Member

Fix #361 adding special methods for ChainedVector, and make as many dependencies as possible optional using Requires.jl.

@time using CategoricalArrays on a fresh session goes down from 0.26s to 0.18s.

@nalimilan nalimilan requested a review from bkamins September 17, 2021 08:05
Comment on lines 43 to 46
DataAPI.defaultarray(::Type{CategoricalValue{T, R}}, N) where {T, R} =
CategoricalArray{T, N, R}
DataAPI.defaultarray(::Type{Union{CategoricalValue{T, R}, Missing}}, N) where {T, R} =
CategoricalArray{Union{T, Missing}, N, R}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these definitions linked to JSON? I would assume they make sense in general.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops. Unfortunately tests don't catch this as JSON is loaded earlier...

CategoricalArray{Union{T, Missing}, N, R}
end

@require RecipesBase="3cdcf5f2-1ef4-517c-9805-6587b60abb01" @eval begin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to cover this with tests if it is not overly complex.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's tested AFAICT. Or do you mean something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just coveage test was signaling it is not tested. That is why I asked.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean line 50 at https://github.com/JuliaData/CategoricalArrays.jl/runs/3633298660? That's probably a bug, as other lines in the block appear to be covered. I guess a macro within two macro calls is too complex for coverage checks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

copyto!(dest::CatArrOrSub{<:Any, 1}, dstart::Union{Signed, Unsigned},
src::SentinelArrays.ChainedVector, sstart::Union{Signed, Unsigned},
n::Union{Signed, Unsigned}) =
invoke(copyto!, Tuple{AbstractArray, Union{Signed, Unsigned},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

@bkamins
Copy link
Member

bkamins commented Sep 17, 2021

I understand that the proper code blocks will be executed both when:

  1. CategoricalArrays.jl being loaded and the given package was already loaded directly or indirectly
  2. CategoricalArrays.jl was loaded and the given package is being loaded directly or indirectly

Right?

@nalimilan
Copy link
Member Author

Yes, at least that's my understanding. :-)

Project.toml Show resolved Hide resolved
@nalimilan nalimilan merged commit e48d047 into master Sep 17, 2021
@nalimilan nalimilan deleted the nl/ChainedVector branch September 17, 2021 16:26
@nalimilan
Copy link
Member Author

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.

Trouble with categorical(v) when v is a SentinelArrays.ChainedVector
2 participants