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

Bucket function fails for longer time periods > 1 month #14

Open
gridcellcoder opened this issue Sep 22, 2016 · 0 comments
Open

Bucket function fails for longer time periods > 1 month #14

gridcellcoder opened this issue Sep 22, 2016 · 0 comments

Comments

@gridcellcoder
Copy link
Contributor

Joda Time, periods cannot deal with starts and ends that have a difference > 1 month see:http://stackoverflow.com/questions/8793475/joda-time-all-in-minutes

This line therefore:

https://github.com/SparklineData/spark-datetime/blob/master/src/main/scala/org/sparklinedata/spark/dateTime/Functions.scala#L400

results in

Caused by: java.lang.UnsupportedOperationException: Cannot convert to Duration as this period contains months and months vary in length
    at org.joda.time.Period.checkYearsAndMonths(Period.java:1567)
    at org.joda.time.Period.toStandardDuration(Period.java:1549)
    at org.sparklinedata.spark.dateTime.FunctionsExt$timeBucketFn$.apply(FunctionsExt.scala:400)

perhaps this needs to be changed to use something like:

val d0: Duration = p.toStandardDuration
      assert((dt.getMillis>origin.getMillis))
      FieldUtils.safeDivide((dt.getMillis-origin.getMillis), d0.getMillis)
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

1 participant