Review Board 1.7.22


HIVe-4523: round() function with specified decimal places not consistent with mysql

Review Request #15103 - Created Oct. 30, 2013 and updated

Xuefu Zhang
trunk
HIVE-4523
Reviewers
hive
hive-git
1. Migrate old, non-generic round udf to generic udf.
2. Addressed issues raised in the description.
Added test cases. Some old q test outputs are regenerated.
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
Revision 898b6a5 New Change
[20] 102 lines
[+20]
103
import org.apache.hadoop.hive.ql.udf.UDFRegExp;
103
import org.apache.hadoop.hive.ql.udf.UDFRegExp;
104
import org.apache.hadoop.hive.ql.udf.UDFRegExpExtract;
104
import org.apache.hadoop.hive.ql.udf.UDFRegExpExtract;
105
import org.apache.hadoop.hive.ql.udf.UDFRegExpReplace;
105
import org.apache.hadoop.hive.ql.udf.UDFRegExpReplace;
106
import org.apache.hadoop.hive.ql.udf.UDFRepeat;
106
import org.apache.hadoop.hive.ql.udf.UDFRepeat;
107
import org.apache.hadoop.hive.ql.udf.UDFReverse;
107
import org.apache.hadoop.hive.ql.udf.UDFReverse;
108
import org.apache.hadoop.hive.ql.udf.UDFRound;

   
109
import org.apache.hadoop.hive.ql.udf.UDFRpad;
108
import org.apache.hadoop.hive.ql.udf.UDFRpad;
110
import org.apache.hadoop.hive.ql.udf.UDFSecond;
109
import org.apache.hadoop.hive.ql.udf.UDFSecond;
111
import org.apache.hadoop.hive.ql.udf.UDFSign;
110
import org.apache.hadoop.hive.ql.udf.UDFSign;
112
import org.apache.hadoop.hive.ql.udf.UDFSin;
111
import org.apache.hadoop.hive.ql.udf.UDFSin;
113
import org.apache.hadoop.hive.ql.udf.UDFSpace;
112
import org.apache.hadoop.hive.ql.udf.UDFSpace;
[+20] [20] 87 lines
[+20]
201
    registerUDF("lpad", UDFLpad.class, false);
200
    registerUDF("lpad", UDFLpad.class, false);
202
    registerUDF("rpad", UDFRpad.class, false);
201
    registerUDF("rpad", UDFRpad.class, false);
203

    
   
202

   
204
    registerGenericUDF("size", GenericUDFSize.class);
203
    registerGenericUDF("size", GenericUDFSize.class);
205

    
   
204

   
206
    registerUDF("round", UDFRound.class, false);
205
    registerGenericUDF("round", GenericUDFRound.class);
207
    registerUDF("floor", UDFFloor.class, false);
206
    registerUDF("floor", UDFFloor.class, false);
208
    registerUDF("sqrt", UDFSqrt.class, false);
207
    registerUDF("sqrt", UDFSqrt.class, false);
209
    registerUDF("ceil", UDFCeil.class, false);
208
    registerUDF("ceil", UDFCeil.class, false);
210
    registerUDF("ceiling", UDFCeil.class, false);
209
    registerUDF("ceiling", UDFCeil.class, false);
211
    registerUDF("rand", UDFRand.class, false);
210
    registerUDF("rand", UDFRand.class, false);
[+20] [20] 1561 lines
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/RoundWithNumDigitsDoubleToDouble.java
Revision ca85688 New Change
 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
Revision 120095a New Change
 
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRound.java
Revision 6d5664b New Change
 
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java
New File
 
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/RoundUtils.java
New File
 
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizationContext.java
Revision 90ab983 New Change
 
ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFRound.java
Revision 992853d New Change
 
ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFRound.java
New File
 
ql/src/test/results/clientpositive/decimal_udf.q.out
Revision 652d1a8 New Change
 
ql/src/test/results/compiler/plan/udf4.q.xml
Revision b962f7e New Change
 
  1. ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java: Loading...
  2. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/RoundWithNumDigitsDoubleToDouble.java: Loading...
  3. ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java: Loading...
  4. ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRound.java: Loading...
  5. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java: Loading...
  6. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/RoundUtils.java: Loading...
  7. ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizationContext.java: Loading...
  8. ql/src/test/org/apache/hadoop/hive/ql/udf/TestUDFRound.java: Loading...
  9. ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFRound.java: Loading...
  10. ql/src/test/results/clientpositive/decimal_udf.q.out: Loading...
  11. ql/src/test/results/compiler/plan/udf4.q.xml: Loading...