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

Specialize apply_schema to Schema for lead/lag #152

Merged
merged 3 commits into from
Sep 28, 2019

Conversation

kleinschmidt
Copy link
Member

By analogy with how other built-in terms are handled since the Schema type was
introduced.

Fixes #146

@codecov-io
Copy link

codecov-io commented Sep 13, 2019

Codecov Report

Merging #152 into master will increase coverage by 0.44%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
+ Coverage   84.04%   84.48%   +0.44%     
==========================================
  Files           9        9              
  Lines         495      522      +27     
==========================================
+ Hits          416      441      +25     
- Misses         79       81       +2
Impacted Files Coverage Δ
src/temporal_terms.jl 80% <ø> (ø) ⬆️
src/StatsModels.jl 100% <ø> (ø) ⬆️
src/schema.jl 83.94% <0%> (+2.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91efc7a...fa779cc. Read the comment docs.

Copy link
Contributor

@oxinabox oxinabox left a comment

Choose a reason for hiding this comment

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

Fair.

Should we add Test.detect_ambiguities to runtests.jl

@kleinschmidt
Copy link
Member Author

I'm not familiar with that, what does it do that detecting the ambiguity errors themselves doesn't?

@oxinabox
Copy link
Contributor

You write

@test isempty(detect_ambiguities(Base, Core, StatsModels))

inside your test/runtest.jl and it goes through and checks that no ambiguities exist.

@kleinschmidt
Copy link
Member Author

kleinschmidt commented Sep 16, 2019 via email

@oxinabox
Copy link
Contributor

Looks like that catches ambiguities that are internal to Base or Core too though...

Yes, but Base and Core don't have any. So ...

@oxinabox
Copy link
Contributor

alteratively, can just do

@test isempty(detect_ambiguities(StatsModels))

@kleinschmidt
Copy link
Member Author

The issue is that there aren't any ambiguities in the code as far as it exists now...but they have a nasty habit of turning up with extensions (like these temporal terms)

@oxinabox
Copy link
Contributor

Seems like a good reason to add that test then?

@kleinschmidt
Copy link
Member Author

.........indeed

@kleinschmidt
Copy link
Member Author

BTW, when I run Test.detect_ambiguities(Core, Base) I get:

68-element Array{Tuple{Method,Method},1}:
 ((::Type{StaticArrays.SArray{Tuple{S1,S2},T,2,L} where T})(x::Tuple{Vararg{Any,L}}) where {S1, S2, L} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SMatrix.jl:41, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                             
 ((::Type{StaticArrays.MArray{Tuple{S1,S2},T,2,L} where L where T where S2})(x::Tuple{Vararg{T,L}} where T) where {S1, L} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/MMatrix.jl:21, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)          
 (convert(::Type{S}, x::T) where {S, T<:(Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R)} in CategoricalArrays at /home/dave/.julia/packages/CategoricalArrays/JFETm/src/value.jl:91, convert(::Type{T}, x) where T>:Union{Missing, Nothing} in Base at missing.jl:70)                                                                              
 ((::Type{StaticArrays.SArray{S,T,N,L} where L})(x::Tuple) where {S<:Tuple, T, N} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SArray.jl:33, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                                   
 (checkbounds(::Type{Bool}, ::ShiftedArrays.CircShiftedArray, I...) in ShiftedArrays at /home/dave/.julia/packages/ShiftedArrays/iqIVk/src/circshiftedarray.jl:98, checkbounds(::Type{Bool}, A::AbstractArray, i::Union{AbstractArray{#s627,N} where N where #s627<:CartesianIndex, CartesianIndex}) in Base at multidimensional.jl:472)                                                                    
 ((::Type{StaticArrays.MArray{Tuple{S},T,1,S} where T})(x::Tuple{Vararg{T,S}}) where {S, T} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/MVector.jl:20, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                        
 (convert(::Type{S}, x::T) where {S, T<:(Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R)} in CategoricalArrays at /home/dave/.julia/packages/CategoricalArrays/JFETm/src/value.jl:91, convert(::Type{SubString{S}}, s::AbstractString) where S<:AbstractString in Base at strings/substring.jl:50)                                                  
 ((::Type{StaticArrays.SArray{S,T,N,L}})(x::Tuple{Vararg{T,L}}) where {S, T, N, L} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SArray.jl:22, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                                  
 ((::Type{StaticArrays.SArray{S,T,N,L} where L where N})(x::Tuple) where {S<:Tuple, T} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SArray.jl:40, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                              
 (copyto!(dest::RecursiveArrayTools.ArrayPartition, bc::Base.Broadcast.Broadcasted) in RecursiveArrayTools at /home/dave/.julia/packages/RecursiveArrayTools/peaIl/src/array_partition.jl:245, copyto!(dest::AbstractArray, bc::Base.Broadcast.Broadcasted{#s627,Axes,F,Args} where Args<:Tuple where F where Axes where #s627<:Base.Broadcast.AbstractArrayStyle{0}) in Base.Broadcast at broadcast.jl:869)
 ((::Type{StaticArrays.SizedArray{Tuple{S1,S2},T,2,M} where M where T})(x::Tuple{Vararg{T,L}}) where {S1, S2, T, L} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SizedArray.jl:73, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)             
 (checkbounds(::Type{Bool}, ::ShiftedArrays.CircShiftedArray, I...) in ShiftedArrays at /home/dave/.julia/packages/ShiftedArrays/iqIVk/src/circshiftedarray.jl:98, checkbounds(::Type{Bool}, A::AbstractArray, I::Base.LogicalIndex{#s627,#s626} where #s626<:AbstractArray{Bool,1} where #s627) in Base at multidimensional.jl:619)                                                                        
 ((::Type{StaticArrays.SHermitianCompact{N,T,L}})(a::Tuple) where {N, T, L} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SHermitianCompact.jl:63, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                              
 ⋮                                                                                                                                                                                                                                                                                                                                                                                                          
 ((::Type{Scalar{T} where T})(x::Tuple{T}) where T in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/Scalar.jl:9, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                                                                   
 ((::Type{StaticArrays.SArray{Tuple{S},T,1,S} where T where S})(x::Tuple{Vararg{Any,S}}) where S in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SVector.jl:18, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                   
 ((::Type{StaticArrays.SHermitianCompact})(a::StaticArrays.StaticArray{Tuple{N,N},T,2}) where {N, T} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SHermitianCompact.jl:82, (::Type{SSC})(a::SSC) where SSC<:StaticArrays.SHermitianCompact in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SHermitianCompact.jl:85)                                            
 ((::Type{StaticArrays.SizedArray{Tuple{S},T,1,M} where M where T})(x::Tuple{Vararg{T,L}}) where {S, T, L} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SizedArray.jl:69, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                      
 ((::Type{FV})(x::Tuple{Vararg{Any,N}}) where {N, FV<:(StaticArrays.FieldVector{N,T} where T)} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/FieldVector.jl:20, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                 
 ((::Type{StaticArrays.SizedArray{S,T,N,M} where M})(x::Tuple) where {S, T, N} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SizedArray.jl:47, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                                  
 ((::Type{StaticArrays.MArray{S,T,N,L} where L where N where T})(x::T) where {S, T<:Tuple} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/MArray.jl:54, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                          
 ((::Type{StaticArrays.SizedArray{S,T,N,M} where M where N})(x::Tuple) where {S, T} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/SizedArray.jl:48, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                             
 (checkbounds(::Type{Bool}, ::ShiftedArrays.ShiftedArray, I...) in ShiftedArrays at /home/dave/.julia/packages/ShiftedArrays/iqIVk/src/shiftedarray.jl:104, checkbounds(::Type{Bool}, A::AbstractArray, I::Base.LogicalIndex) in Base at multidimensional.jl:621)                                                                                                                                           
 ((::Type{StaticArrays.MArray{S,T,N,L}})(x::Tuple{Vararg{T,L}}) where {S, T, N, L} in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/MArray.jl:24, (::Type{SA})(x::Tuple{Tuple{Tuple{#s162} where #s162<:Tuple}}) where SA<:StaticArrays.StaticArray in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/convert.jl:1)                                                  
 (reduce(op, a::StaticArrays.StaticArray) in StaticArrays at /home/dave/.julia/packages/StaticArrays/3KEjZ/src/mapreduce.jl:164, reduce(::typeof(hcat), A::AbstractArray{#s66,1} where #s66<:(Union{AbstractArray{T,1}, AbstractArray{T,2}} where T)) in Base at abstractarray.jl:1378)                                                                                                                     
 (convert(::Type{S}, x::T) where {S, T<:(Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R)} in CategoricalArrays at /home/dave/.julia/packages/CategoricalArrays/JFETm/src/value.jl:91, convert(::Type{T}, s::AbstractString) where T<:AbstractString in Base at strings/basic.jl:209)                                                                

on 1.3-rc2

@oxinabox
Copy link
Contributor

oxinabox commented Sep 27, 2019

Might be worth opening issues on those packages?

@kleinschmidt
Copy link
Member Author

The other issue I just ran into is: when I run detect_ambiguities outside the test suite everything looks good. But because the test suit introduces additional methods for functions from StatsModels, it fails when run as part of the test suite. I could move the ambiguity test to the very front but...that seems a bit of a hack.

adding additional methods in the extensions tests creates ambiguities :(((
@kleinschmidt
Copy link
Member Author

Okay I marked the failing test as broken and added a "clean" one at the start.

@kleinschmidt kleinschmidt merged commit c7f0db7 into master Sep 28, 2019
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.

Method ambiguity for lead/lag terms
3 participants