docete commented on a change in pull request #121: [CALCITE-3881][avatica] 
DateTimeUtils#addMonths yields incorrect resu…
URL: https://github.com/apache/calcite-avatica/pull/121#discussion_r405400865
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
 ##########
 @@ -965,7 +965,20 @@ public static int ymdToUnixDate(int year, int month, int 
day) {
     return julian - EPOCH_JULIAN;
   }
 
+  /** Calculates the Julian Day Number for any date on the Gregorian. The 
paper of
+   * 
http://www.cs.utsa.edu/~cs1063/projects/Spring2011/Project1/jdn-explanation.html
+   * provides a brief explanation for this algorithm. */
   public static int ymdToJulian(int year, int month, int day) {
+       if (month < 1 || month > 12) {
+               throw new IllegalArgumentException(
+                       "Month of any date on the Gregorian should between 1 to 
12, but " + month);
+    }
 
 Review comment:
   Seems the throws come from old calcite since 
https://github.com/apache/calcite/pull/1890 is not merged. 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to