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



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java
<https://reviews.apache.org/r/30335/#comment119699>

    according to java coding convention UPPER_CASE var names used only for 
constants (static final)



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java
<https://reviews.apache.org/r/30335/#comment119698>

    why you read FORMAT_INPUT only for the first row and then cache it?
    what if format is dynamic?
    
    As I mentioned before, use ConstantObjectInspector to get format in 
inintialize() method
    
    if it's not constant then you have to read format valus in evaluate() 
method for every single row. don't cache format if it is not constant
    
    look at decode udf as an example



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java
<https://reviews.apache.org/r/30335/#comment119700>

    I think ("MM".equals(formatInput) || "MON".equals(formatInput) || 
"MONTH".equals(formatInput)) is faster than calling contains() on ArrayList



ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java
<https://reviews.apache.org/r/30335/#comment119701>

    ("YEAR".equals(formatInput) || "YYYY".equals(formatInput) || 
"YY".equals(formatInput))


- Alexander Pivovarov


On Feb. 21, 2015, 2:54 a.m., XIAOBING ZHOU wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/30335/
> -----------------------------------------------------------
> 
> (Updated Feb. 21, 2015, 2:54 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 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
> 
>

Reply via email to