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

Can't use searchsorted with Date ranges on 32-bit #30763

Closed
simonbyrne opened this issue Jan 19, 2019 · 2 comments
Closed

Can't use searchsorted with Date ranges on 32-bit #30763

simonbyrne opened this issue Jan 19, 2019 · 2 comments
Labels
dates Dates, times, and the Dates stdlib module

Comments

@simonbyrne
Copy link
Contributor

julia> using Dates

julia> searchsorted(Date(2019,1,1):Month(2):Date(2020,1,1), Date(2019,3,2))
ERROR: MethodError: no method matching searchsorted(::StepRange{Date,Month}, ::Date, ::Int64, ::Int64, ::Base.Order.ForwardOrdering)
Closest candidates are:
  searchsorted(::AbstractArray{T,1} where T, ::Any, ::Int32, ::Int32, ::Base.Order.Ordering) at sort.jl:208
  searchsorted(::AbstractArray{T,1} where T, ::Any; lt, by, rev, order) at sort.jl:294
  searchsorted(::AbstractArray{T,1} where T, ::Any, ::Base.Order.Ordering) at sort.jl:292
Stacktrace:
 [1] searchsorted(::StepRange{Date,Month}, ::Date, ::Base.Order.ForwardOrdering) at ./sort.jl:292
 [2] #searchsorted#6(::Function, ::Function, ::Nothing, ::Base.Order.ForwardOrdering, ::Function, ::StepRange{Date,Month}, ::Date) at ./sort.jl:294
 [3] searchsorted(::StepRange{Date,Month}, ::Date) at ./sort.jl:294
 [4] top-level scope at none:0

The problem is that the searchsorted bisection expects Int, but length on date ranges returns an Int64.

@simonbyrne simonbyrne added the dates Dates, times, and the Dates stdlib module label Jan 19, 2019
@simonbyrne
Copy link
Contributor Author

We really should have specialised methods for these in any case.

kmsquire added a commit to kmsquire/julia that referenced this issue Apr 6, 2019
* Might also address JuliaLang#31618
* Types of start and stop indicies are still restricted to
  Union{Int32,Int64} and must be the same
kmsquire added a commit to kmsquire/julia that referenced this issue Apr 6, 2019
* Might also address JuliaLang#31618
* Types of start and stop indicies are still restricted to
  Union{Int32,Int64} and must be the same
kmsquire added a commit to kmsquire/julia that referenced this issue Apr 6, 2019
* Might also address JuliaLang#31618
* Types of start and stop indicies are still restricted to
  Union{Int32,Int64} and must be the same
kmsquire added a commit to kmsquire/julia that referenced this issue Apr 6, 2019
* Might also address JuliaLang#31618
* Types of start and stop indicies are still restricted to
  Union{Int32,Int64} and must be the same
@kmsquire
Copy link
Member

kmsquire commented Apr 7, 2019

Ref: #20839, where length of date ranges was forced to Int64 (it was previously type unstable with type Union{Int32, Int64}).

kmsquire added a commit to kmsquire/julia that referenced this issue Apr 12, 2019
* Might also address JuliaLang#31618
* Types of start and stop indicies are still restricted to
  Union{Int32,Int64} and must be the same
kmsquire added a commit to kmsquire/julia that referenced this issue Apr 12, 2019
* Might also address JuliaLang#31618
* Types of start and stop indicies are still restricted to
  Union{Int32,Int64} and must be the same
kmsquire added a commit to kmsquire/julia that referenced this issue Apr 17, 2019
* Might also address JuliaLang#31618
* Types of start and stop indicies are restricted to
  Integer and must be the same type
* Note that this file is compiled early during bootstrap, and `one` is not yet
  available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dates Dates, times, and the Dates stdlib module
Projects
None yet
Development

No branches or pull requests

2 participants