-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: Fix #12074 and #12094 #12115
RFC: Fix #12074 and #12094 #12115
Conversation
…roadcasting (where not previously implemented)
cc @quinnj |
Thanks @GordStephen for digging into this and ironing out the details here. Also thanks for the good # of tests. If you're interested in taking a crack at improving the Dates parsing code, I'm sure @jiahao would appreciate it (there should be a few open issues); I'm always happen to recruit people to work on Dates stuff. |
Always appreciate more work on Unfortunately this PR introduced a very large number of ambiguity warnings downstream. For example: julia> using DataFrames
Warning: New definition
+(AbstractArray, DataArrays.DataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:326
is ambiguous with:
+(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:90.
To fix, define
+(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, DataArrays.DataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
+(AbstractArray, DataArrays.AbstractDataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
+(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:90.
To fix, define
+(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(Base.Range, DataArrays.DataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:326
is ambiguous with:
-(Base.Range{#T<:Base.Dates.TimeType}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:104.
To fix, define
-(Base.Range{#T<:Base.Dates.TimeType}, DataArrays.DataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(AbstractArray, DataArrays.DataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:326
is ambiguous with:
-(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:90.
To fix, define
-(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, DataArrays.DataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(AbstractArray, DataArrays.DataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:326
is ambiguous with:
-(Base.Range{#T<:Base.Dates.TimeType}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:104.
To fix, define
-(Base.Range{#T<:Base.Dates.TimeType}, DataArrays.DataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(AbstractArray, DataArrays.DataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:326
is ambiguous with:
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:105.
To fix, define
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, DataArrays.DataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(DataArrays.AbstractDataArray, Base.Range) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, Base.Range{#T<:Base.Dates.TimeType}) at dates/arithmetic.jl:103.
To fix, define
-(DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any}, Base.Range{#T<:Base.Dates.TimeType})
before the new definition.
Warning: New definition
-(Base.Range, DataArrays.AbstractDataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(Base.Range{#T<:Base.Dates.TimeType}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:104.
To fix, define
-(Base.Range{#T<:Base.Dates.TimeType}, DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(DataArrays.AbstractDataArray, AbstractArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, Base.Range{#T<:Base.Dates.TimeType}) at dates/arithmetic.jl:103.
To fix, define
-(DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any}, Base.Range{#T<:Base.Dates.TimeType})
before the new definition.
Warning: New definition
-(DataArrays.AbstractDataArray, AbstractArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}) at dates/arithmetic.jl:88.
To fix, define
-(DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any}, Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}})
before the new definition.
Warning: New definition
-(DataArrays.AbstractDataArray, AbstractArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:105.
To fix, define
-(DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(AbstractArray, DataArrays.AbstractDataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:90.
To fix, define
-(Union{DenseArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any}, Base.SubArray{#P<:Union{Base.Dates.CompoundPeriod, Base.Dates.Period}, N<:Any, A<:DenseArray, I<:Tuple{Vararg{Union{Int64, Base.Range{Int64}, Base.Colon}}}, LD<:Any}}, DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(AbstractArray, DataArrays.AbstractDataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(Base.Range{#T<:Base.Dates.TimeType}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:104.
To fix, define
-(Base.Range{#T<:Base.Dates.TimeType}, DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition.
Warning: New definition
-(AbstractArray, DataArrays.AbstractDataArray) at /Users/jiahao/.julia/v0.4/DataArrays/src/operators.jl:349
is ambiguous with:
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, AbstractArray{#T<:Base.Dates.TimeType, N<:Any}) at dates/arithmetic.jl:105.
To fix, define
-(AbstractArray{#T<:Base.Dates.TimeType, N<:Any}, DataArrays.AbstractDataArray{#T<:Base.Dates.TimeType, N<:Any})
before the new definition. |
Yikes! Well, I guess the good news is that the errors all seem to trace back to just two method definitions (lines 326/349 in DataArrays/src/operators.jl). I'll go open an issue at DataArrays and see what I can do about it - or do you think there's something that could be done on this end to reduce the impact more generally? |
The I wonder if it's worth at least a little time seeing if we can fix this more generally. Assuming you don't want to make a |
I like the sound of that - one thing to watch for would be the fact that |
After working on this for a few hours, I don't think we can have a generic fix without addressing #8027. The specific place this comes up in Dates is in adding a Now here's my provocative question: is the current slew of ambiguity warnings in packages worth the benefit of this PR? Or should we revert it? |
@timholy, thanks for all the work to try to fix the underlying issues here! Maybe the solution for now is to move the functionality into a standalone module, so the few who need it right now (maybe just me?) can have it without causing broader package issues. |
Let's hold out for a bit more and see whether #12292 wraps up soon. Certainly it would be great to support the operations you've supported. If the answer on #12292 is "just can't fix this now," I confess I like your solution. I hate the idea of backing out excellent work, especially from a new contributor. But to me it seems like the only workable choice. Your flexibility gains a big 💯 from me, and I hope to see you around more! |
Ok, sounds good! |
This resolves #12074 and #12094 by cleaning up and completing #12084.
Implements: