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

Feature request: add isless function to compare two Datestamps #46

Closed
metanoid opened this issue Oct 19, 2019 · 2 comments
Closed

Feature request: add isless function to compare two Datestamps #46

metanoid opened this issue Oct 19, 2019 · 2 comments

Comments

@metanoid
Copy link

I ran into an issue where I could not find the minimum or maximum of an array of Arrow.Datestamp data, because these two functions require the existence of an isless function.

To reproduce:

import Arrow
import Dates
day1 = Arrow.Datestamp(Dates.today())
day2 = Arrow.Datestamp(Dates.today() + Dates.Day(1))
first_day = minimum(day1, day2)

Expected behaviour: returns day1 value
Actual behaviour: Error message : ERROR: MethodError: no method matching minimum(::Datestamp, ::Datestamp)
Request: export isless, minimum, and maximum functions from Arrow.jl which can handle Datestamps

What I tried:
I tried making my own isless function:

Base.isless(a::Datestamp, b::Datestamp) = isless(a.value, b.value)

However, this just leads to the new error message: ERROR: MethodError: no method matching minimum(::Datestamp, ::Datestamp)

@ExpandingMan
Copy link
Owner

On current master, the intention is that the Arrow time types should always be converted to Julia Dates types using convert. This is of course not ideal. Ultimately the Arrow time types are going to be done away with entirely, and instead the array will be a view of the underlying data which automatically returns Julia Dates types as elements.

@metanoid
Copy link
Author

Okay, perfect, so for now I can convert all Arrow.Datestamp arrays to Dates.Date upfront!

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