Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-03-02 Thread Jason Dere

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review74802
---



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java
https://reviews.apache.org/r/30437/#comment121563

Minor, but remove the 'j' at end of this comment.


- Jason Dere


On Feb. 27, 2015, 6:45 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 27, 2015, 6:45 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfeb33c 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 403cf11 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_datediff_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_datediff_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_datediff.q 30718fe 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_datediff_error1.q.out PRE-CREATION 
   ql/src/test/results/clientnegative/udf_datediff_error2.q.out PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out d4b0650 
   ql/src/test/results/clientpositive/show_functions.q.out.orig d79106f 
   ql/src/test/results/clientpositive/udf_datediff.q.out 86f30f6 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-27 Thread XIAOBING ZHOU

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/
---

(Updated Feb. 27, 2015, 6:45 p.m.)


Review request for hive.


Changes
---

patch V4, addressed most recent comments.


Repository: hive-git


Description
---

This is used to track work to build Oracle like months_between. Here's 
semantics:
MONTHS_BETWEEN returns number of months between dates date1 and date2. If date1 
is later than date2, then the result is positive. If date1 is earlier than 
date2, then the result is negative. If date1 and date2 are either the same days 
of the month or both last days of months, then the result is always an integer. 
Otherwise Oracle Database calculates the fractional portion of the result based 
on a 31-day month and considers the difference in time components date1 and 
date2.

https://issues.apache.org/jira/browse/HIVE-9518


Diffs (updated)
-

  ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfeb33c 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
403cf11 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
PRE-CREATION 
  
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java 
PRE-CREATION 
  ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_datediff_error1.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_datediff_error2.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_datediff.q 30718fe 
  ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
  ql/src/test/results/clientnegative/udf_datediff_error1.q.out PRE-CREATION 
  ql/src/test/results/clientnegative/udf_datediff_error2.q.out PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
PRE-CREATION 
  ql/src/test/results/clientpositive/show_functions.q.out d4b0650 
  ql/src/test/results/clientpositive/show_functions.q.out.orig d79106f 
  ql/src/test/results/clientpositive/udf_datediff.q.out 86f30f6 
  ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 

Diff: https://reviews.apache.org/r/30437/diff/


Testing
---

SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java


Thanks,

XIAOBING ZHOU



Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-27 Thread Alexander Pivovarov

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review74555
---



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java
https://reviews.apache.org/r/30437/#comment121151

remove spaces pls



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java
https://reviews.apache.org/r/30437/#comment121153

remove spaces pls



ql/src/test/queries/clientpositive/udf_months_between.q
https://reviews.apache.org/r/30437/#comment121155

remove spaces pls 88 89



ql/src/test/results/clientnegative/udf_months_between_error1.q.out
https://reviews.apache.org/r/30437/#comment121156

1st instead of 1-th



ql/src/test/queries/clientpositive/udf_datediff.q
https://reviews.apache.org/r/30437/#comment121150

can you remove spaces pls? lines 90 91



ql/src/test/results/clientnegative/udf_datediff_error1.q.out
https://reviews.apache.org/r/30437/#comment121158

1st instead of 1-th.



ql/src/test/results/clientnegative/udf_datediff_error2.q.out
https://reviews.apache.org/r/30437/#comment121157

1st instead of 1-th


- Alexander Pivovarov


On Feb. 27, 2015, 6:45 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 27, 2015, 6:45 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfeb33c 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 403cf11 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_datediff_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_datediff_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_datediff.q 30718fe 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_datediff_error1.q.out PRE-CREATION 
   ql/src/test/results/clientnegative/udf_datediff_error2.q.out PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out d4b0650 
   ql/src/test/results/clientpositive/show_functions.q.out.orig d79106f 
   ql/src/test/results/clientpositive/udf_datediff.q.out 86f30f6 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-17 Thread Alexander Pivovarov

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review72744
---



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java
https://reviews.apache.org/r/30437/#comment118799

Because you modified GenericUDFDateDiff can you also add tests to 
udf_datediff.q to make sure it works. Currently udf_datediff.q has just two 
desc datediff lines


- Alexander Pivovarov


On Feb. 4, 2015, 10:30 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 4, 2015, 10:30 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfb4dc2 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error3.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error4.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error5.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error6.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error7.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error8.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error9.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error3.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error4.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error5.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error6.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error7.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error8.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error9.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out e21b54b 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-04 Thread XIAOBING ZHOU

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/
---

(Updated Feb. 4, 2015, 10:30 p.m.)


Review request for hive.


Repository: hive-git


Description
---

This is used to track work to build Oracle like months_between. Here's 
semantics:
MONTHS_BETWEEN returns number of months between dates date1 and date2. If date1 
is later than date2, then the result is positive. If date1 is earlier than 
date2, then the result is negative. If date1 and date2 are either the same days 
of the month or both last days of months, then the result is always an integer. 
Otherwise Oracle Database calculates the fractional portion of the result based 
on a 31-day month and considers the difference in time components date1 and 
date2.

https://issues.apache.org/jira/browse/HIVE-9518


Diffs (updated)
-

  ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfb4dc2 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
1ecd835 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
PRE-CREATION 
  
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java 
PRE-CREATION 
  ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error3.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error4.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error5.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error6.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error7.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error8.q PRE-CREATION 
  ql/src/test/queries/clientnegative/udf_months_between_error9.q PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error3.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error4.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error5.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error6.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error7.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error8.q.out 
PRE-CREATION 
  ql/src/test/results/clientnegative/udf_months_between_error9.q.out 
PRE-CREATION 
  ql/src/test/results/clientpositive/show_functions.q.out e21b54b 
  ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 

Diff: https://reviews.apache.org/r/30437/diff/


Testing
---

SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java


Thanks,

XIAOBING ZHOU



Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-04 Thread Alexander Pivovarov

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review71154
---



ql/src/test/queries/clientpositive/udf_months_between.q
https://reviews.apache.org/r/30437/#comment116785

can you also add
MONTHS_BETWEEN('2012-02-10', cast(null as string)),
MONTHS_BETWEEN(cast(null as string), '2012-02-10'),
MONTHS_BETWEEN(cast(null as string), cast(null as string)),
MONTHS_BETWEEN('2012-02-10', cast(null as timestamp)),
MONTHS_BETWEEN(cast(null as timestamp), '2012-02-10'),
MONTHS_BETWEEN(cast(null as timestamp), cast(null as timestamp))


- Alexander Pivovarov


On Feb. 4, 2015, 10:30 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 4, 2015, 10:30 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfb4dc2 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error3.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error4.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error5.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error6.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error7.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error8.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error9.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error3.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error4.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error5.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error6.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error7.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error8.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error9.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out e21b54b 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-04 Thread Jason Dere


 On Feb. 4, 2015, 11:13 p.m., Alexander Pivovarov wrote:
  ql/src/test/queries/clientnegative/udf_months_between_error1.q, line 1
  https://reviews.apache.org/r/30437/diff/2/?file=848940#file848940line1
 
  valid query. result should be null but not error

Using the NULL constant is a bit of a special case, because NULL ends up 
evaluating as VOID type.  This is why the query ends up throwing an error 
during query compile time (during initialize()), because the type doesn't 
match. I wouldn't be surprised if most of the other date functions fail in the 
same way during initialize(). On the other hand, MONTHS_BETWEEN(cast(null as 
date), '2012-03-01') should not get an error (though it should return null 
result).

So this might be a bad example to use in the test - rather than 
MONTHS_BETWEEN(null, '2012-03-01'), use a different expression such as 
MONTHS_BETWEEN(1,  '2012-03-01'), it looks a little less confusing.


- Jason


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review71066
---


On Feb. 4, 2015, 10:30 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 4, 2015, 10:30 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfb4dc2 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error3.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error4.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error5.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error6.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error7.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error8.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error9.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error3.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error4.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error5.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error6.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error7.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error8.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error9.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out e21b54b 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-04 Thread Alexander Pivovarov

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review71066
---



ql/src/test/queries/clientnegative/udf_months_between_error1.q
https://reviews.apache.org/r/30437/#comment116611

valid query. result should be null but not error



ql/src/test/queries/clientnegative/udf_months_between_error2.q
https://reviews.apache.org/r/30437/#comment116612

valid query. result should be null but not error



ql/src/test/queries/clientnegative/udf_months_between_error3.q
https://reviews.apache.org/r/30437/#comment116614

cast both nulls to appropricate types.
after that result should be null but not error



ql/src/test/queries/clientnegative/udf_months_between_error4.q
https://reviews.apache.org/r/30437/#comment116615

valid query. result should be null but not error



ql/src/test/queries/clientnegative/udf_months_between_error5.q
https://reviews.apache.org/r/30437/#comment116616

valid query. result should be null but not error



ql/src/test/queries/clientnegative/udf_months_between_error6.q
https://reviews.apache.org/r/30437/#comment116617

valid query. result should be null but not error



ql/src/test/queries/clientnegative/udf_months_between_error7.q
https://reviews.apache.org/r/30437/#comment116618

valid query. result should be null but not error


- Alexander Pivovarov


On Feb. 4, 2015, 10:30 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 4, 2015, 10:30 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfb4dc2 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error3.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error4.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error5.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error6.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error7.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error8.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error9.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error3.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error4.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error5.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error6.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error7.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error8.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error9.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out e21b54b 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-04 Thread Alexander Pivovarov

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review71070
---



ql/src/test/queries/clientpositive/udf_months_between.q
https://reviews.apache.org/r/30437/#comment116621

add MONTHS_BETWEEN('2001-06-34', '2000-05-37')
It should return smth but not error
e.g. date_add('2001-06-34', 0) = 2015-07-04


- Alexander Pivovarov


On Feb. 4, 2015, 10:30 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 4, 2015, 10:30 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfb4dc2 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error3.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error4.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error5.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error6.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error7.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error8.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error9.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error3.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error4.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error5.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error6.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error7.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error8.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error9.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out e21b54b 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-02-04 Thread Alexander Pivovarov


 On Feb. 4, 2015, 11:13 p.m., Alexander Pivovarov wrote:
  ql/src/test/queries/clientnegative/udf_months_between_error1.q, line 1
  https://reviews.apache.org/r/30437/diff/2/?file=848940#file848940line1
 
  valid query. result should be null but not error
 
 Jason Dere wrote:
 Using the NULL constant is a bit of a special case, because NULL ends up 
 evaluating as VOID type.  This is why the query ends up throwing an error 
 during query compile time (during initialize()), because the type doesn't 
 match. I wouldn't be surprised if most of the other date functions fail in 
 the same way during initialize(). On the other hand, MONTHS_BETWEEN(cast(null 
 as date), '2012-03-01') should not get an error (though it should return null 
 result).
 
 So this might be a bad example to use in the test - rather than 
 MONTHS_BETWEEN(null, '2012-03-01'), use a different expression such as 
 MONTHS_BETWEEN(1,  '2012-03-01'), it looks a little less confusing.

probably MONTHS_BETWEEN(1,  '2012-03-01')   and  MONTHS_BETWEEN('2012-03-01', 
1) are better. Error should say smth like expect STRING/TIMESTAMP got INT


- Alexander


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review71066
---


On Feb. 4, 2015, 10:30 p.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Feb. 4, 2015, 10:30 p.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java bfb4dc2 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/org/apache/hadoop/hive/ql/udf/TestGenericUDFMonthsBetween.java 
 PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error1.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error2.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error3.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error4.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error5.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error6.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error7.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error8.q PRE-CREATION 
   ql/src/test/queries/clientnegative/udf_months_between_error9.q PRE-CREATION 
   ql/src/test/queries/clientpositive/udf_months_between.q PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error1.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error2.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error3.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error4.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error5.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error6.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error7.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error8.q.out 
 PRE-CREATION 
   ql/src/test/results/clientnegative/udf_months_between_error9.q.out 
 PRE-CREATION 
   ql/src/test/results/clientpositive/show_functions.q.out e21b54b 
   ql/src/test/results/clientpositive/udf_months_between.q.out PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-01-31 Thread Alexander Pivovarov

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review70504
---


Look at number of files in GREATEST udf patch 
https://reviews.apache.org/r/30003/diff/#
add your function to show_functions.q.out
add negative q and q.out files
what if date not valid 2014-01-40 or null
add positive q and q.out files

to build and test hive
cd hive
mvn clean install -Phadoop-2 -DskipTests
mvn test -Phadoop-2 -Dtest=TestGenericUDFGreatest

cd itests
mvn clean install -Phadoop-2 -DskipTests

cd qtest
mvn test -Dtest=TestNegativeCliDriver -Dqfile=udf_greatest_error_1.q 
-Dtest.output.overwrite=true -Phadoop-2
mvn test -Dtest=TestCliDriver -Dqfile=udf_greatest.q 
-Dtest.output.overwrite=true -Phadoop-2

- Alexander Pivovarov


On Jan. 30, 2015, 1:43 a.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Jan. 30, 2015, 1:43 a.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 23d77ca 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/TestGenericUDFMonthsBetween.java PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Re: Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-01-30 Thread Jason Dere

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/#review70404
---



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java
https://reviews.apache.org/r/30437/#comment115601

Rather than create a new IntWritable each time evaluate() is called, can 
you create the writable once during initialize() re-use it?



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java
https://reviews.apache.org/r/30437/#comment115577

If this initialize() function is shared between DATEDIFF() and 
MONTHS_BETWEEN(), then returning INT object inspector is wrong, since 
MONTHS_BETWEEN can return DOUBLE type. You will have to return a double type 
object inspector in that case. Otherwise when Hive tries to use the results of 
this UDF there will be invalid cast exceptions because the return value will be 
treated as int.



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
https://reviews.apache.org/r/30437/#comment115602

remove trailing whitespace



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
https://reviews.apache.org/r/30437/#comment115605

Create new writable once during initialize()



ql/src/test/TestGenericUDFMonthsBetween.java
https://reviews.apache.org/r/30437/#comment115586

minor complaint, but get rid of these extra whitespace characters



ql/src/test/TestGenericUDFMonthsBetween.java
https://reviews.apache.org/r/30437/#comment115599

Is this calling java.sql.Timestamp.Timestamp(int year, int month, int date, 
int hour, int minute, int second, int nano)? Don't use this if so - this is a 
deprecated API. Use Timestmap.valueOf(). Since that takes a string in 
'-mm-dd hh:mm:ss) format, it also makes it easier to make sense of the 
timestamp value.



ql/src/test/TestGenericUDFMonthsBetween.java
https://reviews.apache.org/r/30437/#comment115600

Same here - use Date.valueOf('1995-02-02')


- Jason Dere


On Jan. 30, 2015, 1:43 a.m., XIAOBING ZHOU wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/30437/
 ---
 
 (Updated Jan. 30, 2015, 1:43 a.m.)
 
 
 Review request for hive.
 
 
 Repository: hive-git
 
 
 Description
 ---
 
 This is used to track work to build Oracle like months_between. Here's 
 semantics:
 MONTHS_BETWEEN returns number of months between dates date1 and date2. If 
 date1 is later than date2, then the result is positive. If date1 is earlier 
 than date2, then the result is negative. If date1 and date2 are either the 
 same days of the month or both last days of months, then the result is always 
 an integer. Otherwise Oracle Database calculates the fractional portion of 
 the result based on a 31-day month and considers the difference in time 
 components date1 and date2.
 
 https://issues.apache.org/jira/browse/HIVE-9518
 
 
 Diffs
 -
 
   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 23d77ca 
   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
 1ecd835 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
 PRE-CREATION 
   
 ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java
  PRE-CREATION 
   ql/src/test/TestGenericUDFMonthsBetween.java PRE-CREATION 
 
 Diff: https://reviews.apache.org/r/30437/diff/
 
 
 Testing
 ---
 
 SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java
 
 
 Thanks,
 
 XIAOBING ZHOU
 




Review Request 30437: Implement MONTHS_BETWEEN aligned with Oracle one

2015-01-29 Thread XIAOBING ZHOU

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30437/
---

Review request for hive.


Repository: hive-git


Description
---

This is used to track work to build Oracle like months_between. Here's 
semantics:
MONTHS_BETWEEN returns number of months between dates date1 and date2. If date1 
is later than date2, then the result is positive. If date1 is earlier than 
date2, then the result is negative. If date1 and date2 are either the same days 
of the month or both last days of months, then the result is always an integer. 
Otherwise Oracle Database calculates the fractional portion of the result based 
on a 31-day month and considers the difference in time components date1 and 
date2.

https://issues.apache.org/jira/browse/HIVE-9518


Diffs
-

  ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 23d77ca 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiff.java 
1ecd835 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDateDiffBase.java 
PRE-CREATION 
  
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMonthsBetween.java 
PRE-CREATION 
  ql/src/test/TestGenericUDFMonthsBetween.java PRE-CREATION 

Diff: https://reviews.apache.org/r/30437/diff/


Testing
---

SEE ALSO ql/src/test/TestGenericUDFMonthsBetween.java


Thanks,

XIAOBING ZHOU