Skip to content

Commit

Permalink
fromarrow(::Type{Dates.Time}, x::Arrow.Time) (#527)
Browse files Browse the repository at this point in the history
- closes #526 
- closes #363
  • Loading branch information
palday authored Oct 21, 2024
1 parent 2696105 commit a31fcf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/eltypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ ArrowTypes.toarrow(x::Dates.Time) = convert(TIME, x)
const TIME_SYMBOL = Symbol("JuliaLang.Time")
ArrowTypes.arrowname(::Type{Dates.Time}) = TIME_SYMBOL
ArrowTypes.JuliaType(::Val{TIME_SYMBOL}, S) = Dates.Time
ArrowTypes.fromarrow(::Type{Dates.Time}, x::TIME) = convert(Dates.Time, x)
ArrowTypes.fromarrow(::Type{Dates.Time}, x::Arrow.Time) = convert(Dates.Time, x)
ArrowTypes.default(::Type{Dates.Time}) = Dates.Time(1, 1, 1)

struct Timestamp{U,TZ} <: ArrowTimeType
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1061,5 +1061,13 @@ end
t = Arrow.Table(io)
@test Arrow.Tables.rowcount(t) == 6
end

@testset "# 526: Arrow.Time" begin
tt = testtables[4]
# just to make sure we're grabbing the correct table
@test first(tt) == "arrow date/time types"
tbl = Arrow.Table(Arrow.tobuffer(tt[2]))
@test tbl.col16[1] == Dates.Time(0, 0, 0)
end
end # @testset "misc"
end

0 comments on commit a31fcf9

Please sign in to comment.