hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "XIAOBING ZHOU" <xzho...@gmail.com>
Subject Re: Review Request 30335: Build UDF TRUNC to implement FIRST_DAY as compared with LAST_DAY
Date Wed, 25 Feb 2015 23:35:13 GMT


> On Feb. 20, 2015, 1:38 a.m., Alexander Pivovarov wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java, line 143
> > <https://reviews.apache.org/r/30335/diff/5/?file=870059#file870059line143>
> >
> >     In 99% of the cases arg[1] will be constant
> >     you can get arg[1] avalue in initialize() instead of doing it in evaluate()
for each row
> >     
> >      if (arguments[1] instanceof ConstantObjectInspector) {
> >           String fmt = ((ConstantObjectInspector) arguments[1]).getWritableConstantValue()
> >               .toString();
> >     }

e.g. WritableTimestampObjectInspector is not ConstantObjectInspector. So init once in evaluate
function


- XIAOBING


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


On Feb. 25, 2015, 11:35 p.m., XIAOBING ZHOU wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/30335/
> -----------------------------------------------------------
> 
> (Updated Feb. 25, 2015, 11:35 p.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 bfeb33c 
>   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java PRE-CREATION

>   ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFTrunc.java PRE-CREATION

>   ql/src/test/queries/clientnegative/udf_trunc_error1.q PRE-CREATION 
>   ql/src/test/queries/clientnegative/udf_trunc_error2.q PRE-CREATION 
>   ql/src/test/queries/clientpositive/udf_trunc.q PRE-CREATION 
>   ql/src/test/results/clientnegative/udf_trunc_error1.q.out PRE-CREATION 
>   ql/src/test/results/clientnegative/udf_trunc_error2.q.out PRE-CREATION 
>   ql/src/test/results/clientpositive/show_functions.q.out d4b0650 
>   ql/src/test/results/clientpositive/udf_trunc.q.out 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
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message