You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Alexander Pivovarov <ap...@gmail.com> on 2015/02/05 01:29:28 UTC
Re: Review Request 30335: Implement FIRST_DAY as compared with
LAST_DAY already supported in HIVE
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30335/#review71097
-----------------------------------------------------------
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFirstDay.java
<https://reviews.apache.org/r/30335/#comment116698>
create abstract method boolean isLastDay()
LastDay class should return true
FirstDay class should return false
then
if (isLastDay()) {
dd = calendar.getActualMaximum(Calendar.DAY_OF_MONTH)
} else {
dd = 1
}
so you can put getThatDay impl to base class
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFirstDay.java
<https://reviews.apache.org/r/30335/#comment116693>
remove spaces
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFirstDay.java
<https://reviews.apache.org/r/30335/#comment116695>
min day of month is 1. Always
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFirstDay.java
<https://reviews.apache.org/r/30335/#comment116694>
remove spaces at the end
- Alexander Pivovarov
On Jan. 30, 2015, 2:04 a.m., XIAOBING ZHOU wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/30335/
> -----------------------------------------------------------
>
> (Updated Jan. 30, 2015, 2:04 a.m.)
>
>
> Review request for hive.
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Hive already supports LAST_DAY UDF, in some cases, FIRST_DAY is necessary to do date/timestamp related computation. This JIRA is to track such an implementation.
>
> https://issues.apache.org/jira/browse/HIVE-9480
>
>
> Diffs
> -----
>
> ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 23d77ca
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDayBase.java PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFirstDay.java PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLastDay.java 911ee46
> ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFFirstDay.java PRE-CREATION
>
> Diff: https://reviews.apache.org/r/30335/diff/
>
>
> Testing
> -------
>
> Unit tests done in ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFFirstDay.java
>
>
> Thanks,
>
> XIAOBING ZHOU
>
>