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

Broken indexing for axis with eltype Dates.Date #212

Open
LilithHafner opened this issue Nov 13, 2022 · 2 comments
Open

Broken indexing for axis with eltype Dates.Date #212

LilithHafner opened this issue Nov 13, 2022 · 2 comments

Comments

@LilithHafner
Copy link

Indexing into an axis array with an axis of eltype date using a range of eltype date as an index throws. I believe this is a bug.

julia> using AxisArrays, Test

julia> @testset for axis in [1:3, 'a':'c', Date(0):Day(1):Date(0,1,3)]
           a = AxisArray(1:3, axis)
           @test a[axis[1]] == 1
           @test a[axis[2]] == 2
           @test a[axis[3]] == 3
           @test a[:] == 1:3
           @test a[axis] == 1:3
       end
Test Summary: | Pass  Total  Time
axis = 1:3    |    5      5  0.0s
Test Summary:    | Pass  Total  Time
axis = 'a':1:'c' |    5      5  0.0s
axis = Date("0000-01-01"):Day(1):Date("0000-01-03"): Error During Test at REPL[136]:7
  Test threw exception
  Expression: a[axis] == 1:3
  ArgumentError: unable to check bounds for indices of type Date
  Stacktrace:
    [1] checkindex(#unused#::Type{Bool}, inds::Base.OneTo{Int64}, i::Date)
      @ Base ./abstractarray.jl:766
    [2] checkindex
      @ ./abstractarray.jl:773 [inlined]
    [3] checkbounds
      @ ./abstractarray.jl:694 [inlined]
    [4] checkbounds
      @ ./abstractarray.jl:709 [inlined]
    [5] _getindex
      @ ./multidimensional.jl:860 [inlined]
    [6] getindex
      @ ./abstractarray.jl:1294 [inlined]
    [7] getindex_converted
      @ ~/.julia/packages/AxisArrays/v7vf4/src/indexing.jl:133 [inlined]
    [8] getindex(A::AxisArray{Int64, 1, UnitRange{Int64}, Tuple{Axis{:row, StepRange{Date, Day}}}}, idxs::StepRange{Date, Day})
      @ AxisArrays ~/.julia/packages/AxisArrays/v7vf4/src/indexing.jl:123
    [9] macro expansion
      @ ~/.julia/dev/julia_master/usr/share/julia/stdlib/v1.9/Test/src/Test.jl:477 [inlined]
   [10] macro expansion
      @ ./REPL[136]:7 [inlined]
   [11] top-level scope
      @ ~/.julia/dev/julia_master/usr/share/julia/stdlib/v1.9/Test/src/Test.jl:1584 [inlined]
   [12] top-level scope
      @ ./REPL[136]:0
Test Summary:                                       | Pass  Error  Total  Time
axis = Date("0000-01-01"):Day(1):Date("0000-01-03") |    4      1      5  0.0s
@fcdimitr
Copy link

Do you know if there has been any progress/solutions on this issue?

@LilithHafner
Copy link
Author

I do not

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

No branches or pull requests

2 participants