apache / apache/arrow-julia

MonthlyDates

Open
#198 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
312
Forks
78
PR merge metrics
No merged PRs in 30d

Description

[`MonthlyDates.jl`](https://github.com/matthieugomez/MonthlyDates.jl) defines a `MonthlyDate <: TimeType`, which corresponds to elapsed months.

Unfortunately, it does not work when writing arrow files
```julia
using Arrow, MonthlyDates
Arrow.write("~/test.arrow", (a = [MonthlyDate(1990, 1)],))
ERROR: TaskFailedException
Stacktrace:
[1] wait
@ ./task.jl:317 [inlined]
[2] write(io::IOStream, source::NamedTuple{(:a,), Tuple{Vector{MonthlyDate}}}, writetofile::Bool, largelists::Bool, compress::Nothing, denseunions::Bool, dictencode::Bool, dictencodenested::Bool, alignment::Int64, maxdepth::Int64, ntasks::Float64)
@ Arrow ~/.julia/packages/Arrow/ggVa0/src/write.jl:165
[3] #94
@ ~/.julia/packages/Arrow/ggVa0/src/write.jl:86 [inlined]
[4] open(::Arrow.var"#94#95"{Bool, Nothing, Bool, Bool, Bool, Int64, Int64, Float64, Bool, NamedTuple{(:a,), Tuple{Vector{MonthlyDate}}}}, ::String, ::Vararg{String, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:330
[5] open
@ ./io.jl:328 [inlined]
[6] #write#93
@ ~/.julia/packages/Arrow/ggVa0/src/write.jl:85 [inlined]
[7] write(filename::String, tbl::NamedTuple{(:a,), Tuple{Vector{MonthlyDate}}})
@ Arrow ~/.julia/packages/Arrow/ggVa0/src/write.jl:85
[8] top-level scope
@ REPL[17]:1

nested task error: MethodError: Cannot `convert` an object of type Dates.Month to an object of type Dates.Second
Closest candidates are:
convert(::Type{P}, ::Arrow.Duration{U}) where {P<:Dates.Period, U} at /Users/matthieugomez/.julia/packages/Arrow/ggVa0/src/eltypes.jl:357
convert(::Type{Dates.Second}, ::Dates.Minute) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/periods.jl:417
convert(::Type{Dates.Second}, ::Dates.Hour) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/periods.jl:417
```
Would it be possible for Arrow to accept `MonthlyDates`? Can I do anything on the `MonthlyDates.jl` side to improve compatibility?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the Julia snippet, then inspect Arrow's write.jl and eltypes.jl at the stack-trace locations, along with MonthlyDates.jl. Done means Arrow.write accepts a vector of MonthlyDate values without the reported conversion error, with compatibility behavior confirmed by a regression test if the repository provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.