Dmitry Lychagin has submitted this change and it was merged.

Change subject: [ASTERIXDB-2352][FUN] Incorrect leap year handling in duration 
arithmetic
......................................................................


[ASTERIXDB-2352][FUN] Incorrect leap year handling in duration arithmetic

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- DurationArithmeticOperations.addDuration() incorrectly handled leap year

Change-Id: I01e1417f4704d72a4650ec4f2fa257f044a20a09
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2561
Reviewed-by: Till Westmann <[email protected]>
Sonar-Qube: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Contrib: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
---
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/DurationArithmeticOperations.java
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Till Westmann: Looks good to me, approved
  Jenkins: Verified; No violations found; ; Verified



diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/DurationArithmeticOperations.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/DurationArithmeticOperations.java
index a50adc6..26c3fb3 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/DurationArithmeticOperations.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/temporal/DurationArithmeticOperations.java
@@ -85,13 +85,13 @@
         boolean isLeapYear = GREG_CAL.isLeapYear(year);
 
         if (isLeapYear) {
-            if (day > GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month - 1]) {
-                day = GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month - 1];
-            }
-        } else {
             if (day > GregorianCalendarSystem.DAYS_OF_MONTH_LEAP[month - 1]) {
                 day = GregorianCalendarSystem.DAYS_OF_MONTH_LEAP[month - 1];
             }
+        } else {
+            if (day > GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month - 1]) {
+                day = GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month - 1];
+            }
         }
 
         return GREG_CAL.getChronon(year, month, day, hour, min, sec, ms, 0) + 
dayTimeDuration;

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2561
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I01e1417f4704d72a4650ec4f2fa257f044a20a09
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: release-0.9.4-pre-rc
Gerrit-Owner: Dmitry Lychagin <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Till Westmann <[email protected]>

Reply via email to