[ 
https://issues.apache.org/jira/browse/ASTERIXDB-1635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15477531#comment-15477531
 ] 

ASF subversion and git services commented on ASTERIXDB-1635:
------------------------------------------------------------

Commit 2a73f411264b282aefed51fa35322187f892d707 in asterixdb's branch 
refs/heads/master from [~prestonc]
[ https://git-wip-us.apache.org/repos/asf?p=asterixdb.git;h=2a73f41 ]

ASTERIXDB-1635 Fix for overlap-bins start for dates.

The fix involves two code changes and several sonar fixes.
The code changes are the following:
 - DurationArithmeticOperations line 75:
    When the month was zero, an index out of bound error occured in line 88 or 
92.
    The month value should be between 1 and 12.
 - OverlapBinsDescriptor line 170:
    The Gregorian Calendar is expecting a value in ms. When a date value comes 
in,
    AsterixDB represents the value as the number of days from epoc. So the year
    for a date basically allways translated to 1970. In lines 121, a condition
    was added to check if the interval was a date, if so, convert the date to
    ms.

Change-Id: I24122a84ef9edda4b05260af881c430177f1dc86
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1151
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Steven Jacobs <sjaco...@ucr.edu>


> Overlap-bins does not start at the correct bin for dates
> --------------------------------------------------------
>
>                 Key: ASTERIXDB-1635
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1635
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Preston Carman
>            Assignee: Preston Carman
>            Priority: Minor
>
> Using the example on the documentation, I changed the date overlap-bins to 
> use 10 years. The change now produces the wrong result. The result starts 
> from 1970 instead of the correct year. 
> The issue is because the days are not converted to ms when picking the 
> starting bin.
> Sample query:
> {noformat}
> let $itv1 := interval(time("17:23:37"), time("18:30:21"))
> let $itv2 := interval(date("1984-03-17"), date("2013-08-22"))
> let $itv3 := interval(datetime("1800-01-01T23:59:48.938"), 
> datetime("2015-07-26T13:28:30.218"))
> return { "timebins": overlap-bins($itv1, time("00:00:00"), 
> day-time-duration("PT30M")),
>   "datebins": overlap-bins($itv2, date("1990-01-01"), 
> year-month-duration("P10Y")),
>   "datetimebins": overlap-bins($itv3, datetime("1900-01-01T00:00:00.000"), 
> year-month-duration("P100Y")) }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to