HIVE-12063: Pad Decimal numbers with trailing zeros to the scale of the column 
(reviewed by Szehon)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/13f8cfec
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/13f8cfec
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/13f8cfec

Branch: refs/heads/spark
Commit: 13f8cfece819bec7ea045db92c18c6d7fc3784d0
Parents: 318c2ef
Author: Xuefu Zhang <xzh...@cloudera.com>
Authored: Tue Nov 3 19:41:17 2015 -0800
Committer: Xuefu Zhang <xzh...@cloudera.com>
Committed: Tue Nov 3 19:41:17 2015 -0800

----------------------------------------------------------------------
 .../hive/ql/exec/vector/VectorSerializeRow.java |   4 +-
 .../expressions/FilterStructColumnInList.java   |   3 +-
 .../vector/expressions/StructColumnInList.java  |   3 +-
 .../hive/ql/exec/vector/TestVectorSerDeRow.java |  19 +-
 .../test/results/clientpositive/acid_join.q.out |   2 +-
 .../alter_partition_change_col.q.out            | 240 ++---
 .../clientpositive/alter_table_cascade.q.out    |  40 +-
 .../clientpositive/ansi_sql_arithmetic.q.out    |   2 +-
 .../results/clientpositive/avro_decimal.q.out   |  10 +-
 .../clientpositive/avro_decimal_native.q.out    |  10 +-
 .../clientpositive/cast_qualified_types.q.out   |   2 +-
 .../results/clientpositive/decimal_1_1.q.out    |  48 +-
 .../test/results/clientpositive/decimal_3.q.out | 514 +++++-----
 .../test/results/clientpositive/decimal_4.q.out | 144 +--
 .../test/results/clientpositive/decimal_5.q.out | 180 ++--
 .../test/results/clientpositive/decimal_6.q.out |  92 +-
 .../results/clientpositive/decimal_join2.q.out  | 260 ++---
 .../clientpositive/decimal_precision.q.out      | 170 ++--
 .../clientpositive/decimal_trailing.q.out       |  42 +-
 .../results/clientpositive/decimal_udf.q.out    | 960 +++++++++----------
 .../insert_nonacid_from_acid.q.out              |  20 +-
 .../llap/hybridgrace_hashjoin_1.q.out           | 204 ++--
 .../clientpositive/llap/mapjoin_decimal.q.out   | 424 ++++----
 .../results/clientpositive/orc_file_dump.q.out  |   6 +-
 .../clientpositive/orc_predicate_pushdown.q.out |   4 +-
 .../clientpositive/parquet_decimal.q.out        |  16 +-
 .../clientpositive/parquet_ppd_boolean.q.out    | 180 ++--
 .../clientpositive/parquet_ppd_char.q.out       | 220 ++---
 .../clientpositive/parquet_ppd_date.q.out       | 330 +++----
 .../clientpositive/parquet_ppd_decimal.q.out    | 660 ++++++-------
 .../clientpositive/parquet_ppd_timestamp.q.out  | 320 +++----
 .../clientpositive/parquet_ppd_varchar.q.out    | 220 ++---
 .../parquet_predicate_pushdown.q.out            |   4 +-
 .../results/clientpositive/serde_regex.q.out    |  74 +-
 .../spark/avro_decimal_native.q.out             |  10 +-
 .../clientpositive/spark/decimal_1_1.q.out      |  48 +-
 .../clientpositive/spark/mapjoin_decimal.q.out  | 424 ++++----
 .../spark/vector_between_in.q.out               |  14 +-
 .../spark/vector_cast_constant.q.java1.7.out    |  20 +-
 .../spark/vector_data_types.q.out               |   4 +-
 .../spark/vector_decimal_aggregate.q.out        |  32 +-
 .../spark/vector_decimal_mapjoin.q.out          | 212 ++--
 .../clientpositive/sum_expr_with_order.q.out    |   2 +-
 .../tez/hybridgrace_hashjoin_1.q.out            | 204 ++--
 .../clientpositive/tez/mapjoin_decimal.q.out    | 424 ++++----
 .../clientpositive/tez/update_all_types.q.out   |  30 +-
 .../clientpositive/tez/vector_aggregate_9.q.out |   2 +-
 .../clientpositive/tez/vector_between_in.q.out  |  14 +-
 .../tez/vector_cast_constant.q.java1.7.out      |  20 +-
 .../clientpositive/tez/vector_data_types.q.out  |   4 +-
 .../clientpositive/tez/vector_decimal_2.q.out   |   4 +-
 .../clientpositive/tez/vector_decimal_3.q.out   | 514 +++++-----
 .../clientpositive/tez/vector_decimal_4.q.out   | 288 +++---
 .../clientpositive/tez/vector_decimal_5.q.out   | 180 ++--
 .../clientpositive/tez/vector_decimal_6.q.out   | 172 ++--
 .../tez/vector_decimal_aggregate.q.out          |  32 +-
 .../tez/vector_decimal_cast.q.out               |  20 +-
 .../tez/vector_decimal_expressions.q.out        |  20 +-
 .../tez/vector_decimal_mapjoin.q.out            | 212 ++--
 .../tez/vector_decimal_precision.q.out          | 170 ++--
 .../tez/vector_decimal_round_2.q.out            |  14 +-
 .../tez/vector_decimal_trailing.q.out           |  42 +-
 .../clientpositive/tez/vector_decimal_udf.q.out | 960 +++++++++----------
 .../tez/vector_reduce_groupby_decimal.q.out     |  98 +-
 .../clientpositive/update_all_types.q.out       |  30 +-
 .../clientpositive/vector_aggregate_9.q.out     |   2 +-
 .../clientpositive/vector_between_in.q.out      |  14 +-
 .../vector_cast_constant.q.java1.7.out          |  20 +-
 .../clientpositive/vector_data_types.q.out      |   4 +-
 .../clientpositive/vector_decimal_2.q.out       |   4 +-
 .../clientpositive/vector_decimal_3.q.out       | 514 +++++-----
 .../clientpositive/vector_decimal_4.q.out       | 288 +++---
 .../clientpositive/vector_decimal_5.q.out       | 180 ++--
 .../clientpositive/vector_decimal_6.q.out       | 172 ++--
 .../vector_decimal_aggregate.q.out              |  32 +-
 .../clientpositive/vector_decimal_cast.q.out    |  20 +-
 .../vector_decimal_expressions.q.out            |  20 +-
 .../clientpositive/vector_decimal_mapjoin.q.out | 212 ++--
 .../vector_decimal_precision.q.out              | 170 ++--
 .../clientpositive/vector_decimal_round_2.q.out |  14 +-
 .../vector_decimal_trailing.q.out               |  42 +-
 .../clientpositive/vector_decimal_udf.q.out     | 960 +++++++++----------
 .../vector_reduce_groupby_decimal.q.out         |  98 +-
 .../clientpositive/windowing_decimal.q.out      | 104 +-
 .../clientpositive/windowing_navfn.q.out        |  20 +-
 .../results/clientpositive/windowing_rank.q.out |  60 +-
 .../clientpositive/windowing_windowspec3.q.out  |  18 +-
 .../fast/BinarySortableSerializeWrite.java      |   2 +-
 .../hadoop/hive/serde2/fast/SerializeWrite.java |   2 +-
 .../hive/serde2/lazy/LazyHiveDecimal.java       |   4 +-
 .../hadoop/hive/serde2/lazy/LazyUtils.java      |   3 +-
 .../lazy/fast/LazySimpleSerializeWrite.java     |  14 +-
 .../fast/LazyBinarySerializeWrite.java          |   2 +-
 .../apache/hadoop/hive/serde2/VerifyFast.java   |   9 +-
 .../binarysortable/TestBinarySortableFast.java  |   3 +-
 .../hive/serde2/lazy/TestLazySimpleFast.java    |   3 +-
 .../serde2/lazybinary/TestLazyBinaryFast.java   |   3 +-
 .../hadoop/hive/common/type/HiveDecimal.java    |  11 +
 .../ql/exec/vector/DecimalColumnVector.java     |   2 -
 99 files changed, 6331 insertions(+), 6342 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSerializeRow.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSerializeRow.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSerializeRow.java
index fe889b5..c98c260 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSerializeRow.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSerializeRow.java
@@ -491,7 +491,7 @@ public final class VectorSerializeRow<T extends 
SerializeWrite> {
 
       if (colVector.isRepeating) {
         if (colVector.noNulls || !colVector.isNull[0]) {
-          
serializeWrite.writeHiveDecimal(colVector.vector[0].getHiveDecimal());
+          
serializeWrite.writeHiveDecimal(colVector.vector[0].getHiveDecimal(), 
colVector.scale);
           return true;
         } else {
           serializeWrite.writeNull();
@@ -499,7 +499,7 @@ public final class VectorSerializeRow<T extends 
SerializeWrite> {
         }
       } else {
         if (colVector.noNulls || !colVector.isNull[batchIndex]) {
-          
serializeWrite.writeHiveDecimal(colVector.vector[batchIndex].getHiveDecimal());
+          
serializeWrite.writeHiveDecimal(colVector.vector[batchIndex].getHiveDecimal(), 
colVector.scale);
           return true;
         } else {
           serializeWrite.writeNull();

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStructColumnInList.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStructColumnInList.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStructColumnInList.java
index 00f22bb..70b393c 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStructColumnInList.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStructColumnInList.java
@@ -110,8 +110,9 @@ public class FilterStructColumnInList extends 
FilterStringColumnInList implement
             break;
 
           case DECIMAL:
+            DecimalColumnVector decColVector = ((DecimalColumnVector) colVec);
             binarySortableSerializeWrite.writeHiveDecimal(
-                ((DecimalColumnVector) 
colVec).vector[adjustedIndex].getHiveDecimal());
+                decColVector.vector[adjustedIndex].getHiveDecimal(), 
decColVector.scale);
             break;
 
           default:

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StructColumnInList.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StructColumnInList.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StructColumnInList.java
index 724497a..769c70a 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StructColumnInList.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StructColumnInList.java
@@ -111,8 +111,9 @@ public class StructColumnInList extends StringColumnInList 
implements IStructInE
             break;
 
           case DECIMAL:
+            DecimalColumnVector decColVector = ((DecimalColumnVector) colVec);
             binarySortableSerializeWrite.writeHiveDecimal(
-                ((DecimalColumnVector) 
colVec).vector[adjustedIndex].getHiveDecimal());
+                decColVector.vector[adjustedIndex].getHiveDecimal(), 
decColVector.scale);
             break;
 
           default:

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorSerDeRow.java
----------------------------------------------------------------------
diff --git 
a/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorSerDeRow.java 
b/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorSerDeRow.java
index 23e44f0..eaff732 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorSerDeRow.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorSerDeRow.java
@@ -57,21 +57,10 @@ import 
org.apache.hadoop.hive.serde2.lazy.fast.LazySimpleSerializeWrite;
 import org.apache.hadoop.hive.serde2.lazybinary.fast.LazyBinaryDeserializeRead;
 import org.apache.hadoop.hive.serde2.lazybinary.fast.LazyBinarySerializeWrite;
 import 
org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableByteObjectInspector;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableDateObjectInspector;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableDoubleObjectInspector;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableFloatObjectInspector;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableLongObjectInspector;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableShortObjectInspector;
-import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableStringObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
 import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
-import org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
-import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo;
 import org.apache.hadoop.hive.serde2.fast.SerializeWrite;
 import org.apache.hadoop.io.BooleanWritable;
 import org.apache.hadoop.io.BytesWritable;
@@ -415,10 +404,10 @@ public class TestVectorSerDeRow extends TestCase {
   private Output serializeRow(Object[] row, RandomRowObjectSource source, 
SerializeWrite serializeWrite) throws HiveException, IOException {
     Output output = new Output();
     serializeWrite.set(output);
-    PrimitiveCategory[] primitiveCategories = source.primitiveCategories();
-    for (int i = 0; i < primitiveCategories.length; i++) {
+    PrimitiveTypeInfo[] primitiveTypeInfos = source.primitiveTypeInfos();
+    for (int i = 0; i < primitiveTypeInfos.length; i++) {
       Object object = row[i];
-      PrimitiveCategory primitiveCategory = primitiveCategories[i];
+      PrimitiveCategory primitiveCategory = 
primitiveTypeInfos[i].getPrimitiveCategory();
       switch (primitiveCategory) {
       case BOOLEAN:
         {
@@ -529,7 +518,7 @@ public class TestVectorSerDeRow extends TestCase {
         {
           HiveDecimalWritable expectedWritable = (HiveDecimalWritable) object;
           HiveDecimal value = expectedWritable.getHiveDecimal();
-          serializeWrite.writeHiveDecimal(value);
+          serializeWrite.writeHiveDecimal(value, 
((DecimalTypeInfo)primitiveTypeInfos[i]).scale());
         }
         break;
       default:

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/acid_join.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/acid_join.q.out 
b/ql/src/test/results/clientpositive/acid_join.q.out
index a1edb89..fcc7d75 100644
--- a/ql/src/test/results/clientpositive/acid_join.q.out
+++ b/ql/src/test/results/clientpositive/acid_join.q.out
@@ -65,7 +65,7 @@ POSTHOOK: query: select * from acidjoin3 order by name
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@acidjoin3
 #### A masked pattern was here ####
-aaa    35      3
+aaa    35      3.00
 bbb    32      3.01
 ccc    32      3.02
 ddd    35      3.03

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/alter_partition_change_col.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/alter_partition_change_col.q.out 
b/ql/src/test/results/clientpositive/alter_partition_change_col.q.out
index 50520aa..9e397c1 100644
--- a/ql/src/test/results/clientpositive/alter_partition_change_col.q.out
+++ b/ql/src/test/results/clientpositive/alter_partition_change_col.q.out
@@ -213,16 +213,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: default@alter_partition_change_col1@p1=abc/p2=123
 #### A masked pattern was here ####
-Beck   0       abc     123
-Beck   77      abc     123
-Beck   80      abc     123
-Cluck  6       abc     123
-Mary   33      abc     123
-Mary   4       abc     123
-Snow   56      abc     123
-Tom    -12     abc     123
-Tom    19      abc     123
-Tom    235     abc     123
+Beck   0.0000  abc     123
+Beck   77.0000 abc     123
+Beck   80.0000 abc     123
+Cluck  6.0000  abc     123
+Mary   33.0000 abc     123
+Mary   4.0000  abc     123
+Snow   56.0000 abc     123
+Tom    -12.0000        abc     123
+Tom    19.0000 abc     123
+Tom    235.0000        abc     123
 PREHOOK: query: select * from alter_partition_change_col1 where 
p1='__HIVE_DEFAULT_PARTITION__'
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alter_partition_change_col1
@@ -233,16 +233,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: 
default@alter_partition_change_col1@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77      __HIVE_DEFAULT_PARTITION__      123
-Beck   80      __HIVE_DEFAULT_PARTITION__      123
-Cluck  6       __HIVE_DEFAULT_PARTITION__      123
-Mary   33      __HIVE_DEFAULT_PARTITION__      123
-Mary   4       __HIVE_DEFAULT_PARTITION__      123
-Snow   56      __HIVE_DEFAULT_PARTITION__      123
-Tom    -12     __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    235     __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.0000 __HIVE_DEFAULT_PARTITION__      123
+Beck   80.0000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  6.0000  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.0000 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.0000  __HIVE_DEFAULT_PARTITION__      123
+Snow   56.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.0000        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    235.0000        __HIVE_DEFAULT_PARTITION__      123
 PREHOOK: query: -- now change the column type of the existing partition
 alter table alter_partition_change_col1 partition (p1='abc', p2='123') change 
c2 c2 decimal(14,4)
 PREHOOK: type: ALTERTABLE_RENAMECOL
@@ -280,16 +280,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: default@alter_partition_change_col1@p1=abc/p2=123
 #### A masked pattern was here ####
-Beck   0       abc     123
-Beck   77.341  abc     123
-Beck   79.9    abc     123
-Cluck  5.96    abc     123
-Mary   33.33   abc     123
-Mary   4.329   abc     123
-Snow   55.71   abc     123
-Tom    -12.25  abc     123
-Tom    19      abc     123
-Tom    234.79  abc     123
+Beck   0.0000  abc     123
+Beck   77.3410 abc     123
+Beck   79.9000 abc     123
+Cluck  5.9600  abc     123
+Mary   33.3300 abc     123
+Mary   4.3290  abc     123
+Snow   55.7100 abc     123
+Tom    -12.2500        abc     123
+Tom    19.0000 abc     123
+Tom    234.7900        abc     123
 PREHOOK: query: select * from alter_partition_change_col1 where 
p1='__HIVE_DEFAULT_PARTITION__'
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alter_partition_change_col1
@@ -300,16 +300,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: 
default@alter_partition_change_col1@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77      __HIVE_DEFAULT_PARTITION__      123
-Beck   80      __HIVE_DEFAULT_PARTITION__      123
-Cluck  6       __HIVE_DEFAULT_PARTITION__      123
-Mary   33      __HIVE_DEFAULT_PARTITION__      123
-Mary   4       __HIVE_DEFAULT_PARTITION__      123
-Snow   56      __HIVE_DEFAULT_PARTITION__      123
-Tom    -12     __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    235     __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.0000 __HIVE_DEFAULT_PARTITION__      123
+Beck   80.0000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  6.0000  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.0000 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.0000  __HIVE_DEFAULT_PARTITION__      123
+Snow   56.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.0000        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    235.0000        __HIVE_DEFAULT_PARTITION__      123
 PREHOOK: query: -- change column for default partition value
 alter table alter_partition_change_col1 partition 
(p1='__HIVE_DEFAULT_PARTITION__', p2='123') change c2 c2 decimal(14,4)
 PREHOOK: type: ALTERTABLE_RENAMECOL
@@ -347,16 +347,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: default@alter_partition_change_col1@p1=abc/p2=123
 #### A masked pattern was here ####
-Beck   0       abc     123
-Beck   77.341  abc     123
-Beck   79.9    abc     123
-Cluck  5.96    abc     123
-Mary   33.33   abc     123
-Mary   4.329   abc     123
-Snow   55.71   abc     123
-Tom    -12.25  abc     123
-Tom    19      abc     123
-Tom    234.79  abc     123
+Beck   0.0000  abc     123
+Beck   77.3410 abc     123
+Beck   79.9000 abc     123
+Cluck  5.9600  abc     123
+Mary   33.3300 abc     123
+Mary   4.3290  abc     123
+Snow   55.7100 abc     123
+Tom    -12.2500        abc     123
+Tom    19.0000 abc     123
+Tom    234.7900        abc     123
 PREHOOK: query: select * from alter_partition_change_col1 where 
p1='__HIVE_DEFAULT_PARTITION__'
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alter_partition_change_col1
@@ -367,16 +367,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: 
default@alter_partition_change_col1@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77.341  __HIVE_DEFAULT_PARTITION__      123
-Beck   79.9    __HIVE_DEFAULT_PARTITION__      123
-Cluck  5.96    __HIVE_DEFAULT_PARTITION__      123
-Mary   33.33   __HIVE_DEFAULT_PARTITION__      123
-Mary   4.329   __HIVE_DEFAULT_PARTITION__      123
-Snow   55.71   __HIVE_DEFAULT_PARTITION__      123
-Tom    -12.25  __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    234.79  __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.3410 __HIVE_DEFAULT_PARTITION__      123
+Beck   79.9000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  5.9600  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.3300 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.3290  __HIVE_DEFAULT_PARTITION__      123
+Snow   55.7100 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.2500        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    234.7900        __HIVE_DEFAULT_PARTITION__      123
 PREHOOK: query: -- Try out replace columns
 alter table alter_partition_change_col1 partition (p1='abc', p2='123') replace 
columns (c1 string)
 PREHOOK: type: ALTERTABLE_REPLACECOLS
@@ -449,16 +449,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: 
default@alter_partition_change_col1@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77.341  __HIVE_DEFAULT_PARTITION__      123
-Beck   79.9    __HIVE_DEFAULT_PARTITION__      123
-Cluck  5.96    __HIVE_DEFAULT_PARTITION__      123
-Mary   33.33   __HIVE_DEFAULT_PARTITION__      123
-Mary   4.329   __HIVE_DEFAULT_PARTITION__      123
-Snow   55.71   __HIVE_DEFAULT_PARTITION__      123
-Tom    -12.25  __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    234.79  __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.3410 __HIVE_DEFAULT_PARTITION__      123
+Beck   79.9000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  5.9600  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.3300 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.3290  __HIVE_DEFAULT_PARTITION__      123
+Snow   55.7100 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.2500        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    234.7900        __HIVE_DEFAULT_PARTITION__      123
 PREHOOK: query: alter table alter_partition_change_col1 replace columns (c1 
string)
 PREHOOK: type: ALTERTABLE_REPLACECOLS
 PREHOOK: Input: default@alter_partition_change_col1
@@ -593,16 +593,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: 
default@alter_partition_change_col1@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77.341  __HIVE_DEFAULT_PARTITION__      123
-Beck   79.9    __HIVE_DEFAULT_PARTITION__      123
-Cluck  5.96    __HIVE_DEFAULT_PARTITION__      123
-Mary   33.33   __HIVE_DEFAULT_PARTITION__      123
-Mary   4.329   __HIVE_DEFAULT_PARTITION__      123
-Snow   55.71   __HIVE_DEFAULT_PARTITION__      123
-Tom    -12.25  __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    234.79  __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.3410 __HIVE_DEFAULT_PARTITION__      123
+Beck   79.9000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  5.9600  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.3300 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.3290  __HIVE_DEFAULT_PARTITION__      123
+Snow   55.7100 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.2500        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    234.7900        __HIVE_DEFAULT_PARTITION__      123
 PREHOOK: query: alter table alter_partition_change_col1 partition (p1='abc', 
p2='123') add columns (c2 decimal(14,4))
 PREHOOK: type: ALTERTABLE_ADDCOLS
 PREHOOK: Input: default@alter_partition_change_col1
@@ -638,16 +638,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: default@alter_partition_change_col1@p1=abc/p2=123
 #### A masked pattern was here ####
-Beck   0       abc     123
-Beck   77.341  abc     123
-Beck   79.9    abc     123
-Cluck  5.96    abc     123
-Mary   33.33   abc     123
-Mary   4.329   abc     123
-Snow   55.71   abc     123
-Tom    -12.25  abc     123
-Tom    19      abc     123
-Tom    234.79  abc     123
+Beck   0.0000  abc     123
+Beck   77.3410 abc     123
+Beck   79.9000 abc     123
+Cluck  5.9600  abc     123
+Mary   33.3300 abc     123
+Mary   4.3290  abc     123
+Snow   55.7100 abc     123
+Tom    -12.2500        abc     123
+Tom    19.0000 abc     123
+Tom    234.7900        abc     123
 PREHOOK: query: select * from alter_partition_change_col1 where 
p1='__HIVE_DEFAULT_PARTITION__'
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alter_partition_change_col1
@@ -658,16 +658,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: 
default@alter_partition_change_col1@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77.341  __HIVE_DEFAULT_PARTITION__      123
-Beck   79.9    __HIVE_DEFAULT_PARTITION__      123
-Cluck  5.96    __HIVE_DEFAULT_PARTITION__      123
-Mary   33.33   __HIVE_DEFAULT_PARTITION__      123
-Mary   4.329   __HIVE_DEFAULT_PARTITION__      123
-Snow   55.71   __HIVE_DEFAULT_PARTITION__      123
-Tom    -12.25  __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    234.79  __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.3410 __HIVE_DEFAULT_PARTITION__      123
+Beck   79.9000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  5.9600  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.3300 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.3290  __HIVE_DEFAULT_PARTITION__      123
+Snow   55.7100 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.2500        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    234.7900        __HIVE_DEFAULT_PARTITION__      123
 PREHOOK: query: -- Try changing column for all partitions at once
 alter table alter_partition_change_col1 partition (p1, p2='123') change column 
c2 c2 decimal(10,0)
 PREHOOK: type: ALTERTABLE_RENAMECOL
@@ -724,16 +724,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: default@alter_partition_change_col1@p1=abc/p2=123
 #### A masked pattern was here ####
-Beck   0       abc     123
-Beck   77      abc     123
-Beck   80      abc     123
-Cluck  6       abc     123
-Mary   33      abc     123
-Mary   4       abc     123
-Snow   56      abc     123
-Tom    -12     abc     123
-Tom    19      abc     123
-Tom    235     abc     123
+Beck   0.0000  abc     123
+Beck   77.0000 abc     123
+Beck   80.0000 abc     123
+Cluck  6.0000  abc     123
+Mary   33.0000 abc     123
+Mary   4.0000  abc     123
+Snow   56.0000 abc     123
+Tom    -12.0000        abc     123
+Tom    19.0000 abc     123
+Tom    235.0000        abc     123
 PREHOOK: query: select * from alter_partition_change_col1 where 
p1='__HIVE_DEFAULT_PARTITION__'
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alter_partition_change_col1
@@ -744,13 +744,13 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_partition_change_col1
 POSTHOOK: Input: 
default@alter_partition_change_col1@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77      __HIVE_DEFAULT_PARTITION__      123
-Beck   80      __HIVE_DEFAULT_PARTITION__      123
-Cluck  6       __HIVE_DEFAULT_PARTITION__      123
-Mary   33      __HIVE_DEFAULT_PARTITION__      123
-Mary   4       __HIVE_DEFAULT_PARTITION__      123
-Snow   56      __HIVE_DEFAULT_PARTITION__      123
-Tom    -12     __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    235     __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.0000 __HIVE_DEFAULT_PARTITION__      123
+Beck   80.0000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  6.0000  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.0000 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.0000  __HIVE_DEFAULT_PARTITION__      123
+Snow   56.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.0000        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    235.0000        __HIVE_DEFAULT_PARTITION__      123

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/alter_table_cascade.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/alter_table_cascade.q.out 
b/ql/src/test/results/clientpositive/alter_table_cascade.q.out
index 3bf1a43..1d8204c 100644
--- a/ql/src/test/results/clientpositive/alter_table_cascade.q.out
+++ b/ql/src/test/results/clientpositive/alter_table_cascade.q.out
@@ -833,16 +833,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_table_cascade
 POSTHOOK: Input: default@alter_table_cascade@p1=xyz/p2=123
 #### A masked pattern was here ####
-Beck   0       xyz     123
-Beck   77.341  xyz     123
-Beck   79.9    xyz     123
-Cluck  5.96    xyz     123
-Mary   33.33   xyz     123
-Mary   4.329   xyz     123
-Snow   55.71   xyz     123
-Tom    -12.25  xyz     123
-Tom    19      xyz     123
-Tom    234.79  xyz     123
+Beck   0.0000  xyz     123
+Beck   77.3410 xyz     123
+Beck   79.9000 xyz     123
+Cluck  5.9600  xyz     123
+Mary   33.3300 xyz     123
+Mary   4.3290  xyz     123
+Snow   55.7100 xyz     123
+Tom    -12.2500        xyz     123
+Tom    19.0000 xyz     123
+Tom    234.7900        xyz     123
 PREHOOK: query: select * from alter_table_cascade where p1='abc'
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alter_table_cascade
@@ -873,16 +873,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_table_cascade
 POSTHOOK: Input: 
default@alter_table_cascade@p1=__HIVE_DEFAULT_PARTITION__/p2=123
 #### A masked pattern was here ####
-Beck   0       __HIVE_DEFAULT_PARTITION__      123
-Beck   77.341  __HIVE_DEFAULT_PARTITION__      123
-Beck   79.9    __HIVE_DEFAULT_PARTITION__      123
-Cluck  5.96    __HIVE_DEFAULT_PARTITION__      123
-Mary   33.33   __HIVE_DEFAULT_PARTITION__      123
-Mary   4.329   __HIVE_DEFAULT_PARTITION__      123
-Snow   55.71   __HIVE_DEFAULT_PARTITION__      123
-Tom    -12.25  __HIVE_DEFAULT_PARTITION__      123
-Tom    19      __HIVE_DEFAULT_PARTITION__      123
-Tom    234.79  __HIVE_DEFAULT_PARTITION__      123
+Beck   0.0000  __HIVE_DEFAULT_PARTITION__      123
+Beck   77.3410 __HIVE_DEFAULT_PARTITION__      123
+Beck   79.9000 __HIVE_DEFAULT_PARTITION__      123
+Cluck  5.9600  __HIVE_DEFAULT_PARTITION__      123
+Mary   33.3300 __HIVE_DEFAULT_PARTITION__      123
+Mary   4.3290  __HIVE_DEFAULT_PARTITION__      123
+Snow   55.7100 __HIVE_DEFAULT_PARTITION__      123
+Tom    -12.2500        __HIVE_DEFAULT_PARTITION__      123
+Tom    19.0000 __HIVE_DEFAULT_PARTITION__      123
+Tom    234.7900        __HIVE_DEFAULT_PARTITION__      123
 PREHOOK: query: -- 
 
 drop table if exists alter_table_restrict

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out 
b/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
index 5e5a2f6..021c4ee 100644
--- a/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
+++ b/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
@@ -44,7 +44,7 @@ POSTHOOK: query: select cast(key as int) / cast(key as int) 
from src limit 1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-1
+1.00000000000
 PREHOOK: query: -- With ansi sql arithmetic disabled, int / int => double
 explain select cast(key as int) / cast(key as int) from src limit 1
 PREHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/avro_decimal.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/avro_decimal.q.out 
b/ql/src/test/results/clientpositive/avro_decimal.q.out
index 7ba376e..64e65ca 100644
--- a/ql/src/test/results/clientpositive/avro_decimal.q.out
+++ b/ql/src/test/results/clientpositive/avro_decimal.q.out
@@ -106,9 +106,9 @@ Mary        4.33
 Cluck  5.96
 Tom    -12.25
 Mary   33.33
-Tom    19
-Beck   0
-Beck   79.9
+Tom    19.00
+Beck   0.00
+Beck   79.90
 PREHOOK: query: DROP TABLE IF EXISTS avro_dec1
 PREHOOK: type: DROPTABLE
 POSTHOOK: query: DROP TABLE IF EXISTS avro_dec1
@@ -175,10 +175,10 @@ POSTHOOK: Input: default@avro_dec1
 77.3
 55.7
 4.3
-6
+6.0
 12.3
 33.3
-19
+19.0
 3.2
 79.9
 PREHOOK: query: DROP TABLE dec

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/avro_decimal_native.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/avro_decimal_native.q.out 
b/ql/src/test/results/clientpositive/avro_decimal_native.q.out
index 318be3d..cebc342 100644
--- a/ql/src/test/results/clientpositive/avro_decimal_native.q.out
+++ b/ql/src/test/results/clientpositive/avro_decimal_native.q.out
@@ -92,9 +92,9 @@ Mary  4.33
 Cluck  5.96
 Tom    -12.25
 Mary   33.33
-Tom    19
-Beck   0
-Beck   79.9
+Tom    19.00
+Beck   0.00
+Beck   79.90
 PREHOOK: query: DROP TABLE IF EXISTS avro_dec1
 PREHOOK: type: DROPTABLE
 POSTHOOK: query: DROP TABLE IF EXISTS avro_dec1
@@ -143,10 +143,10 @@ POSTHOOK: Input: default@avro_dec1
 77.3
 55.7
 4.3
-6
+6.0
 12.3
 33.3
-19
+19.0
 3.2
 79.9
 PREHOOK: query: DROP TABLE dec

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/cast_qualified_types.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cast_qualified_types.q.out 
b/ql/src/test/results/clientpositive/cast_qualified_types.q.out
index 1924c5d..099a199 100644
--- a/ql/src/test/results/clientpositive/cast_qualified_types.q.out
+++ b/ql/src/test/results/clientpositive/cast_qualified_types.q.out
@@ -18,4 +18,4 @@ limit 1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-0      0               0
+0.00   0               0

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_1_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_1_1.q.out 
b/ql/src/test/results/clientpositive/decimal_1_1.q.out
index b2704c6..46fbeb7 100644
--- a/ql/src/test/results/clientpositive/decimal_1_1.q.out
+++ b/ql/src/test/results/clientpositive/decimal_1_1.q.out
@@ -26,9 +26,9 @@ POSTHOOK: query: select * from decimal_1_1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_1_1
 #### A masked pattern was here ####
-0
-0
-0
+0.0
+0.0
+0.0
 0.1
 0.2
 0.9
@@ -37,13 +37,13 @@ NULL
 0.3
 NULL
 NULL
-0
-0
+0.0
+0.0
 NULL
-0
-0
-0
-0
+0.0
+0.0
+0.0
+0.0
 -0.1
 -0.2
 -0.9
@@ -52,10 +52,10 @@ NULL
 -0.3
 NULL
 NULL
-0
-0
+0.0
+0.0
 NULL
-0
+0.0
 PREHOOK: query: select d from decimal_1_1 order by d desc
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_1_1
@@ -69,18 +69,18 @@ POSTHOOK: Input: default@decimal_1_1
 0.3
 0.2
 0.1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
 -0.1
 -0.2
 -0.3

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_3.q.out 
b/ql/src/test/results/clientpositive/decimal_3.q.out
index 8e9a30a..3ded9a7 100644
--- a/ql/src/test/results/clientpositive/decimal_3.q.out
+++ b/ql/src/test/results/clientpositive/decimal_3.q.out
@@ -33,43 +33,43 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
 NULL   0
--1234567890.123456789  -1234567890
--4400  4400
--1255.49       -1255
--1.122 -11
--1.12  -1
--1.12  -1
--0.333 0
--0.33  0
--0.3   0
-0      0
-0      0
-0      0
-0.01   0
-0.02   0
-0.1    0
-0.2    0
-0.3    0
-0.33   0
-0.333  0
-1      1
-1      1
-1      1
-1.12   1
-1.122  1
-2      2
-2      2
-3.14   3
-3.14   3
-3.14   3
-3.14   4
-10     10
-20     20
-100    100
-124    124
-125.2  125
-200    200
-1234567890.12345678    1234567890
+-1234567890.123456789000000000 -1234567890
+-4400.000000000000000000       4400
+-1255.490000000000000000       -1255
+-1.122000000000000000  -11
+-1.120000000000000000  -1
+-1.120000000000000000  -1
+-0.333000000000000000  0
+-0.330000000000000000  0
+-0.300000000000000000  0
+0.000000000000000000   0
+0.000000000000000000   0
+0.000000000000000000   0
+0.010000000000000000   0
+0.020000000000000000   0
+0.100000000000000000   0
+0.200000000000000000   0
+0.300000000000000000   0
+0.330000000000000000   0
+0.333000000000000000   0
+1.000000000000000000   1
+1.000000000000000000   1
+1.000000000000000000   1
+1.120000000000000000   1
+1.122000000000000000   1
+2.000000000000000000   2
+2.000000000000000000   2
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   4
+10.000000000000000000  10
+20.000000000000000000  20
+100.000000000000000000 100
+124.000000000000000000 124
+125.200000000000000000 125
+200.000000000000000000 200
+1234567890.123456780000000000  1234567890
 PREHOOK: query: SELECT * FROM DECIMAL_3 ORDER BY key DESC, value DESC
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_3
@@ -78,43 +78,43 @@ POSTHOOK: query: SELECT * FROM DECIMAL_3 ORDER BY key DESC, 
value DESC
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
-1234567890.12345678    1234567890
-200    200
-125.2  125
-124    124
-100    100
-20     20
-10     10
-3.14   4
-3.14   3
-3.14   3
-3.14   3
-2      2
-2      2
-1.122  1
-1.12   1
-1      1
-1      1
-1      1
-0.333  0
-0.33   0
-0.3    0
-0.2    0
-0.1    0
-0.02   0
-0.01   0
-0      0
-0      0
-0      0
--0.3   0
--0.33  0
--0.333 0
--1.12  -1
--1.12  -1
--1.122 -11
--1255.49       -1255
--4400  4400
--1234567890.123456789  -1234567890
+1234567890.123456780000000000  1234567890
+200.000000000000000000 200
+125.200000000000000000 125
+124.000000000000000000 124
+100.000000000000000000 100
+20.000000000000000000  20
+10.000000000000000000  10
+3.140000000000000000   4
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   3
+2.000000000000000000   2
+2.000000000000000000   2
+1.122000000000000000   1
+1.120000000000000000   1
+1.000000000000000000   1
+1.000000000000000000   1
+1.000000000000000000   1
+0.333000000000000000   0
+0.330000000000000000   0
+0.300000000000000000   0
+0.200000000000000000   0
+0.100000000000000000   0
+0.020000000000000000   0
+0.010000000000000000   0
+0.000000000000000000   0
+0.000000000000000000   0
+0.000000000000000000   0
+-0.300000000000000000  0
+-0.330000000000000000  0
+-0.333000000000000000  0
+-1.120000000000000000  -1
+-1.120000000000000000  -1
+-1.122000000000000000  -11
+-1255.490000000000000000       -1255
+-4400.000000000000000000       4400
+-1234567890.123456789000000000 -1234567890
 NULL   0
 PREHOOK: query: SELECT * FROM DECIMAL_3 ORDER BY key, value
 PREHOOK: type: QUERY
@@ -125,43 +125,43 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
 NULL   0
--1234567890.123456789  -1234567890
--4400  4400
--1255.49       -1255
--1.122 -11
--1.12  -1
--1.12  -1
--0.333 0
--0.33  0
--0.3   0
-0      0
-0      0
-0      0
-0.01   0
-0.02   0
-0.1    0
-0.2    0
-0.3    0
-0.33   0
-0.333  0
-1      1
-1      1
-1      1
-1.12   1
-1.122  1
-2      2
-2      2
-3.14   3
-3.14   3
-3.14   3
-3.14   4
-10     10
-20     20
-100    100
-124    124
-125.2  125
-200    200
-1234567890.12345678    1234567890
+-1234567890.123456789000000000 -1234567890
+-4400.000000000000000000       4400
+-1255.490000000000000000       -1255
+-1.122000000000000000  -11
+-1.120000000000000000  -1
+-1.120000000000000000  -1
+-0.333000000000000000  0
+-0.330000000000000000  0
+-0.300000000000000000  0
+0.000000000000000000   0
+0.000000000000000000   0
+0.000000000000000000   0
+0.010000000000000000   0
+0.020000000000000000   0
+0.100000000000000000   0
+0.200000000000000000   0
+0.300000000000000000   0
+0.330000000000000000   0
+0.333000000000000000   0
+1.000000000000000000   1
+1.000000000000000000   1
+1.000000000000000000   1
+1.120000000000000000   1
+1.122000000000000000   1
+2.000000000000000000   2
+2.000000000000000000   2
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   4
+10.000000000000000000  10
+20.000000000000000000  20
+100.000000000000000000 100
+124.000000000000000000 124
+125.200000000000000000 125
+200.000000000000000000 200
+1234567890.123456780000000000  1234567890
 PREHOOK: query: SELECT DISTINCT key FROM DECIMAL_3 ORDER BY key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_3
@@ -171,34 +171,34 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
 NULL
--1234567890.123456789
--4400
--1255.49
--1.122
--1.12
--0.333
--0.33
--0.3
-0
-0.01
-0.02
-0.1
-0.2
-0.3
-0.33
-0.333
-1
-1.12
-1.122
-2
-3.14
-10
-20
-100
-124
-125.2
-200
-1234567890.12345678
+-1234567890.123456789000000000
+-4400.000000000000000000
+-1255.490000000000000000
+-1.122000000000000000
+-1.120000000000000000
+-0.333000000000000000
+-0.330000000000000000
+-0.300000000000000000
+0.000000000000000000
+0.010000000000000000
+0.020000000000000000
+0.100000000000000000
+0.200000000000000000
+0.300000000000000000
+0.330000000000000000
+0.333000000000000000
+1.000000000000000000
+1.120000000000000000
+1.122000000000000000
+2.000000000000000000
+3.140000000000000000
+10.000000000000000000
+20.000000000000000000
+100.000000000000000000
+124.000000000000000000
+125.200000000000000000
+200.000000000000000000
+1234567890.123456780000000000
 PREHOOK: query: SELECT key, sum(value) FROM DECIMAL_3 GROUP BY key ORDER BY key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_3
@@ -208,34 +208,34 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
 NULL   0
--1234567890.123456789  -1234567890
--4400  4400
--1255.49       -1255
--1.122 -11
--1.12  -2
--0.333 0
--0.33  0
--0.3   0
-0      0
-0.01   0
-0.02   0
-0.1    0
-0.2    0
-0.3    0
-0.33   0
-0.333  0
-1      3
-1.12   1
-1.122  1
-2      4
-3.14   13
-10     10
-20     20
-100    100
-124    124
-125.2  125
-200    200
-1234567890.12345678    1234567890
+-1234567890.123456789000000000 -1234567890
+-4400.000000000000000000       4400
+-1255.490000000000000000       -1255
+-1.122000000000000000  -11
+-1.120000000000000000  -2
+-0.333000000000000000  0
+-0.330000000000000000  0
+-0.300000000000000000  0
+0.000000000000000000   0
+0.010000000000000000   0
+0.020000000000000000   0
+0.100000000000000000   0
+0.200000000000000000   0
+0.300000000000000000   0
+0.330000000000000000   0
+0.333000000000000000   0
+1.000000000000000000   3
+1.120000000000000000   1
+1.122000000000000000   1
+2.000000000000000000   4
+3.140000000000000000   13
+10.000000000000000000  10
+20.000000000000000000  20
+100.000000000000000000 100
+124.000000000000000000 124
+125.200000000000000000 125
+200.000000000000000000 200
+1234567890.123456780000000000  1234567890
 PREHOOK: query: SELECT value, sum(key) FROM DECIMAL_3 GROUP BY value ORDER BY 
value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_3
@@ -244,23 +244,23 @@ POSTHOOK: query: SELECT value, sum(key) FROM DECIMAL_3 
GROUP BY value ORDER BY v
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
--1234567890    -1234567890.123456789
--1255  -1255.49
--11    -1.122
--1     -2.24
-0      0.33
-1      5.242
-2      4
-3      9.42
-4      3.14
-10     10
-20     20
-100    100
-124    124
-125    125.2
-200    200
-4400   -4400
-1234567890     1234567890.12345678
+-1234567890    -1234567890.123456789000000000
+-1255  -1255.490000000000000000
+-11    -1.122000000000000000
+-1     -2.240000000000000000
+0      0.330000000000000000
+1      5.242000000000000000
+2      4.000000000000000000
+3      9.420000000000000000
+4      3.140000000000000000
+10     10.000000000000000000
+20     20.000000000000000000
+100    100.000000000000000000
+124    124.000000000000000000
+125    125.200000000000000000
+200    200.000000000000000000
+4400   -4400.000000000000000000
+1234567890     1234567890.123456780000000000
 PREHOOK: query: SELECT * FROM DECIMAL_3 a JOIN DECIMAL_3 b ON (a.key = b.key) 
ORDER BY a.key, a.value, b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_3
@@ -269,71 +269,71 @@ POSTHOOK: query: SELECT * FROM DECIMAL_3 a JOIN DECIMAL_3 
b ON (a.key = b.key) O
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
--1234567890.123456789  -1234567890     -1234567890.123456789   -1234567890
--4400  4400    -4400   4400
--1255.49       -1255   -1255.49        -1255
--1.122 -11     -1.122  -11
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--0.333 0       -0.333  0
--0.33  0       -0.33   0
--0.3   0       -0.3    0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0.01   0       0.01    0
-0.02   0       0.02    0
-0.1    0       0.1     0
-0.2    0       0.2     0
-0.3    0       0.3     0
-0.33   0       0.33    0
-0.333  0       0.333   0
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1.12   1       1.12    1
-1.122  1       1.122   1
-2      2       2       2
-2      2       2       2
-2      2       2       2
-2      2       2       2
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    4
-3.14   3       3.14    4
-3.14   3       3.14    4
-3.14   4       3.14    3
-3.14   4       3.14    3
-3.14   4       3.14    3
-3.14   4       3.14    4
-10     10      10      10
-20     20      20      20
-100    100     100     100
-124    124     124     124
-125.2  125     125.2   125
-200    200     200     200
-1234567890.12345678    1234567890      1234567890.12345678     1234567890
+-1234567890.123456789000000000 -1234567890     -1234567890.123456789000000000  
-1234567890
+-4400.000000000000000000       4400    -4400.000000000000000000        4400
+-1255.490000000000000000       -1255   -1255.490000000000000000        -1255
+-1.122000000000000000  -11     -1.122000000000000000   -11
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-0.333000000000000000  0       -0.333000000000000000   0
+-0.330000000000000000  0       -0.330000000000000000   0
+-0.300000000000000000  0       -0.300000000000000000   0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.010000000000000000   0       0.010000000000000000    0
+0.020000000000000000   0       0.020000000000000000    0
+0.100000000000000000   0       0.100000000000000000    0
+0.200000000000000000   0       0.200000000000000000    0
+0.300000000000000000   0       0.300000000000000000    0
+0.330000000000000000   0       0.330000000000000000    0
+0.333000000000000000   0       0.333000000000000000    0
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.120000000000000000   1       1.120000000000000000    1
+1.122000000000000000   1       1.122000000000000000    1
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    4
+10.000000000000000000  10      10.000000000000000000   10
+20.000000000000000000  20      20.000000000000000000   20
+100.000000000000000000 100     100.000000000000000000  100
+124.000000000000000000 124     124.000000000000000000  124
+125.200000000000000000 125     125.200000000000000000  125
+200.000000000000000000 200     200.000000000000000000  200
+1234567890.123456780000000000  1234567890      1234567890.123456780000000000   
1234567890
 PREHOOK: query: SELECT * FROM DECIMAL_3 WHERE key=3.14 ORDER BY key, value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_3
@@ -342,10 +342,10 @@ POSTHOOK: query: SELECT * FROM DECIMAL_3 WHERE key=3.14 
ORDER BY key, value
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
-3.14   3
-3.14   3
-3.14   3
-3.14   4
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   4
 PREHOOK: query: SELECT * FROM DECIMAL_3 WHERE key=3.140 ORDER BY key, value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_3
@@ -354,10 +354,10 @@ POSTHOOK: query: SELECT * FROM DECIMAL_3 WHERE key=3.140 
ORDER BY key, value
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
-3.14   3
-3.14   3
-3.14   3
-3.14   4
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   3
+3.140000000000000000   4
 PREHOOK: query: DROP TABLE DECIMAL_3
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@decimal_3

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_4.q.out 
b/ql/src/test/results/clientpositive/decimal_4.q.out
index 50662af..8eb1de4 100644
--- a/ql/src/test/results/clientpositive/decimal_4.q.out
+++ b/ql/src/test/results/clientpositive/decimal_4.q.out
@@ -57,43 +57,43 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_4_1
 #### A masked pattern was here ####
 NULL   0
--1234567890.123456789  -1234567890
--4400  4400
--1255.49       -1255
--1.122 -11
--1.12  -1
--1.12  -1
--0.333 0
--0.33  0
--0.3   0
-0      0
-0      0
-0      0
-0.01   0
-0.02   0
-0.1    0
-0.2    0
-0.3    0
-0.33   0
-0.333  0
+-1234567890.1234567890000000000000000  -1234567890
+-4400.0000000000000000000000000        4400
+-1255.4900000000000000000000000        -1255
+-1.1220000000000000000000000   -11
+-1.1200000000000000000000000   -1
+-1.1200000000000000000000000   -1
+-0.3330000000000000000000000   0
+-0.3300000000000000000000000   0
+-0.3000000000000000000000000   0
+0.0000000000000000000000000    0
+0.0000000000000000000000000    0
+0.0000000000000000000000000    0
+0.0100000000000000000000000    0
+0.0200000000000000000000000    0
+0.1000000000000000000000000    0
+0.2000000000000000000000000    0
+0.3000000000000000000000000    0
+0.3300000000000000000000000    0
+0.3330000000000000000000000    0
 0.9999999999999999999999999    1
-1      1
-1      1
-1.12   1
-1.122  1
-2      2
-2      2
-3.14   3
-3.14   3
-3.14   3
-3.14   4
-10     10
-20     20
-100    100
-124    124
-125.2  125
-200    200
-1234567890.12345678    1234567890
+1.0000000000000000000000000    1
+1.0000000000000000000000000    1
+1.1200000000000000000000000    1
+1.1220000000000000000000000    1
+2.0000000000000000000000000    2
+2.0000000000000000000000000    2
+3.1400000000000000000000000    3
+3.1400000000000000000000000    3
+3.1400000000000000000000000    3
+3.1400000000000000000000000    4
+10.0000000000000000000000000   10
+20.0000000000000000000000000   20
+100.0000000000000000000000000  100
+124.0000000000000000000000000  124
+125.2000000000000000000000000  125
+200.0000000000000000000000000  200
+1234567890.1234567800000000000000000   1234567890
 PREHOOK: query: SELECT * FROM DECIMAL_4_2 ORDER BY key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_4_2
@@ -103,43 +103,43 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_4_2
 #### A masked pattern was here ####
 NULL   NULL
--1234567890.123456789  -3703703670.370370367
--4400  -13200
--1255.49       -3766.47
--1.122 -3.366
--1.12  -3.36
--1.12  -3.36
--0.333 -0.999
--0.33  -0.99
--0.3   -0.9
-0      0
-0      0
-0      0
-0.01   0.03
-0.02   0.06
-0.1    0.3
-0.2    0.6
-0.3    0.9
-0.33   0.99
-0.333  0.999
+-1234567890.1234567890000000000000000  -3703703670.3703703670000000000000000
+-4400.0000000000000000000000000        -13200.0000000000000000000000000
+-1255.4900000000000000000000000        -3766.4700000000000000000000000
+-1.1220000000000000000000000   -3.3660000000000000000000000
+-1.1200000000000000000000000   -3.3600000000000000000000000
+-1.1200000000000000000000000   -3.3600000000000000000000000
+-0.3330000000000000000000000   -0.9990000000000000000000000
+-0.3300000000000000000000000   -0.9900000000000000000000000
+-0.3000000000000000000000000   -0.9000000000000000000000000
+0.0000000000000000000000000    0.0000000000000000000000000
+0.0000000000000000000000000    0.0000000000000000000000000
+0.0000000000000000000000000    0.0000000000000000000000000
+0.0100000000000000000000000    0.0300000000000000000000000
+0.0200000000000000000000000    0.0600000000000000000000000
+0.1000000000000000000000000    0.3000000000000000000000000
+0.2000000000000000000000000    0.6000000000000000000000000
+0.3000000000000000000000000    0.9000000000000000000000000
+0.3300000000000000000000000    0.9900000000000000000000000
+0.3330000000000000000000000    0.9990000000000000000000000
 0.9999999999999999999999999    2.9999999999999999999999997
-1      3
-1      3
-1.12   3.36
-1.122  3.366
-2      6
-2      6
-3.14   9.42
-3.14   9.42
-3.14   9.42
-3.14   9.42
-10     30
-20     60
-100    300
-124    372
-125.2  375.6
-200    600
-1234567890.12345678    3703703670.37037034
+1.0000000000000000000000000    3.0000000000000000000000000
+1.0000000000000000000000000    3.0000000000000000000000000
+1.1200000000000000000000000    3.3600000000000000000000000
+1.1220000000000000000000000    3.3660000000000000000000000
+2.0000000000000000000000000    6.0000000000000000000000000
+2.0000000000000000000000000    6.0000000000000000000000000
+3.1400000000000000000000000    9.4200000000000000000000000
+3.1400000000000000000000000    9.4200000000000000000000000
+3.1400000000000000000000000    9.4200000000000000000000000
+3.1400000000000000000000000    9.4200000000000000000000000
+10.0000000000000000000000000   30.0000000000000000000000000
+20.0000000000000000000000000   60.0000000000000000000000000
+100.0000000000000000000000000  300.0000000000000000000000000
+124.0000000000000000000000000  372.0000000000000000000000000
+125.2000000000000000000000000  375.6000000000000000000000000
+200.0000000000000000000000000  600.0000000000000000000000000
+1234567890.1234567800000000000000000   3703703670.3703703400000000000000000
 PREHOOK: query: DROP TABLE DECIMAL_4_1
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@decimal_4_1

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_5.q.out 
b/ql/src/test/results/clientpositive/decimal_5.q.out
index 0f24b8a..0c46538 100644
--- a/ql/src/test/results/clientpositive/decimal_5.q.out
+++ b/ql/src/test/results/clientpositive/decimal_5.q.out
@@ -35,41 +35,41 @@ POSTHOOK: Input: default@decimal_5
 NULL
 NULL
 NULL
--4400
--1255.49
--1.122
--1.12
--1.12
--0.333
--0.33
--0.3
-0
-0
-0
-0.01
-0.02
-0.1
-0.2
-0.3
-0.33
-0.333
-1
-1
-1
-1.12
-1.122
-2
-2
-3.14
-3.14
-3.14
-3.14
-10
-20
-100
-124
-125.2
-200
+-4400.00000
+-1255.49000
+-1.12200
+-1.12000
+-1.12000
+-0.33300
+-0.33000
+-0.30000
+0.00000
+0.00000
+0.00000
+0.01000
+0.02000
+0.10000
+0.20000
+0.30000
+0.33000
+0.33300
+1.00000
+1.00000
+1.00000
+1.12000
+1.12200
+2.00000
+2.00000
+3.14000
+3.14000
+3.14000
+3.14000
+10.00000
+20.00000
+100.00000
+124.00000
+125.20000
+200.00000
 PREHOOK: query: SELECT DISTINCT key FROM DECIMAL_5 ORDER BY key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_5
@@ -79,32 +79,32 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_5
 #### A masked pattern was here ####
 NULL
--4400
--1255.49
--1.122
--1.12
--0.333
--0.33
--0.3
-0
-0.01
-0.02
-0.1
-0.2
-0.3
-0.33
-0.333
-1
-1.12
-1.122
-2
-3.14
-10
-20
-100
-124
-125.2
-200
+-4400.00000
+-1255.49000
+-1.12200
+-1.12000
+-0.33300
+-0.33000
+-0.30000
+0.00000
+0.01000
+0.02000
+0.10000
+0.20000
+0.30000
+0.33000
+0.33300
+1.00000
+1.12000
+1.12200
+2.00000
+3.14000
+10.00000
+20.00000
+100.00000
+124.00000
+125.20000
+200.00000
 PREHOOK: query: SELECT cast(key as decimal) FROM DECIMAL_5
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_5
@@ -161,40 +161,40 @@ POSTHOOK: Input: default@decimal_5
 #### A masked pattern was here ####
 NULL
 NULL
-0
-0
-100
-10
-1
-0.1
-0.01
-200
-20
-2
-0
-0.2
-0.02
-0.3
-0.33
+0.000
+0.000
+100.000
+10.000
+1.000
+0.100
+0.010
+200.000
+20.000
+2.000
+0.000
+0.200
+0.020
+0.300
+0.330
 0.333
--0.3
--0.33
+-0.300
+-0.330
 -0.333
-1
-2
-3.14
--1.12
--1.12
+1.000
+2.000
+3.140
+-1.120
+-1.120
 -1.122
-1.12
+1.120
 1.122
-124
-125.2
+124.000
+125.200
 NULL
-3.14
-3.14
-3.14
-1
+3.140
+3.140
+3.140
+1.000
 NULL
 NULL
 PREHOOK: query: DROP TABLE DECIMAL_5

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_6.q.out 
b/ql/src/test/results/clientpositive/decimal_6.q.out
index 0344fa9..e1ce600 100644
--- a/ql/src/test/results/clientpositive/decimal_6.q.out
+++ b/ql/src/test/results/clientpositive/decimal_6.q.out
@@ -78,54 +78,54 @@ NULL
 NULL
 NULL
 NULL
--1234567890.1235
--4400
--4400
--1255.49
--1255.49
--1.122
--1.122
--1.12
--1.12
--0.333
--0.333
--0.3
--0.3
-0
-0
-0
-0
-0.333
-0.333
-1
-1
-1
-1
-1.12
-1.12
-1.122
-1.122
-2
-2
-3.14
-3.14
-3.14
-3.14
-3.14
-3.14
-10
-10
-10.7343
+-1234567890.12350
+-4400.00000
+-4400.00000
+-1255.49000
+-1255.49000
+-1.12200
+-1.12200
+-1.12000
+-1.12000
+-0.33300
+-0.33300
+-0.30000
+-0.30000
+0.00000
+0.00000
+0.00000
+0.00000
+0.33300
+0.33300
+1.00000
+1.00000
+1.00000
+1.00000
+1.12000
+1.12000
+1.12200
+1.12200
+2.00000
+2.00000
+3.14000
+3.14000
+3.14000
+3.14000
+3.14000
+3.14000
+10.00000
+10.00000
+10.73430
 10.73433
-124
-124
-125.2
-125.2
+124.00000
+124.00000
+125.20000
+125.20000
 23232.23435
-23232.2344
-2389432.2375
-2389432.2375
-1234567890.1235
+23232.23440
+2389432.23750
+2389432.23750
+1234567890.12350
 PREHOOK: query: CREATE TABLE DECIMAL_6_3 AS SELECT key + 5.5 AS k, value * 11 
AS v from DECIMAL_6_1 ORDER BY v
 PREHOOK: type: CREATETABLE_AS_SELECT
 PREHOOK: Input: default@decimal_6_1

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_join2.q.out 
b/ql/src/test/results/clientpositive/decimal_join2.q.out
index 604f99b..a3ca231 100644
--- a/ql/src/test/results/clientpositive/decimal_join2.q.out
+++ b/ql/src/test/results/clientpositive/decimal_join2.q.out
@@ -132,71 +132,71 @@ POSTHOOK: query: SELECT * FROM DECIMAL_3 a JOIN DECIMAL_3 
b ON (a.key = b.key) O
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
--1234567890.123456789  -1234567890     -1234567890.123456789   -1234567890
--4400  4400    -4400   4400
--1255.49       -1255   -1255.49        -1255
--1.122 -11     -1.122  -11
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--0.333 0       -0.333  0
--0.33  0       -0.33   0
--0.3   0       -0.3    0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0.01   0       0.01    0
-0.02   0       0.02    0
-0.1    0       0.1     0
-0.2    0       0.2     0
-0.3    0       0.3     0
-0.33   0       0.33    0
-0.333  0       0.333   0
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1.12   1       1.12    1
-1.122  1       1.122   1
-2      2       2       2
-2      2       2       2
-2      2       2       2
-2      2       2       2
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    4
-3.14   3       3.14    4
-3.14   3       3.14    4
-3.14   4       3.14    3
-3.14   4       3.14    3
-3.14   4       3.14    3
-3.14   4       3.14    4
-10     10      10      10
-20     20      20      20
-100    100     100     100
-124    124     124     124
-125.2  125     125.2   125
-200    200     200     200
-1234567890.12345678    1234567890      1234567890.12345678     1234567890
+-1234567890.123456789000000000 -1234567890     -1234567890.123456789000000000  
-1234567890
+-4400.000000000000000000       4400    -4400.000000000000000000        4400
+-1255.490000000000000000       -1255   -1255.490000000000000000        -1255
+-1.122000000000000000  -11     -1.122000000000000000   -11
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-0.333000000000000000  0       -0.333000000000000000   0
+-0.330000000000000000  0       -0.330000000000000000   0
+-0.300000000000000000  0       -0.300000000000000000   0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.010000000000000000   0       0.010000000000000000    0
+0.020000000000000000   0       0.020000000000000000    0
+0.100000000000000000   0       0.100000000000000000    0
+0.200000000000000000   0       0.200000000000000000    0
+0.300000000000000000   0       0.300000000000000000    0
+0.330000000000000000   0       0.330000000000000000    0
+0.333000000000000000   0       0.333000000000000000    0
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.120000000000000000   1       1.120000000000000000    1
+1.122000000000000000   1       1.122000000000000000    1
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    4
+10.000000000000000000  10      10.000000000000000000   10
+20.000000000000000000  20      20.000000000000000000   20
+100.000000000000000000 100     100.000000000000000000  100
+124.000000000000000000 124     124.000000000000000000  124
+125.200000000000000000 125     125.200000000000000000  125
+200.000000000000000000 200     200.000000000000000000  200
+1234567890.123456780000000000  1234567890      1234567890.123456780000000000   
1234567890
 PREHOOK: query: EXPLAIN
 SELECT * FROM DECIMAL_3 a JOIN DECIMAL_3 b ON (a.key = b.key) ORDER BY a.key, 
a.value, b.key, b.value
 PREHOOK: type: QUERY
@@ -282,71 +282,71 @@ POSTHOOK: query: SELECT * FROM DECIMAL_3 a JOIN DECIMAL_3 
b ON (a.key = b.key) O
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_3
 #### A masked pattern was here ####
--1234567890.123456789  -1234567890     -1234567890.123456789   -1234567890
--4400  4400    -4400   4400
--1255.49       -1255   -1255.49        -1255
--1.122 -11     -1.122  -11
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--1.12  -1      -1.12   -1
--0.333 0       -0.333  0
--0.33  0       -0.33   0
--0.3   0       -0.3    0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0      0       0       0
-0.01   0       0.01    0
-0.02   0       0.02    0
-0.1    0       0.1     0
-0.2    0       0.2     0
-0.3    0       0.3     0
-0.33   0       0.33    0
-0.333  0       0.333   0
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1      1       1       1
-1.12   1       1.12    1
-1.122  1       1.122   1
-2      2       2       2
-2      2       2       2
-2      2       2       2
-2      2       2       2
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    3
-3.14   3       3.14    4
-3.14   3       3.14    4
-3.14   3       3.14    4
-3.14   4       3.14    3
-3.14   4       3.14    3
-3.14   4       3.14    3
-3.14   4       3.14    4
-10     10      10      10
-20     20      20      20
-100    100     100     100
-124    124     124     124
-125.2  125     125.2   125
-200    200     200     200
-1234567890.12345678    1234567890      1234567890.12345678     1234567890
+-1234567890.123456789000000000 -1234567890     -1234567890.123456789000000000  
-1234567890
+-4400.000000000000000000       4400    -4400.000000000000000000        4400
+-1255.490000000000000000       -1255   -1255.490000000000000000        -1255
+-1.122000000000000000  -11     -1.122000000000000000   -11
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-1.120000000000000000  -1      -1.120000000000000000   -1
+-0.333000000000000000  0       -0.333000000000000000   0
+-0.330000000000000000  0       -0.330000000000000000   0
+-0.300000000000000000  0       -0.300000000000000000   0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.000000000000000000   0       0.000000000000000000    0
+0.010000000000000000   0       0.010000000000000000    0
+0.020000000000000000   0       0.020000000000000000    0
+0.100000000000000000   0       0.100000000000000000    0
+0.200000000000000000   0       0.200000000000000000    0
+0.300000000000000000   0       0.300000000000000000    0
+0.330000000000000000   0       0.330000000000000000    0
+0.333000000000000000   0       0.333000000000000000    0
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.000000000000000000   1       1.000000000000000000    1
+1.120000000000000000   1       1.120000000000000000    1
+1.122000000000000000   1       1.122000000000000000    1
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+2.000000000000000000   2       2.000000000000000000    2
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    3
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   3       3.140000000000000000    4
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    3
+3.140000000000000000   4       3.140000000000000000    4
+10.000000000000000000  10      10.000000000000000000   10
+20.000000000000000000  20      20.000000000000000000   20
+100.000000000000000000 100     100.000000000000000000  100
+124.000000000000000000 124     124.000000000000000000  124
+125.200000000000000000 125     125.200000000000000000  125
+200.000000000000000000 200     200.000000000000000000  200
+1234567890.123456780000000000  1234567890      1234567890.123456780000000000   
1234567890
 PREHOOK: query: DROP TABLE DECIMAL_3_txt
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@decimal_3_txt

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_precision.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_precision.q.out 
b/ql/src/test/results/clientpositive/decimal_precision.q.out
index 69a6045..5542b40 100644
--- a/ql/src/test/results/clientpositive/decimal_precision.q.out
+++ b/ql/src/test/results/clientpositive/decimal_precision.q.out
@@ -76,13 +76,13 @@ NULL
 NULL
 NULL
 NULL
-0
-0
-0
-0
-0
-0.123456789
-0.123456789
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.1234567890
+0.1234567890
 1.2345678901
 1.2345678901
 1.2345678901
@@ -99,14 +99,14 @@ NULL
 12345.6789012346
 123456.7890123456
 123456.7890123457
-1234567.890123456
+1234567.8901234560
 1234567.8901234568
-12345678.90123456
+12345678.9012345600
 12345678.9012345679
-123456789.0123456
+123456789.0123456000
 123456789.0123456789
-1234567890.123456
-1234567890.123456789
+1234567890.1234560000
+1234567890.1234567890
 PREHOOK: query: SELECT dec, dec + 1, dec - 1 FROM DECIMAL_PRECISION ORDER BY 
dec
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_precision
@@ -159,13 +159,13 @@ NULL      NULL    NULL
 NULL   NULL    NULL
 NULL   NULL    NULL
 NULL   NULL    NULL
-0      1       -1
-0      1       -1
-0      1       -1
-0      1       -1
-0      1       -1
-0.123456789    1.123456789     -0.876543211
-0.123456789    1.123456789     -0.876543211
+0.0000000000   1.0000000000    -1.0000000000
+0.0000000000   1.0000000000    -1.0000000000
+0.0000000000   1.0000000000    -1.0000000000
+0.0000000000   1.0000000000    -1.0000000000
+0.0000000000   1.0000000000    -1.0000000000
+0.1234567890   1.1234567890    -0.8765432110
+0.1234567890   1.1234567890    -0.8765432110
 1.2345678901   2.2345678901    0.2345678901
 1.2345678901   2.2345678901    0.2345678901
 1.2345678901   2.2345678901    0.2345678901
@@ -182,14 +182,14 @@ NULL      NULL    NULL
 12345.6789012346       12346.6789012346        12344.6789012346
 123456.7890123456      123457.7890123456       123455.7890123456
 123456.7890123457      123457.7890123457       123455.7890123457
-1234567.890123456      1234568.890123456       1234566.890123456
+1234567.8901234560     1234568.8901234560      1234566.8901234560
 1234567.8901234568     1234568.8901234568      1234566.8901234568
-12345678.90123456      12345679.90123456       12345677.90123456
+12345678.9012345600    12345679.9012345600     12345677.9012345600
 12345678.9012345679    12345679.9012345679     12345677.9012345679
-123456789.0123456      123456790.0123456       123456788.0123456
+123456789.0123456000   123456790.0123456000    123456788.0123456000
 123456789.0123456789   123456790.0123456789    123456788.0123456789
-1234567890.123456      1234567891.123456       1234567889.123456
-1234567890.123456789   1234567891.123456789    1234567889.123456789
+1234567890.1234560000  1234567891.1234560000   1234567889.1234560000
+1234567890.1234567890  1234567891.1234567890   1234567889.1234567890
 PREHOOK: query: SELECT dec, dec * 2, dec / 3  FROM DECIMAL_PRECISION ORDER BY 
dec
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_precision
@@ -242,37 +242,37 @@ NULL      NULL    NULL
 NULL   NULL    NULL
 NULL   NULL    NULL
 NULL   NULL    NULL
-0      0       0
-0      0       0
-0      0       0
-0      0       0
-0      0       0
-0.123456789    0.246913578     0.041152263
-0.123456789    0.246913578     0.041152263
+0.0000000000   0.0000000000    0.000000000000
+0.0000000000   0.0000000000    0.000000000000
+0.0000000000   0.0000000000    0.000000000000
+0.0000000000   0.0000000000    0.000000000000
+0.0000000000   0.0000000000    0.000000000000
+0.1234567890   0.2469135780    0.041152263000
+0.1234567890   0.2469135780    0.041152263000
 1.2345678901   2.4691357802    0.411522630033
 1.2345678901   2.4691357802    0.411522630033
 1.2345678901   2.4691357802    0.411522630033
-12.3456789012  24.6913578024   4.1152263004
-12.3456789012  24.6913578024   4.1152263004
-12.3456789012  24.6913578024   4.1152263004
-123.4567890123 246.9135780246  41.1522630041
-123.4567890123 246.9135780246  41.1522630041
-123.4567890123 246.9135780246  41.1522630041
-1234.5678901235        2469.135780247  411.522630041167
-1234.5678901235        2469.135780247  411.522630041167
-1234.5678901235        2469.135780247  411.522630041167
+12.3456789012  24.6913578024   4.115226300400
+12.3456789012  24.6913578024   4.115226300400
+12.3456789012  24.6913578024   4.115226300400
+123.4567890123 246.9135780246  41.152263004100
+123.4567890123 246.9135780246  41.152263004100
+123.4567890123 246.9135780246  41.152263004100
+1234.5678901235        2469.1357802470 411.522630041167
+1234.5678901235        2469.1357802470 411.522630041167
+1234.5678901235        2469.1357802470 411.522630041167
 12345.6789012346       24691.3578024692        4115.226300411533
 12345.6789012346       24691.3578024692        4115.226300411533
-123456.7890123456      246913.5780246912       41152.2630041152
+123456.7890123456      246913.5780246912       41152.263004115200
 123456.7890123457      246913.5780246914       41152.263004115233
-1234567.890123456      2469135.780246912       411522.630041152
+1234567.8901234560     2469135.7802469120      411522.630041152000
 1234567.8901234568     2469135.7802469136      411522.630041152267
-12345678.90123456      24691357.80246912       4115226.30041152
+12345678.9012345600    24691357.8024691200     4115226.300411520000
 12345678.9012345679    24691357.8024691358     4115226.300411522633
-123456789.0123456      246913578.0246912       41152263.0041152
-123456789.0123456789   246913578.0246913578    41152263.0041152263
-1234567890.123456      2469135780.246912       411522630.041152
-1234567890.123456789   2469135780.246913578    411522630.041152263
+123456789.0123456000   246913578.0246912000    41152263.004115200000
+123456789.0123456789   246913578.0246913578    41152263.004115226300
+1234567890.1234560000  2469135780.2469120000   411522630.041152000000
+1234567890.1234567890  2469135780.2469135780   411522630.041152263000
 PREHOOK: query: SELECT dec, dec / 9 FROM DECIMAL_PRECISION ORDER BY dec
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_precision
@@ -325,13 +325,13 @@ NULL      NULL
 NULL   NULL
 NULL   NULL
 NULL   NULL
-0      0
-0      0
-0      0
-0      0
-0      0
-0.123456789    0.013717421
-0.123456789    0.013717421
+0.0000000000   0.000000000000
+0.0000000000   0.000000000000
+0.0000000000   0.000000000000
+0.0000000000   0.000000000000
+0.0000000000   0.000000000000
+0.1234567890   0.013717421000
+0.1234567890   0.013717421000
 1.2345678901   0.137174210011
 1.2345678901   0.137174210011
 1.2345678901   0.137174210011
@@ -348,14 +348,14 @@ NULL      NULL
 12345.6789012346       1371.742100137178
 123456.7890123456      13717.421001371733
 123456.7890123457      13717.421001371744
-1234567.890123456      137174.210013717333
+1234567.8901234560     137174.210013717333
 1234567.8901234568     137174.210013717422
-12345678.90123456      1371742.100137173333
+12345678.9012345600    1371742.100137173333
 12345678.9012345679    1371742.100137174211
-123456789.0123456      13717421.001371733333
-123456789.0123456789   13717421.0013717421
-1234567890.123456      137174210.013717333333
-1234567890.123456789   137174210.013717421
+123456789.0123456000   13717421.001371733333
+123456789.0123456789   13717421.001371742100
+1234567890.1234560000  137174210.013717333333
+1234567890.1234567890  137174210.013717421000
 PREHOOK: query: SELECT dec, dec / 27 FROM DECIMAL_PRECISION ORDER BY dec
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_precision
@@ -408,13 +408,13 @@ NULL      NULL
 NULL   NULL
 NULL   NULL
 NULL   NULL
-0      0
-0      0
-0      0
-0      0
-0      0
-0.123456789    0.0045724736667
-0.123456789    0.0045724736667
+0.0000000000   0.0000000000000
+0.0000000000   0.0000000000000
+0.0000000000   0.0000000000000
+0.0000000000   0.0000000000000
+0.0000000000   0.0000000000000
+0.1234567890   0.0045724736667
+0.1234567890   0.0045724736667
 1.2345678901   0.0457247366704
 1.2345678901   0.0457247366704
 1.2345678901   0.0457247366704
@@ -431,14 +431,14 @@ NULL      NULL
 12345.6789012346       457.2473667123926
 123456.7890123456      4572.4736671239111
 123456.7890123457      4572.4736671239148
-1234567.890123456      45724.7366712391111
+1234567.8901234560     45724.7366712391111
 1234567.8901234568     45724.7366712391407
-12345678.90123456      457247.3667123911111
+12345678.9012345600    457247.3667123911111
 12345678.9012345679    457247.3667123914037
-123456789.0123456      4572473.6671239111111
+123456789.0123456000   4572473.6671239111111
 123456789.0123456789   4572473.6671239140333
-1234567890.123456      45724736.6712391111111
-1234567890.123456789   45724736.6712391403333
+1234567890.1234560000  45724736.6712391111111
+1234567890.1234567890  45724736.6712391403333
 PREHOOK: query: SELECT dec, dec * dec FROM DECIMAL_PRECISION ORDER BY dec
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_precision
@@ -491,13 +491,13 @@ NULL      NULL
 NULL   NULL
 NULL   NULL
 NULL   NULL
-0      0
-0      0
-0      0
-0      0
-0      0
-0.123456789    0.015241578750190521
-0.123456789    0.015241578750190521
+0.0000000000   0.00000000000000000000
+0.0000000000   0.00000000000000000000
+0.0000000000   0.00000000000000000000
+0.0000000000   0.00000000000000000000
+0.0000000000   0.00000000000000000000
+0.1234567890   0.01524157875019052100
+0.1234567890   0.01524157875019052100
 1.2345678901   1.52415787526596567801
 1.2345678901   1.52415787526596567801
 1.2345678901   1.52415787526596567801
@@ -514,14 +514,14 @@ NULL      NULL
 12345.6789012346       152415787.53238916034140423716
 123456.7890123456      15241578753.23881726870921383936
 123456.7890123457      15241578753.23884196006701630849
-1234567.890123456      1524157875323.881726870921383936
+1234567.8901234560     1524157875323.88172687092138393600
 1234567.8901234568     1524157875323.88370217954558146624
-12345678.90123456      152415787532388.1726870921383936
+12345678.9012345600    152415787532388.17268709213839360000
 12345678.9012345679    152415787532388.36774881877789971041
-123456789.0123456      15241578753238817.26870921383936
+123456789.0123456000   15241578753238817.26870921383936000000
 123456789.0123456789   15241578753238836.75019051998750190521
-1234567890.123456      NULL
-1234567890.123456789   NULL
+1234567890.1234560000  NULL
+1234567890.1234567890  NULL
 PREHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION
@@ -613,7 +613,7 @@ POSTHOOK: query: SELECT 
MIN(cast('12345678901234567890.12345678' as decimal(38,1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_precision
 #### A masked pattern was here ####
-12345678901234567890.12345678
+12345678901234567890.123456780000000000
 PREHOOK: query: SELECT COUNT(cast('12345678901234567890.12345678' as 
decimal(38,18))) FROM DECIMAL_PRECISION
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_precision

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/decimal_trailing.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_trailing.q.out 
b/ql/src/test/results/clientpositive/decimal_trailing.q.out
index 6cfe282..1b70737 100644
--- a/ql/src/test/results/clientpositive/decimal_trailing.q.out
+++ b/ql/src/test/results/clientpositive/decimal_trailing.q.out
@@ -40,16 +40,16 @@ POSTHOOK: query: SELECT * FROM DECIMAL_TRAILING ORDER BY id
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_trailing
 #### A masked pattern was here ####
-0      0       0
-1      0       0
+0      0.0000  0.00000000
+1      0.0000  0.00000000
 2      NULL    NULL
-3      1       1
-4      10      10
-5      100     100
-6      1000    1000
-7      10000   10000
-8      100000  100000
-9      NULL    1000000
+3      1.0000  1.00000000
+4      10.0000 10.00000000
+5      100.0000        100.00000000
+6      1000.0000       1000.00000000
+7      10000.0000      10000.00000000
+8      100000.0000     100000.00000000
+9      NULL    1000000.00000000
 10     NULL    NULL
 11     NULL    NULL
 12     NULL    NULL
@@ -58,18 +58,18 @@ POSTHOOK: Input: default@decimal_trailing
 15     NULL    NULL
 16     NULL    NULL
 17     NULL    NULL
-18     1       1
-19     10      10
-20     100     100
-21     1000    1000
-22     100000  10000
-23     0       0
-24     0       0
-25     0       0
-26     0       0
-27     0       0
-28     12313.2 134134.312525
-29     99999.999       134134.31242553
+18     1.0000  1.00000000
+19     10.0000 10.00000000
+20     100.0000        100.00000000
+21     1000.0000       1000.00000000
+22     100000.0000     10000.00000000
+23     0.0000  0.00000000
+24     0.0000  0.00000000
+25     0.0000  0.00000000
+26     0.0000  0.00000000
+27     0.0000  0.00000000
+28     12313.2000      134134.31252500
+29     99999.9990      134134.31242553
 PREHOOK: query: DROP TABLE DECIMAL_TRAILING
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@decimal_trailing

Reply via email to