You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "palday (via GitHub)" <gi...@apache.org> on 2024/09/24 23:27:15 UTC
[I] missing methods for `fromarrow(::Type{Time}, x::Arrow.Time{<:Arrow.Flatbuf.TimeUnit.T, <:Integer})` [arrow-julia]
palday opened a new issue, #526:
URL: https://github.com/apache/arrow-julia/issues/526
I did not create table in question, but the column in question contains a time stored as `Arrow.Time{Arrow.Flatbuf.TimeUnit.MICROSECOND, Int64}` which errors upon access.
This can be fixed by adding the methods
```julia
function fromarrow(::Type{Time}, x::Arrow.Time{Arrow.Flatbuf.TimeUnit.MICROSECOND, <:Integer})
return Time(0, 0, 0) + Microsecond(x.x)
end
function fromarrow(::Type{Time}, x::Arrow.Time{Arrow.Flatbuf.TimeUnit.MILLISECOND, <:Integer})
return Time(0, 0, 0) + Millisecond(x.x)
end
function fromarrow(::Type{Time}, x::Arrow.Time{Arrow.Flatbuf.TimeUnit.NANOSECOND, <:Integer})
return Time(0, 0, 0) + Nanosecond(x.x)
end
function fromarrow(::Type{Time}, x::Arrow.Time{Arrow.Flatbuf.TimeUnit.SECOND, <:Integer})
return Time(0, 0, 0) + Second(x.x)
end
```
I can open a PR adding these methods if there is no other preferred solution
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] missing methods for `fromarrow(::Type{Time}, x::Arrow.Time{<:Arrow.Flatbuf.TimeUnit.T, <:Integer})` [arrow-julia]
Posted by "palday (via GitHub)" <gi...@apache.org>.
palday commented on issue #526:
URL: https://github.com/apache/arrow-julia/issues/526#issuecomment-2372565517
Possibly related to #363
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] missing methods for `fromarrow(::Type{Time}, x::Arrow.Time{<:Arrow.Flatbuf.TimeUnit.T, <:Integer})` [arrow-julia]
Posted by "ararslan (via GitHub)" <gi...@apache.org>.
ararslan commented on issue #526:
URL: https://github.com/apache/arrow-julia/issues/526#issuecomment-2372590222
Looks like the right `convert` method exists and is general enough to handle all of the above cases, it's just `fromarrow` that's currently too specific: it's assuming all incoming `Arrow.Time`s are nanoseconds. I think this is all that's needed:
```diff
diff --git a/src/eltypes.jl b/src/eltypes.jl
index ffc53c0..6071365 100644
--- a/src/eltypes.jl
+++ b/src/eltypes.jl
@@ -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::Time) = convert(Dates.Time, x)
ArrowTypes.default(::Type{Dates.Time}) = Dates.Time(1, 1, 1)
struct Timestamp{U,TZ} <: ArrowTimeType
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] missing methods for `fromarrow(::Type{Time}, x::Arrow.Time{<:Arrow.Flatbuf.TimeUnit.T, <:Integer})` [arrow-julia]
Posted by "ericphanson (via GitHub)" <gi...@apache.org>.
ericphanson closed issue #526: missing methods for `fromarrow(::Type{Time}, x::Arrow.Time{<:Arrow.Flatbuf.TimeUnit.T, <:Integer})`
URL: https://github.com/apache/arrow-julia/issues/526
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org