hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xu...@apache.org
Subject [1/6] hive git commit: HIVE-12063: Pad Decimal numbers with trailing zeros to the scale of the column (reviewed by Szehon)
Date Wed, 04 Nov 2015 03:41:30 GMT
Repository: hive
Updated Branches:
  refs/heads/master 318c2ef2f -> 13f8cfece


http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_decimal_aggregate.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_aggregate.q.out b/ql/src/test/results/clientpositive/vector_decimal_aggregate.q.out
index cf975d1..9b9fb71 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_aggregate.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_aggregate.q.out
@@ -110,14 +110,14 @@ POSTHOOK: query: SELECT cint,
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_vgby
 #### A masked pattern was here ####
--3728	6	5831542.269248378	-3367.6517567568	5817556.0411483778	6	6984454.211097692	-4033.445769230769	6967702.8672438458471
--563	2	-515.621072973	-3367.6517567568	-3883.2728297298	2	-617.5607769230769	-4033.445769230769	-4651.0065461538459
-253665376	1024	9767.0054054054	-9779.5486486487	-347484.0818378374	1024	11697.969230769231	-11712.99230769231	-416182.64030769233089
-528534767	1024	5831542.269248378	-9777.1594594595	11646372.8607481068	1024	6984454.211097692	-11710.130769230771	13948892.79980307629003
-626923679	1024	9723.4027027027	-9778.9513513514	10541.0525297287	1024	11645.746153846154	-11712.276923076923	12625.04759999997746
-6981	3	5831542.269248378	-515.621072973	5830511.027102432	3	6984454.211097692	-617.5607769230769	6983219.0895438458462
-762	2	5831542.269248378	1531.2194054054	5833073.4886537834	2	6984454.211097692	1833.9456923076925	6986288.1567899996925
-NULL	3072	9318.4351351351	-4298.1513513514	5018444.1081079808	3072	11160.715384615385	-5147.907692307693	6010604.3076923073536
+-3728	6	5831542.2692483780	-3367.6517567568	5817556.0411483778	6	6984454.21109769200000	-4033.44576923076900	6967702.86724384584710
+-563	2	-515.6210729730	-3367.6517567568	-3883.2728297298	2	-617.56077692307690	-4033.44576923076900	-4651.00654615384590
+253665376	1024	9767.0054054054	-9779.5486486487	-347484.0818378374	1024	11697.96923076923100	-11712.99230769231000	-416182.64030769233089
+528534767	1024	5831542.2692483780	-9777.1594594595	11646372.8607481068	1024	6984454.21109769200000	-11710.13076923077100	13948892.79980307629003
+626923679	1024	9723.4027027027	-9778.9513513514	10541.0525297287	1024	11645.74615384615400	-11712.27692307692300	12625.04759999997746
+6981	3	5831542.2692483780	-515.6210729730	5830511.0271024320	3	6984454.21109769200000	-617.56077692307690	6983219.08954384584620
+762	2	5831542.2692483780	1531.2194054054	5833073.4886537834	2	6984454.21109769200000	1833.94569230769250	6986288.15678999969250
+NULL	3072	9318.4351351351	-4298.1513513514	5018444.1081079808	3072	11160.71538461538500	-5147.90769230769300	6010604.30769230735360
 PREHOOK: query: -- Now add the others...
 EXPLAIN SELECT cint,
     COUNT(cdecimal1), MAX(cdecimal1), MIN(cdecimal1), SUM(cdecimal1), AVG(cdecimal1), STDDEV_POP(cdecimal1), STDDEV_SAMP(cdecimal1),
@@ -208,11 +208,11 @@ POSTHOOK: query: SELECT cint,
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_vgby
 #### A masked pattern was here ####
--3728	6	5831542.269248378	-3367.6517567568	5817556.0411483778	969592.67352472963333	2174330.2092403853	2381859.406131774	6	6984454.211097692	-4033.445769230769	6967702.8672438458471	1161283.811207307641183333	2604201.2704476737	2852759.5602156054
--563	2	-515.621072973	-3367.6517567568	-3883.2728297298	-1941.6364148649	1426.0153418918999	2016.6902366556308	2	-617.5607769230769	-4033.445769230769	-4651.0065461538459	-2325.50327307692295	1707.9424961538462	2415.395441814127
-253665376	1024	9767.0054054054	-9779.5486486487	-347484.0818378374	-339.33992366976309	5708.9563478862	5711.745967572779	1024	11697.969230769231	-11712.99230769231	-416182.64030769233089	-406.428359675480791885	6837.632716002934	6840.973851172274
-528534767	1024	5831542.269248378	-9777.1594594595	11646372.8607481068	11373.41099682432305	257528.92988206653	257654.7686043977	1024	6984454.211097692	-11710.130769230771	13948892.79980307629003	13621.965624807691689482	308443.1074570801	308593.82484083984
-626923679	1024	9723.4027027027	-9778.9513513514	10541.0525297287	10.29399661106318	5742.09145323734	5744.897264034267	1024	11645.746153846154	-11712.276923076923	12625.04759999997746	12.329148046874977988	6877.318722794877	6880.679250101603
-6981	3	5831542.269248378	-515.621072973	5830511.027102432	1943503.67570081066667	2749258.455012492	3367140.1929065133	3	6984454.211097692	-617.5607769230769	6983219.0895438458462	2327739.696514615282066667	3292794.4113115156	4032833.0678006653
-762	2	5831542.269248378	1531.2194054054	5833073.4886537834	2916536.7443268917	2915005.5249214866	4122440.3477364695	2	6984454.211097692	1833.9456923076925	6986288.1567899996925	3493144.07839499984625	3491310.1327026924	4937458.140118758
-NULL	3072	9318.4351351351	-4298.1513513514	5018444.1081079808	1633.60810810806667	5695.483082135364	5696.4103077145055	3072	11160.715384615385	-5147.907692307693	6010604.3076923073536	1956.576923076922966667	6821.495748565159	6822.606289190924
+-3728	6	5831542.2692483780	-3367.6517567568	5817556.0411483778	969592.67352472963333	2174330.2092403853	2381859.406131774	6	6984454.21109769200000	-4033.44576923076900	6967702.86724384584710	1161283.811207307641183333	2604201.2704476737	2852759.5602156054
+-563	2	-515.6210729730	-3367.6517567568	-3883.2728297298	-1941.63641486490000	1426.0153418918999	2016.6902366556308	2	-617.56077692307690	-4033.44576923076900	-4651.00654615384590	-2325.503273076922950000	1707.9424961538462	2415.395441814127
+253665376	1024	9767.0054054054	-9779.5486486487	-347484.0818378374	-339.33992366976309	5708.9563478862	5711.745967572779	1024	11697.96923076923100	-11712.99230769231000	-416182.64030769233089	-406.428359675480791885	6837.632716002934	6840.973851172274
+528534767	1024	5831542.2692483780	-9777.1594594595	11646372.8607481068	11373.41099682432305	257528.92988206653	257654.7686043977	1024	6984454.21109769200000	-11710.13076923077100	13948892.79980307629003	13621.965624807691689482	308443.1074570801	308593.82484083984
+626923679	1024	9723.4027027027	-9778.9513513514	10541.0525297287	10.29399661106318	5742.09145323734	5744.897264034267	1024	11645.74615384615400	-11712.27692307692300	12625.04759999997746	12.329148046874977988	6877.318722794877	6880.679250101603
+6981	3	5831542.2692483780	-515.6210729730	5830511.0271024320	1943503.67570081066667	2749258.455012492	3367140.1929065133	3	6984454.21109769200000	-617.56077692307690	6983219.08954384584620	2327739.696514615282066667	3292794.4113115156	4032833.0678006653
+762	2	5831542.2692483780	1531.2194054054	5833073.4886537834	2916536.74432689170000	2915005.5249214866	4122440.3477364695	2	6984454.21109769200000	1833.94569230769250	6986288.15678999969250	3493144.078394999846250000	3491310.1327026924	4937458.140118758
+NULL	3072	9318.4351351351	-4298.1513513514	5018444.1081079808	1633.60810810806667	5695.483082135364	5696.4103077145055	3072	11160.71538461538500	-5147.90769230769300	6010604.30769230735360	1956.576923076922966667	6821.495748565159	6822.606289190924

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_decimal_cast.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_cast.q.out b/ql/src/test/results/clientpositive/vector_decimal_cast.q.out
index 88c09d9..2d81305 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_cast.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_cast.q.out
@@ -46,13 +46,13 @@ POSTHOOK: query: SELECT cdouble, cint, cboolean1, ctimestamp1, CAST(cdouble AS D
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
--13326.0	528534767	true	1969-12-31 15:59:46.674	-13326	528534767	1	-13
--15813.0	528534767	true	1969-12-31 15:59:55.787	-15813	528534767	1	-4
--9566.0	528534767	true	1969-12-31 15:59:44.187	-9566	528534767	1	-16
-15007.0	528534767	true	1969-12-31 15:59:50.434	15007	528534767	1	-10
-7021.0	528534767	true	1969-12-31 16:00:15.007	7021	528534767	1	15
-4963.0	528534767	true	1969-12-31 16:00:07.021	4963	528534767	1	7
--7824.0	528534767	true	1969-12-31 16:00:04.963	-7824	528534767	1	5
--15431.0	528534767	true	1969-12-31 15:59:52.176	-15431	528534767	1	-8
--15549.0	528534767	true	1969-12-31 15:59:44.569	-15549	528534767	1	-15
-5780.0	528534767	true	1969-12-31 15:59:44.451	5780	528534767	1	-16
+-13326.0	528534767	true	1969-12-31 15:59:46.674	-13326.0000000000	528534767.00000000000000	1.00	-13
+-15813.0	528534767	true	1969-12-31 15:59:55.787	-15813.0000000000	528534767.00000000000000	1.00	-4
+-9566.0	528534767	true	1969-12-31 15:59:44.187	-9566.0000000000	528534767.00000000000000	1.00	-16
+15007.0	528534767	true	1969-12-31 15:59:50.434	15007.0000000000	528534767.00000000000000	1.00	-10
+7021.0	528534767	true	1969-12-31 16:00:15.007	7021.0000000000	528534767.00000000000000	1.00	15
+4963.0	528534767	true	1969-12-31 16:00:07.021	4963.0000000000	528534767.00000000000000	1.00	7
+-7824.0	528534767	true	1969-12-31 16:00:04.963	-7824.0000000000	528534767.00000000000000	1.00	5
+-15431.0	528534767	true	1969-12-31 15:59:52.176	-15431.0000000000	528534767.00000000000000	1.00	-8
+-15549.0	528534767	true	1969-12-31 15:59:44.569	-15549.0000000000	528534767.00000000000000	1.00	-15
+5780.0	528534767	true	1969-12-31 15:59:44.451	5780.0000000000	528534767.00000000000000	1.00	-16

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out b/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
index 6369bc8..e57d6c1 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
@@ -77,13 +77,13 @@ LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_test
 #### A masked pattern was here ####
-1836.441995841977	-1166.027234927254	0.8372697814833714	245972.55810810256	5.6189189189	835	1000	-24	835	true	1000.823076923077	835.6189	1000.823076923077	1969-12-31 16:13:55.618918918
-1856.1322245322462	-1178.5293139292924	0.8372449787014038	251275.4432432497	4.5783783784	844	1011	-13	844	true	1011.5538461538462	844.57837	1011.5538461538462	1969-12-31 16:14:04.578378378
-1858.7575883576155	-1180.196257796231	0.837241711366943	251986.76756757565	5.772972973	845	1012	-12	845	true	1012.9846153846155	845.77295	1012.9846153846155	1969-12-31 16:14:05.772972973
-1862.6956340956693	-1182.6966735966386	0.8372368276344616	253055.6391891997	7.5648648649	847	1015	-9	847	true	1015.1307692307693	847.5649	1015.1307692307693	1969-12-31 16:14:07.564864864
-1883.6985446985233	-1196.0322245322466	0.8372111259286499	258794.49324323673	7.1216216216	857	1026	2	857	true	1026.5769230769233	857.12164	1026.5769230769233	1969-12-31 16:14:17.121621621
-1886.3239085238924	-1197.6991683991848	0.8372079534581902	259516.37432431948	8.3162162162	858	1028	4	858	true	1028.0076923076924	858.3162	1028.0076923076924	1969-12-31 16:14:18.316216216
-1887.636590436577	-1198.532640332654	0.8372063705322131	259877.69189188787	8.9135135135	858	1028	4	858	true	1028.723076923077	858.9135	1028.723076923077	1969-12-31 16:14:18.913513513
-1895.5126819126846	-1203.5334719334692	0.8371969190171343	262050.87567567648	2.4972972973	862	1033	9	862	true	1033.0153846153846	862.4973	1033.0153846153846	1969-12-31 16:14:22.497297297
-1909.9521829522155	-1212.701663201631	0.8371797936946236	266058.54729730723	9.0675675676	869	1040	16	869	true	1040.8846153846155	869.06757	1040.8846153846155	1969-12-31 16:14:29.067567567
-1913.8902286902692	-1215.2020790020384	0.8371751679995797	267156.8270270395	0.8594594595	870	1043	19	870	true	1043.0307692307692	870.85944	1043.0307692307692	1969-12-31 16:14:30.859459459
+1836.44199584197700	-1166.02723492725400	0.8372697814833714	245972.55810810256	5.6189189189	835	1000	-24	835	true	1000.823076923077	835.6189	1000.823076923077	1969-12-31 16:13:55.618918918
+1856.13222453224620	-1178.52931392929240	0.8372449787014038	251275.4432432497	4.5783783784	844	1011	-13	844	true	1011.5538461538462	844.57837	1011.5538461538462	1969-12-31 16:14:04.578378378
+1858.75758835761550	-1180.19625779623100	0.837241711366943	251986.76756757565	5.7729729730	845	1012	-12	845	true	1012.9846153846155	845.77295	1012.9846153846155	1969-12-31 16:14:05.772972973
+1862.69563409566930	-1182.69667359663860	0.8372368276344616	253055.6391891997	7.5648648649	847	1015	-9	847	true	1015.1307692307693	847.5649	1015.1307692307693	1969-12-31 16:14:07.564864864
+1883.69854469852330	-1196.03222453224660	0.8372111259286499	258794.49324323673	7.1216216216	857	1026	2	857	true	1026.5769230769233	857.12164	1026.5769230769233	1969-12-31 16:14:17.121621621
+1886.32390852389240	-1197.69916839918480	0.8372079534581902	259516.37432431948	8.3162162162	858	1028	4	858	true	1028.0076923076924	858.3162	1028.0076923076924	1969-12-31 16:14:18.316216216
+1887.63659043657700	-1198.53264033265400	0.8372063705322131	259877.69189188787	8.9135135135	858	1028	4	858	true	1028.723076923077	858.9135	1028.723076923077	1969-12-31 16:14:18.913513513
+1895.51268191268460	-1203.53347193346920	0.8371969190171343	262050.87567567648	2.4972972973	862	1033	9	862	true	1033.0153846153846	862.4973	1033.0153846153846	1969-12-31 16:14:22.497297297
+1909.95218295221550	-1212.70166320163100	0.8371797936946236	266058.54729730723	9.0675675676	869	1040	16	869	true	1040.8846153846155	869.06757	1040.8846153846155	1969-12-31 16:14:29.067567567
+1913.89022869026920	-1215.20207900203840	0.8371751679995797	267156.8270270395	0.8594594595	870	1043	19	870	true	1043.0307692307692	870.85944	1043.0307692307692	1969-12-31 16:14:30.859459459

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_decimal_mapjoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_mapjoin.q.out b/ql/src/test/results/clientpositive/vector_decimal_mapjoin.q.out
index cf48a32..d3356ed 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_mapjoin.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_mapjoin.q.out
@@ -155,109 +155,109 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@t1
 POSTHOOK: Input: default@t2
 #### A masked pattern was here ####
-14	14
-14	14
-14	14
-14	14
-14	14
-14	14
-14	14
-14	14
-14	14
-17	17
-17	17
-17	17
-17	17
-17	17
-17	17
-17	17
-17	17
-17	17
-17	17
-45	45
-45	45
-45	45
-45	45
-45	45
-6	6
-6	6
-6	6
-6	6
-6	6
-6	6
-62	62
-62	62
-62	62
-62	62
-62	62
-62	62
-62	62
-62	62
-62	62
-62	62
-62	62
-62	62
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-64	64
-70	70
-70	70
-70	70
-70	70
-70	70
-70	70
-70	70
-79	79
-79	79
-79	79
-79	79
-79	79
-79	79
-89	89
-89	89
-89	89
-89	89
-89	89
-89	89
-89	89
-89	89
-89	89
-89	89
-89	89
-89	89
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
-9	9
+14.00	14
+14.00	14
+14.00	14
+14.00	14
+14.00	14
+14.00	14
+14.00	14
+14.00	14
+14.00	14
+17.00	17
+17.00	17
+17.00	17
+17.00	17
+17.00	17
+17.00	17
+17.00	17
+17.00	17
+17.00	17
+17.00	17
+45.00	45
+45.00	45
+45.00	45
+45.00	45
+45.00	45
+6.00	6
+6.00	6
+6.00	6
+6.00	6
+6.00	6
+6.00	6
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+62.00	62
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+64.00	64
+70.00	70
+70.00	70
+70.00	70
+70.00	70
+70.00	70
+70.00	70
+70.00	70
+79.00	79
+79.00	79
+79.00	79
+79.00	79
+79.00	79
+79.00	79
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+89.00	89
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9
+9.00	9

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_precision.q.out b/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
index f2aaf8d..c5ab8a7 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
@@ -99,13 +99,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
@@ -122,14 +122,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
@@ -182,13 +182,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
@@ -205,14 +205,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
@@ -265,37 +265,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
@@ -348,13 +348,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
@@ -371,14 +371,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
@@ -431,13 +431,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
@@ -454,14 +454,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
@@ -514,13 +514,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
@@ -537,14 +537,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
@@ -637,7 +637,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/vector_decimal_round_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_round_2.q.out b/ql/src/test/results/clientpositive/vector_decimal_round_2.q.out
index 0151b04..5291609 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_round_2.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_round_2.q.out
@@ -25,7 +25,7 @@ POSTHOOK: query: select * from decimal_tbl_1_orc
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_tbl_1_orc
 #### A masked pattern was here ####
-55555
+55555.000000000000000000
 PREHOOK: query: -- EXPLAIN
 -- SELECT dec, round(null), round(null, 0), round(125, null), 
 -- round(1.0/0.0, 0), round(power(-1.0,0.5), 0)
@@ -114,7 +114,7 @@ FROM decimal_tbl_1_orc ORDER BY d
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_tbl_1_orc
 #### A masked pattern was here ####
-55555	55555	55555	55555	55555	55560	55600	56000	60000	100000	0	0	0
+55555	55555	55555.0	55555.00	55555.000	55560	55600	56000	60000	100000	0	0	0
 PREHOOK: query: create table decimal_tbl_2_orc (pos decimal(38,18), neg decimal(38,18)) 
 STORED AS ORC
 PREHOOK: type: CREATETABLE
@@ -143,7 +143,7 @@ POSTHOOK: query: select * from decimal_tbl_2_orc
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_tbl_2_orc
 #### A masked pattern was here ####
-125.315	-125.315
+125.315000000000000000	-125.315000000000000000
 PREHOOK: query: EXPLAIN
 SELECT
   round(pos) as p, round(pos, 0),
@@ -226,7 +226,7 @@ FROM decimal_tbl_2_orc ORDER BY p
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_tbl_2_orc
 #### A masked pattern was here ####
-125	125	125.3	125.32	125.315	125.315	130	100	0	0	-125	-125	-125.3	-125.32	-125.315	-125.315	-130	-100	0	0
+125	125	125.3	125.32	125.315	125.3150	130	100	0	0	-125	-125	-125.3	-125.32	-125.315	-125.3150	-130	-100	0	0
 PREHOOK: query: create table decimal_tbl_3_orc (dec decimal(38,18)) 
 STORED AS ORC
 PREHOOK: type: CREATETABLE
@@ -254,7 +254,7 @@ POSTHOOK: query: select * from decimal_tbl_3_orc
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_tbl_3_orc
 #### A masked pattern was here ####
-3.141592653589793
+3.141592653589793000
 PREHOOK: query: EXPLAIN
 SELECT
   round(dec, -15) as d, round(dec, -16),
@@ -381,7 +381,7 @@ FROM decimal_tbl_3_orc ORDER BY d
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_tbl_3_orc
 #### A masked pattern was here ####
-0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	3	3.1	3.14	3.142	3.1416	3.14159	3.141593	3.1415927	3.14159265	3.141592654	3.1415926536	3.14159265359	3.14159265359	3.1415926535898	3.1415926535898	3.14159265358979	3.141592653589793	3.141592653589793
+0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	3	3.1	3.14	3.142	3.1416	3.14159	3.141593	3.1415927	3.14159265	3.141592654	3.1415926536	3.14159265359	3.141592653590	3.1415926535898	3.1415926535898	3.14159265358979	3.141592653589793	3.1415926535897930
 PREHOOK: query: create table decimal_tbl_4_orc (pos decimal(38,18), neg decimal(38,18)) 
 STORED AS ORC
 PREHOOK: type: CREATETABLE
@@ -410,7 +410,7 @@ POSTHOOK: query: select * from decimal_tbl_4_orc
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_tbl_4_orc
 #### A masked pattern was here ####
-1809242.3151111344	-1809242.3151111344
+1809242.315111134400000000	-1809242.315111134400000000
 PREHOOK: query: EXPLAIN
 SELECT round(pos, 9) as p, round(neg, 9), round(1809242.3151111344BD, 9), round(-1809242.3151111344BD, 9)
 FROM decimal_tbl_4_orc ORDER BY p

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_decimal_trailing.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_trailing.q.out b/ql/src/test/results/clientpositive/vector_decimal_trailing.q.out
index ffdb1c9..7dea1a2 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_trailing.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_trailing.q.out
@@ -73,16 +73,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
@@ -91,18 +91,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_txt
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@decimal_trailing_txt

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_decimal_udf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_udf.q.out b/ql/src/test/results/clientpositive/vector_decimal_udf.q.out
index cfd2a55..6837b76 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_udf.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_udf.q.out
@@ -92,44 +92,44 @@ POSTHOOK: query: SELECT key + key FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--8800
+-8800.0000000000
 NULL
-0
-0
-200
-20
-2
-0.2
-0.02
-400
-40
-4
-0
-0.4
-0.04
-0.6
-0.66
-0.666
--0.6
--0.66
--0.666
-2
-4
-6.28
--2.24
--2.24
--2.244
-2.24
-2.244
-248
-250.4
--2510.98
-6.28
-6.28
-6.28
-2
--2469135780.246913578
-2469135780.24691356
+0.0000000000
+0.0000000000
+200.0000000000
+20.0000000000
+2.0000000000
+0.2000000000
+0.0200000000
+400.0000000000
+40.0000000000
+4.0000000000
+0.0000000000
+0.4000000000
+0.0400000000
+0.6000000000
+0.6600000000
+0.6660000000
+-0.6000000000
+-0.6600000000
+-0.6660000000
+2.0000000000
+4.0000000000
+6.2800000000
+-2.2400000000
+-2.2400000000
+-2.2440000000
+2.2400000000
+2.2440000000
+248.0000000000
+250.4000000000
+-2510.9800000000
+6.2800000000
+6.2800000000
+6.2800000000
+2.0000000000
+-2469135780.2469135780
+2469135780.2469135600
 PREHOOK: query: EXPLAIN SELECT key + value FROM DECIMAL_UDF
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key + value FROM DECIMAL_UDF
@@ -172,44 +172,44 @@ POSTHOOK: query: SELECT key + value FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-0
+0.0000000000
 NULL
-0
-0
-200
-20
-2
-0.1
-0.01
-400
-40
-4
-0
-0.2
-0.02
-0.3
-0.33
-0.333
--0.3
--0.33
--0.333
-2
-4
-6.14
--2.12
--2.12
--12.122
-2.12
-2.122
-248
-250.2
--2510.49
-6.14
-6.14
-7.14
-2
--2469135780.123456789
-2469135780.12345678
+0.0000000000
+0.0000000000
+200.0000000000
+20.0000000000
+2.0000000000
+0.1000000000
+0.0100000000
+400.0000000000
+40.0000000000
+4.0000000000
+0.0000000000
+0.2000000000
+0.0200000000
+0.3000000000
+0.3300000000
+0.3330000000
+-0.3000000000
+-0.3300000000
+-0.3330000000
+2.0000000000
+4.0000000000
+6.1400000000
+-2.1200000000
+-2.1200000000
+-12.1220000000
+2.1200000000
+2.1220000000
+248.0000000000
+250.2000000000
+-2510.4900000000
+6.1400000000
+6.1400000000
+7.1400000000
+2.0000000000
+-2469135780.1234567890
+2469135780.1234567800
 PREHOOK: query: EXPLAIN SELECT key + (value/2) FROM DECIMAL_UDF
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key + (value/2) FROM DECIMAL_UDF
@@ -414,44 +414,44 @@ POSTHOOK: query: SELECT key - key FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-0
+0.0000000000
 NULL
-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.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
 PREHOOK: query: EXPLAIN SELECT key - value FROM DECIMAL_UDF
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key - value FROM DECIMAL_UDF
@@ -494,44 +494,44 @@ POSTHOOK: query: SELECT key - value FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--8800
+-8800.0000000000
 NULL
-0
-0
-0
-0
-0
-0.1
-0.01
-0
-0
-0
-0
-0.2
-0.02
-0.3
-0.33
-0.333
--0.3
--0.33
--0.333
-0
-0
-0.14
--0.12
--0.12
-9.878
-0.12
-0.122
-0
-0.2
--0.49
-0.14
-0.14
--0.86
-0
--0.123456789
-0.12345678
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.1000000000
+0.0100000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.2000000000
+0.0200000000
+0.3000000000
+0.3300000000
+0.3330000000
+-0.3000000000
+-0.3300000000
+-0.3330000000
+0.0000000000
+0.0000000000
+0.1400000000
+-0.1200000000
+-0.1200000000
+9.8780000000
+0.1200000000
+0.1220000000
+0.0000000000
+0.2000000000
+-0.4900000000
+0.1400000000
+0.1400000000
+-0.8600000000
+0.0000000000
+-0.1234567890
+0.1234567800
 PREHOOK: query: EXPLAIN SELECT key - (value/2) FROM DECIMAL_UDF
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key - (value/2) FROM DECIMAL_UDF
@@ -736,42 +736,42 @@ POSTHOOK: query: SELECT key * key FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-19360000
+19360000.00000000000000000000
 NULL
-0
-0
-10000
-100
-1
-0.01
-0.0001
-40000
-400
-4
-0
-0.04
-0.0004
-0.09
-0.1089
-0.110889
-0.09
-0.1089
-0.110889
-1
-4
-9.8596
-1.2544
-1.2544
-1.258884
-1.2544
-1.258884
-15376
-15675.04
-1576255.1401
-9.8596
-9.8596
-9.8596
-1
+0.00000000000000000000
+0.00000000000000000000
+10000.00000000000000000000
+100.00000000000000000000
+1.00000000000000000000
+0.01000000000000000000
+0.00010000000000000000
+40000.00000000000000000000
+400.00000000000000000000
+4.00000000000000000000
+0.00000000000000000000
+0.04000000000000000000
+0.00040000000000000000
+0.09000000000000000000
+0.10890000000000000000
+0.11088900000000000000
+0.09000000000000000000
+0.10890000000000000000
+0.11088900000000000000
+1.00000000000000000000
+4.00000000000000000000
+9.85960000000000000000
+1.25440000000000000000
+1.25440000000000000000
+1.25888400000000000000
+1.25440000000000000000
+1.25888400000000000000
+15376.00000000000000000000
+15675.04000000000000000000
+1576255.14010000000000000000
+9.85960000000000000000
+9.85960000000000000000
+9.85960000000000000000
+1.00000000000000000000
 NULL
 NULL
 PREHOOK: query: EXPLAIN SELECT key, value FROM DECIMAL_UDF where key * value > 0
@@ -819,29 +819,29 @@ POSTHOOK: query: SELECT key, value FROM DECIMAL_UDF where key * value > 0
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-100	100
-10	10
-1	1
-200	200
-20	20
-2	2
-1	1
-2	2
-3.14	3
--1.12	-1
--1.12	-1
--1.122	-11
-1.12	1
-1.122	1
-124	124
-125.2	125
--1255.49	-1255
-3.14	3
-3.14	3
-3.14	4
-1	1
--1234567890.123456789	-1234567890
-1234567890.12345678	1234567890
+100.0000000000	100
+10.0000000000	10
+1.0000000000	1
+200.0000000000	200
+20.0000000000	20
+2.0000000000	2
+1.0000000000	1
+2.0000000000	2
+3.1400000000	3
+-1.1200000000	-1
+-1.1200000000	-1
+-1.1220000000	-11
+1.1200000000	1
+1.1220000000	1
+124.0000000000	124
+125.2000000000	125
+-1255.4900000000	-1255
+3.1400000000	3
+3.1400000000	3
+3.1400000000	4
+1.0000000000	1
+-1234567890.1234567890	-1234567890
+1234567890.1234567800	1234567890
 PREHOOK: query: EXPLAIN SELECT key * value FROM DECIMAL_UDF
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key * value FROM DECIMAL_UDF
@@ -884,44 +884,44 @@ POSTHOOK: query: SELECT key * value FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--19360000
+-19360000.0000000000
 NULL
-0
-0
-10000
-100
-1
-0
-0
-40000
-400
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-4
-9.42
-1.12
-1.12
-12.342
-1.12
-1.122
-15376
-15650
-1575639.95
-9.42
-9.42
-12.56
-1
-1524157875171467887.50190521
-1524157875171467876.3907942
+0.0000000000
+0.0000000000
+10000.0000000000
+100.0000000000
+1.0000000000
+0.0000000000
+0.0000000000
+40000.0000000000
+400.0000000000
+4.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+0.0000000000
+1.0000000000
+4.0000000000
+9.4200000000
+1.1200000000
+1.1200000000
+12.3420000000
+1.1200000000
+1.1220000000
+15376.0000000000
+15650.0000000000
+1575639.9500000000
+9.4200000000
+9.4200000000
+12.5600000000
+1.0000000000
+1524157875171467887.5019052100
+1524157875171467876.3907942000
 PREHOOK: query: EXPLAIN SELECT key * (value/2) FROM DECIMAL_UDF
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key * (value/2) FROM DECIMAL_UDF
@@ -1220,40 +1220,40 @@ POSTHOOK: query: SELECT key / key FROM DECIMAL_UDF WHERE key is not null and key
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-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.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
+1.000000000000000000000000
 PREHOOK: query: EXPLAIN SELECT key / value FROM DECIMAL_UDF WHERE value is not null and value <> 0
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key / value FROM DECIMAL_UDF WHERE value is not null and value <> 0
@@ -1299,30 +1299,30 @@ POSTHOOK: query: SELECT key / value FROM DECIMAL_UDF WHERE value is not null and
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--1
-1
-1
-1
-1
-1
-1
-1
-1
+-1.000000000000000000000
+1.000000000000000000000
+1.000000000000000000000
+1.000000000000000000000
+1.000000000000000000000
+1.000000000000000000000
+1.000000000000000000000
+1.000000000000000000000
+1.000000000000000000000
 1.046666666666666666667
-1.12
-1.12
-0.102
-1.12
-1.122
-1
-1.0016
+1.120000000000000000000
+1.120000000000000000000
+0.102000000000000000000
+1.120000000000000000000
+1.122000000000000000000
+1.000000000000000000000
+1.001600000000000000000
 1.000390438247011952191
 1.046666666666666666667
 1.046666666666666666667
-0.785
-1
-1.0000000001
-1.00000000009999999271
+0.785000000000000000000
+1.000000000000000000000
+1.000000000100000000000
+1.000000000099999992710
 PREHOOK: query: EXPLAIN SELECT key / (value/2) FROM DECIMAL_UDF  WHERE value is not null and value <> 0
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN SELECT key / (value/2) FROM DECIMAL_UDF  WHERE value is not null and value <> 0
@@ -1516,44 +1516,44 @@ POSTHOOK: query: SELECT abs(key) FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-4400
+4400.0000000000
 NULL
-0
-0
-100
-10
-1
-0.1
-0.01
-200
-20
-2
-0
-0.2
-0.02
-0.3
-0.33
-0.333
-0.3
-0.33
-0.333
-1
-2
-3.14
-1.12
-1.12
-1.122
-1.12
-1.122
-124
-125.2
-1255.49
-3.14
-3.14
-3.14
-1
-1234567890.123456789
-1234567890.12345678
+0.0000000000
+0.0000000000
+100.0000000000
+10.0000000000
+1.0000000000
+0.1000000000
+0.0100000000
+200.0000000000
+20.0000000000
+2.0000000000
+0.0000000000
+0.2000000000
+0.0200000000
+0.3000000000
+0.3300000000
+0.3330000000
+0.3000000000
+0.3300000000
+0.3330000000
+1.0000000000
+2.0000000000
+3.1400000000
+1.1200000000
+1.1200000000
+1.1220000000
+1.1200000000
+1.1220000000
+124.0000000000
+125.2000000000
+1255.4900000000
+3.1400000000
+3.1400000000
+3.1400000000
+1.0000000000
+1234567890.1234567890
+1234567890.1234567800
 PREHOOK: query: -- avg
 EXPLAIN SELECT value, sum(key) / count(key), avg(key), sum(key) FROM DECIMAL_UDF GROUP BY value ORDER BY value
 PREHOOK: type: QUERY
@@ -1643,23 +1643,23 @@ POSTHOOK: query: SELECT value, sum(key) / count(key), avg(key), sum(key) FROM DE
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--1234567890	-1234567890.123456789	-1234567890.123456789	-1234567890.123456789
--1255	-1255.49	-1255.49	-1255.49
--11	-1.122	-1.122	-1.122
--1	-1.12	-1.12	-2.24
-0	0.02538461538461538461538	0.02538461538462	0.33
-1	1.0484	1.0484	5.242
-2	2	2	4
-3	3.14	3.14	9.42
-4	3.14	3.14	3.14
-10	10	10	10
-20	20	20	20
-100	100	100	100
-124	124	124	124
-125	125.2	125.2	125.2
-200	200	200	200
-4400	-4400	-4400	-4400
-1234567890	1234567890.12345678	1234567890.12345678	1234567890.12345678
+-1234567890	-1234567890.12345678900000000000000	-1234567890.12345678900000	-1234567890.1234567890
+-1255	-1255.49000000000000000000000	-1255.49000000000000	-1255.4900000000
+-11	-1.12200000000000000000000	-1.12200000000000	-1.1220000000
+-1	-1.12000000000000000000000	-1.12000000000000	-2.2400000000
+0	0.02538461538461538461538	0.02538461538462	0.3300000000
+1	1.04840000000000000000000	1.04840000000000	5.2420000000
+2	2.00000000000000000000000	2.00000000000000	4.0000000000
+3	3.14000000000000000000000	3.14000000000000	9.4200000000
+4	3.14000000000000000000000	3.14000000000000	3.1400000000
+10	10.00000000000000000000000	10.00000000000000	10.0000000000
+20	20.00000000000000000000000	20.00000000000000	20.0000000000
+100	100.00000000000000000000000	100.00000000000000	100.0000000000
+124	124.00000000000000000000000	124.00000000000000	124.0000000000
+125	125.20000000000000000000000	125.20000000000000	125.2000000000
+200	200.00000000000000000000000	200.00000000000000	200.0000000000
+4400	-4400.00000000000000000000000	-4400.00000000000000	-4400.0000000000
+1234567890	1234567890.12345678000000000000000	1234567890.12345678000000	1234567890.1234567800
 PREHOOK: query: -- negative
 EXPLAIN SELECT -key FROM DECIMAL_UDF
 PREHOOK: type: QUERY
@@ -1704,44 +1704,44 @@ POSTHOOK: query: SELECT -key FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-4400
+4400.0000000000
 NULL
-0
-0
--100
--10
--1
--0.1
--0.01
--200
--20
--2
-0
--0.2
--0.02
--0.3
--0.33
--0.333
-0.3
-0.33
-0.333
--1
--2
--3.14
-1.12
-1.12
-1.122
--1.12
--1.122
--124
--125.2
-1255.49
--3.14
--3.14
--3.14
--1
-1234567890.123456789
--1234567890.12345678
+0.0000000000
+0.0000000000
+-100.0000000000
+-10.0000000000
+-1.0000000000
+-0.1000000000
+-0.0100000000
+-200.0000000000
+-20.0000000000
+-2.0000000000
+0.0000000000
+-0.2000000000
+-0.0200000000
+-0.3000000000
+-0.3300000000
+-0.3330000000
+0.3000000000
+0.3300000000
+0.3330000000
+-1.0000000000
+-2.0000000000
+-3.1400000000
+1.1200000000
+1.1200000000
+1.1220000000
+-1.1200000000
+-1.1220000000
+-124.0000000000
+-125.2000000000
+1255.4900000000
+-3.1400000000
+-3.1400000000
+-3.1400000000
+-1.0000000000
+1234567890.1234567890
+-1234567890.1234567800
 PREHOOK: query: -- positive
 EXPLAIN SELECT +key FROM DECIMAL_UDF
 PREHOOK: type: QUERY
@@ -1773,44 +1773,44 @@ POSTHOOK: query: SELECT +key FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--4400
+-4400.0000000000
 NULL
-0
-0
-100
-10
-1
-0.1
-0.01
-200
-20
-2
-0
-0.2
-0.02
-0.3
-0.33
-0.333
--0.3
--0.33
--0.333
-1
-2
-3.14
--1.12
--1.12
--1.122
-1.12
-1.122
-124
-125.2
--1255.49
-3.14
-3.14
-3.14
-1
--1234567890.123456789
-1234567890.12345678
+0.0000000000
+0.0000000000
+100.0000000000
+10.0000000000
+1.0000000000
+0.1000000000
+0.0100000000
+200.0000000000
+20.0000000000
+2.0000000000
+0.0000000000
+0.2000000000
+0.0200000000
+0.3000000000
+0.3300000000
+0.3330000000
+-0.3000000000
+-0.3300000000
+-0.3330000000
+1.0000000000
+2.0000000000
+3.1400000000
+-1.1200000000
+-1.1200000000
+-1.1220000000
+1.1200000000
+1.1220000000
+124.0000000000
+125.2000000000
+-1255.4900000000
+3.1400000000
+3.1400000000
+3.1400000000
+1.0000000000
+-1234567890.1234567890
+1234567890.1234567800
 PREHOOK: query: -- ceiling
 EXPlAIN SELECT CEIL(key) FROM DECIMAL_UDF
 PREHOOK: type: QUERY
@@ -2019,42 +2019,42 @@ POSTHOOK: query: SELECT ROUND(key, 2) FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--4400
+-4400.00
 NULL
-0
-0
-100
-10
-1
-0.1
+0.00
+0.00
+100.00
+10.00
+1.00
+0.10
 0.01
-200
-20
-2
-0
-0.2
+200.00
+20.00
+2.00
+0.00
+0.20
 0.02
-0.3
+0.30
 0.33
 0.33
--0.3
+-0.30
 -0.33
 -0.33
-1
-2
+1.00
+2.00
 3.14
 -1.12
 -1.12
 -1.12
 1.12
 1.12
-124
-125.2
+124.00
+125.20
 -1255.49
 3.14
 3.14
 3.14
-1
+1.00
 -1234567890.12
 1234567890.12
 PREHOOK: query: -- power
@@ -2182,44 +2182,44 @@ POSTHOOK: query: SELECT (key + 1) % (key / 2) FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--2199
+-2199.000000000000
 NULL
 NULL
 NULL
-1
-1
-0
-0
-0
-1
-1
-0
+1.000000000000
+1.000000000000
+0.000000000000
+0.000000000000
+0.000000000000
+1.000000000000
+1.000000000000
+0.000000000000
 NULL
-0
-0
-0.1
-0.01
-0.001
-0.1
-0.01
-0.001
-0
-0
-1
--0.12
--0.12
--0.122
-0.44
-0.439
-1
-1
--626.745
-1
-1
-1
-0
--617283944.0617283945
-1
+0.000000000000
+0.000000000000
+0.100000000000
+0.010000000000
+0.001000000000
+0.100000000000
+0.010000000000
+0.001000000000
+0.000000000000
+0.000000000000
+1.000000000000
+-0.120000000000
+-0.120000000000
+-0.122000000000
+0.440000000000
+0.439000000000
+1.000000000000
+1.000000000000
+-626.745000000000
+1.000000000000
+1.000000000000
+1.000000000000
+0.000000000000
+-617283944.061728394500
+1.000000000000
 PREHOOK: query: -- stddev, var
 EXPLAIN SELECT value, stddev(key), variance(key) FROM DECIMAL_UDF GROUP BY value
 PREHOOK: type: QUERY
@@ -2498,7 +2498,7 @@ POSTHOOK: query: SELECT MIN(key) FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
--1234567890.123456789
+-1234567890.1234567890
 PREHOOK: query: -- max
 EXPLAIN SELECT MAX(key) FROM DECIMAL_UDF
 PREHOOK: type: QUERY
@@ -2558,7 +2558,7 @@ POSTHOOK: query: SELECT MAX(key) FROM DECIMAL_UDF
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_udf
 #### A masked pattern was here ####
-1234567890.12345678
+1234567890.1234567800
 PREHOOK: query: -- count
 EXPLAIN SELECT COUNT(key) FROM DECIMAL_UDF
 PREHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/vector_reduce_groupby_decimal.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_reduce_groupby_decimal.q.out b/ql/src/test/results/clientpositive/vector_reduce_groupby_decimal.q.out
index 77dc175..5352885 100644
--- a/ql/src/test/results/clientpositive/vector_reduce_groupby_decimal.q.out
+++ b/ql/src/test/results/clientpositive/vector_reduce_groupby_decimal.q.out
@@ -113,56 +113,56 @@ LIMIT 50
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_test
 #### A masked pattern was here ####
--1073051226	-7382.0	-4409.2486486486	-5280.969230769231	-4409.2486486486
--1072081801	8373.0	5001.1702702703	5989.915384615385	5001.1702702703
--1072076362	-5470.0	-3267.2162162162	-3913.1538461538466	-3267.2162162162
--1070883071	-741.0	-442.5972972973	-530.1	-442.5972972973
--1070551679	-947.0	-565.6405405405	-677.4692307692308	-565.6405405405
--1069512165	11417.0	6819.3432432432	8167.546153846154	6819.3432432432
--1069109166	8390.0	5011.3243243243	6002.076923076923	5011.3243243243
--1068623584	-14005.0	-8365.1486486486	-10018.961538461539	-8365.1486486486
--1067386090	-3977.0	-2375.4513513514	-2845.084615384616	-2375.4513513514
--1066922682	-9987.0	-5965.2081081081	-7144.546153846154	-5965.2081081081
--1066226047	-9439.0	-5637.8891891892	-6752.515384615385	-5637.8891891892
--1065117869	2538.0	1515.9405405405	1815.646153846154	1515.9405405405
--1064949302	6454.0	3854.9567567568	4617.092307692308	3854.9567567568
--1063498122	-11480.0	-6856.972972973	-8212.615384615387	-6856.972972973
--1062973443	10541.0	6296.1108108108	7540.869230769231	6296.1108108108
--1061614989	-4234.0	-2528.9567567568	-3028.938461538462	-2528.9567567568
--1061057428	-1085.0	-648.0675675676	-776.1923076923077	-648.0675675676
--1059941909	8782.0	5245.4648648649	6282.507692307693	5245.4648648649
--1059338191	7322.0	4373.4108108108	5238.046153846154	4373.4108108108
--1059047258	12452.0	7437.5459459459	8907.969230769231	7437.5459459459
--1056684111	13991.0	8356.7864864865	10008.946153846155	8356.7864864865
--1055945837	13690.0	8177	9793.615384615387	8177
--1055669248	2570.0	1535.0540540541	1838.538461538462	1535.0540540541
--1055316250	-14990.0	-8953.4864864865	-10723.615384615385	-8953.4864864865
--1053385587	14504.0	8663.2	10375.938461538462	8663.2
--1053238077	-3704.0	-2212.3891891892	-2649.784615384616	-2212.3891891892
--1052745800	-12404.0	-7408.8756756757	-8873.630769230771	-7408.8756756757
--1052322972	-7433.0	-4439.7108108108	-5317.453846153847	-4439.7108108108
--1050684541	-8261.0	-4934.272972973	-5909.792307692308	-4934.272972973
--1050657303	-6999.0	-4180.4837837838	-5006.976923076923	-4180.4837837838
--1050165799	8634.0	5157.0648648649	6176.63076923077	5157.0648648649
+-1073051226	-7382.0	-4409.2486486486	-5280.96923076923100	-4409.2486486486
+-1072081801	8373.0	5001.1702702703	5989.91538461538500	5001.1702702703
+-1072076362	-5470.0	-3267.2162162162	-3913.15384615384660	-3267.2162162162
+-1070883071	-741.0	-442.5972972973	-530.10000000000000	-442.5972972973
+-1070551679	-947.0	-565.6405405405	-677.46923076923080	-565.6405405405
+-1069512165	11417.0	6819.3432432432	8167.54615384615400	6819.3432432432
+-1069109166	8390.0	5011.3243243243	6002.07692307692300	5011.3243243243
+-1068623584	-14005.0	-8365.1486486486	-10018.96153846153900	-8365.1486486486
+-1067386090	-3977.0	-2375.4513513514	-2845.08461538461600	-2375.4513513514
+-1066922682	-9987.0	-5965.2081081081	-7144.54615384615400	-5965.2081081081
+-1066226047	-9439.0	-5637.8891891892	-6752.51538461538500	-5637.8891891892
+-1065117869	2538.0	1515.9405405405	1815.64615384615400	1515.9405405405
+-1064949302	6454.0	3854.9567567568	4617.09230769230800	3854.9567567568
+-1063498122	-11480.0	-6856.9729729730	-8212.61538461538700	-6856.9729729730
+-1062973443	10541.0	6296.1108108108	7540.86923076923100	6296.1108108108
+-1061614989	-4234.0	-2528.9567567568	-3028.93846153846200	-2528.9567567568
+-1061057428	-1085.0	-648.0675675676	-776.19230769230770	-648.0675675676
+-1059941909	8782.0	5245.4648648649	6282.50769230769300	5245.4648648649
+-1059338191	7322.0	4373.4108108108	5238.04615384615400	4373.4108108108
+-1059047258	12452.0	7437.5459459459	8907.96923076923100	7437.5459459459
+-1056684111	13991.0	8356.7864864865	10008.94615384615500	8356.7864864865
+-1055945837	13690.0	8177.0000000000	9793.61538461538700	8177.0000000000
+-1055669248	2570.0	1535.0540540541	1838.53846153846200	1535.0540540541
+-1055316250	-14990.0	-8953.4864864865	-10723.61538461538500	-8953.4864864865
+-1053385587	14504.0	8663.2000000000	10375.93846153846200	8663.2000000000
+-1053238077	-3704.0	-2212.3891891892	-2649.78461538461600	-2212.3891891892
+-1052745800	-12404.0	-7408.8756756757	-8873.63076923077100	-7408.8756756757
+-1052322972	-7433.0	-4439.7108108108	-5317.45384615384700	-4439.7108108108
+-1050684541	-8261.0	-4934.2729729730	-5909.79230769230800	-4934.2729729730
+-1050657303	-6999.0	-4180.4837837838	-5006.97692307692300	-4180.4837837838
+-1050165799	8634.0	5157.0648648649	6176.63076923077000	5157.0648648649
 -1048934049	-524.0	-312.9837837838	-374.86153846153854	-312.9837837838
--1046399794	4130.0	2466.8378378378	2954.5384615384614	2466.8378378378
--1045867222	-8034.0	-4798.6864864865	-5747.400000000001	-4798.6864864865
--1045196363	-5039.0	-3009.7810810811	-3604.823076923077	-3009.7810810811
--1045181724	-5706.0	-3408.1783783784	-4081.9846153846156	-3408.1783783784
--1045087657	-5865.0	-3503.1486486486	-4195.7307692307695	-3503.1486486486
--1044207190	5381.0	3214.0567567568	3849.4846153846156	3214.0567567568
--1044093617	-3422.0	-2043.9513513514	-2448.046153846154	-2043.9513513514
--1043573508	16216.0	9685.772972973	11600.676923076924	9685.772972973
--1043132597	12302.0	7347.9513513514	8800.66153846154	7347.9513513514
--1043082182	9180.0	5483.1891891892	6567.2307692307695	5483.1891891892
--1042805968	5133.0	3065.927027027	3672.0692307692307	3065.927027027
--1042712895	9296.0	5552.4756756757	6650.215384615385	5552.4756756757
--1042396242	9583.0	5723.9	6855.53076923077	5723.9
--1041734429	-836.0	-499.3405405405	-598.0615384615385	-499.3405405405
--1041391389	-12970.0	-7746.9459459459	-9278.538461538463	-7746.9459459459
--1041252354	756.0	451.5567567568	540.8307692307692	451.5567567568
--1039776293	13704.0	8185.3621621622	9803.630769230771	8185.3621621622
--1039762548	-3802.0	-2270.9243243243	-2719.8923076923083	-2270.9243243243
+-1046399794	4130.0	2466.8378378378	2954.53846153846140	2466.8378378378
+-1045867222	-8034.0	-4798.6864864865	-5747.40000000000100	-4798.6864864865
+-1045196363	-5039.0	-3009.7810810811	-3604.82307692307700	-3009.7810810811
+-1045181724	-5706.0	-3408.1783783784	-4081.98461538461560	-3408.1783783784
+-1045087657	-5865.0	-3503.1486486486	-4195.73076923076950	-3503.1486486486
+-1044207190	5381.0	3214.0567567568	3849.48461538461560	3214.0567567568
+-1044093617	-3422.0	-2043.9513513514	-2448.04615384615400	-2043.9513513514
+-1043573508	16216.0	9685.7729729730	11600.67692307692400	9685.7729729730
+-1043132597	12302.0	7347.9513513514	8800.66153846154000	7347.9513513514
+-1043082182	9180.0	5483.1891891892	6567.23076923076950	5483.1891891892
+-1042805968	5133.0	3065.9270270270	3672.06923076923070	3065.9270270270
+-1042712895	9296.0	5552.4756756757	6650.21538461538500	5552.4756756757
+-1042396242	9583.0	5723.9000000000	6855.53076923077000	5723.9000000000
+-1041734429	-836.0	-499.3405405405	-598.06153846153850	-499.3405405405
+-1041391389	-12970.0	-7746.9459459459	-9278.53846153846300	-7746.9459459459
+-1041252354	756.0	451.5567567568	540.83076923076920	451.5567567568
+-1039776293	13704.0	8185.3621621622	9803.63076923077100	8185.3621621622
+-1039762548	-3802.0	-2270.9243243243	-2719.89230769230830	-2270.9243243243
 PREHOOK: query: SELECT sum(hash(*))
   FROM (SELECT cint, cdouble, cdecimal1, cdecimal2, min(cdecimal1) as min_decimal1 FROM decimal_test
         WHERE cdecimal1 is not null and cdecimal2 is not null

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/windowing_decimal.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/windowing_decimal.q.out b/ql/src/test/results/clientpositive/windowing_decimal.q.out
index 60563ba..b157a23 100644
--- a/ql/src/test/results/clientpositive/windowing_decimal.q.out
+++ b/ql/src/test/results/clientpositive/windowing_decimal.q.out
@@ -57,32 +57,32 @@ from part_dec
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@part_dec
 #### A masked pattern was here ####
-Manufacturer#1	1173.15	1173.15	2346.3
-Manufacturer#1	1173.15	1173.15	2346.3
-Manufacturer#1	1414.42	1173.15	3760.72
-Manufacturer#1	1602.59	1173.15	5363.31
-Manufacturer#1	1632.66	1173.15	6995.97
-Manufacturer#1	1753.76	1173.15	8749.73
-Manufacturer#2	1690.68	1690.68	1690.68
-Manufacturer#2	1698.66	1690.68	3389.34
-Manufacturer#2	1701.6	1690.68	5090.94
-Manufacturer#2	1800.7	1690.68	6891.64
-Manufacturer#2	2031.98	1690.68	8923.62
-Manufacturer#3	1190.27	1190.27	1190.27
-Manufacturer#3	1337.29	1190.27	2527.56
-Manufacturer#3	1410.39	1190.27	3937.95
-Manufacturer#3	1671.68	1190.27	5609.63
-Manufacturer#3	1922.98	1190.27	7532.61
-Manufacturer#4	1206.26	1206.26	1206.26
-Manufacturer#4	1290.35	1206.26	2496.61
-Manufacturer#4	1375.42	1206.26	3872.03
-Manufacturer#4	1620.67	1206.26	5492.7
-Manufacturer#4	1844.92	1206.26	7337.62
-Manufacturer#5	1018.1	1018.1	1018.1
-Manufacturer#5	1464.48	1018.1	2482.58
-Manufacturer#5	1611.66	1018.1	4094.24
-Manufacturer#5	1788.73	1018.1	5882.97
-Manufacturer#5	1789.69	1018.1	7672.66
+Manufacturer#1	1173.150	1173.150	2346.300
+Manufacturer#1	1173.150	1173.150	2346.300
+Manufacturer#1	1414.420	1173.150	3760.720
+Manufacturer#1	1602.590	1173.150	5363.310
+Manufacturer#1	1632.660	1173.150	6995.970
+Manufacturer#1	1753.760	1173.150	8749.730
+Manufacturer#2	1690.680	1690.680	1690.680
+Manufacturer#2	1698.660	1690.680	3389.340
+Manufacturer#2	1701.600	1690.680	5090.940
+Manufacturer#2	1800.700	1690.680	6891.640
+Manufacturer#2	2031.980	1690.680	8923.620
+Manufacturer#3	1190.270	1190.270	1190.270
+Manufacturer#3	1337.290	1190.270	2527.560
+Manufacturer#3	1410.390	1190.270	3937.950
+Manufacturer#3	1671.680	1190.270	5609.630
+Manufacturer#3	1922.980	1190.270	7532.610
+Manufacturer#4	1206.260	1206.260	1206.260
+Manufacturer#4	1290.350	1206.260	2496.610
+Manufacturer#4	1375.420	1206.260	3872.030
+Manufacturer#4	1620.670	1206.260	5492.700
+Manufacturer#4	1844.920	1206.260	7337.620
+Manufacturer#5	1018.100	1018.100	1018.100
+Manufacturer#5	1464.480	1018.100	2482.580
+Manufacturer#5	1611.660	1018.100	4094.240
+Manufacturer#5	1788.730	1018.100	5882.970
+Manufacturer#5	1789.690	1018.100	7672.660
 PREHOOK: query: select p_mfgr, p_retailprice, 
 first_value(p_retailprice) over(partition by p_mfgr order by p_retailprice range between 5 preceding and current row) ,
 sum(p_retailprice) over(partition by p_mfgr order by p_retailprice range between 5 preceding and current row)
@@ -97,29 +97,29 @@ from part_dec
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@part_dec
 #### A masked pattern was here ####
-Manufacturer#1	1173.15	1173.15	2346.3
-Manufacturer#1	1173.15	1173.15	2346.3
-Manufacturer#1	1414.42	1414.42	1414.42
-Manufacturer#1	1602.59	1602.59	1602.59
-Manufacturer#1	1632.66	1632.66	1632.66
-Manufacturer#1	1753.76	1753.76	1753.76
-Manufacturer#2	1690.68	1690.68	1690.68
-Manufacturer#2	1698.66	1698.66	1698.66
-Manufacturer#2	1701.6	1698.66	3400.26
-Manufacturer#2	1800.7	1800.7	1800.7
-Manufacturer#2	2031.98	2031.98	2031.98
-Manufacturer#3	1190.27	1190.27	1190.27
-Manufacturer#3	1337.29	1337.29	1337.29
-Manufacturer#3	1410.39	1410.39	1410.39
-Manufacturer#3	1671.68	1671.68	1671.68
-Manufacturer#3	1922.98	1922.98	1922.98
-Manufacturer#4	1206.26	1206.26	1206.26
-Manufacturer#4	1290.35	1290.35	1290.35
-Manufacturer#4	1375.42	1375.42	1375.42
-Manufacturer#4	1620.67	1620.67	1620.67
-Manufacturer#4	1844.92	1844.92	1844.92
-Manufacturer#5	1018.1	1018.1	1018.1
-Manufacturer#5	1464.48	1464.48	1464.48
-Manufacturer#5	1611.66	1611.66	1611.66
-Manufacturer#5	1788.73	1788.73	1788.73
-Manufacturer#5	1789.69	1788.73	3578.42
+Manufacturer#1	1173.150	1173.150	2346.300
+Manufacturer#1	1173.150	1173.150	2346.300
+Manufacturer#1	1414.420	1414.420	1414.420
+Manufacturer#1	1602.590	1602.590	1602.590
+Manufacturer#1	1632.660	1632.660	1632.660
+Manufacturer#1	1753.760	1753.760	1753.760
+Manufacturer#2	1690.680	1690.680	1690.680
+Manufacturer#2	1698.660	1698.660	1698.660
+Manufacturer#2	1701.600	1698.660	3400.260
+Manufacturer#2	1800.700	1800.700	1800.700
+Manufacturer#2	2031.980	2031.980	2031.980
+Manufacturer#3	1190.270	1190.270	1190.270
+Manufacturer#3	1337.290	1337.290	1337.290
+Manufacturer#3	1410.390	1410.390	1410.390
+Manufacturer#3	1671.680	1671.680	1671.680
+Manufacturer#3	1922.980	1922.980	1922.980
+Manufacturer#4	1206.260	1206.260	1206.260
+Manufacturer#4	1290.350	1290.350	1290.350
+Manufacturer#4	1375.420	1375.420	1375.420
+Manufacturer#4	1620.670	1620.670	1620.670
+Manufacturer#4	1844.920	1844.920	1844.920
+Manufacturer#5	1018.100	1018.100	1018.100
+Manufacturer#5	1464.480	1464.480	1464.480
+Manufacturer#5	1611.660	1611.660	1611.660
+Manufacturer#5	1788.730	1788.730	1788.730
+Manufacturer#5	1789.690	1788.730	3578.420

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/windowing_navfn.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/windowing_navfn.q.out b/ql/src/test/results/clientpositive/windowing_navfn.q.out
index ae7d95a..a79fccc 100644
--- a/ql/src/test/results/clientpositive/windowing_navfn.q.out
+++ b/ql/src/test/results/clientpositive/windowing_navfn.q.out
@@ -287,13 +287,13 @@ POSTHOOK: Input: default@over10k
 65536	98.42
 65536	0.93
 65536	83.48
-65536	75.7
+65536	75.70
 65536	88.04
 65536	94.09
 65536	33.45
 65536	44.41
 65536	22.15
-65536	20.5
+65536	20.50
 65536	58.86
 65536	30.91
 65536	74.47
@@ -310,9 +310,9 @@ POSTHOOK: Input: default@over10k
 65536	80.26
 65536	35.07
 65536	95.88
-65536	30.6
+65536	30.60
 65536	46.97
-65536	58.8
+65536	58.80
 65536	5.72
 65536	29.27
 65536	62.25
@@ -336,7 +336,7 @@ POSTHOOK: Input: default@over10k
 65537	35.86
 65537	47.75
 65537	1.12
-65537	52.9
+65537	52.90
 65537	53.92
 65537	43.45
 65537	7.52
@@ -350,20 +350,20 @@ POSTHOOK: Input: default@over10k
 65537	56.48
 65537	83.21
 65537	56.52
-65537	36.6
-65537	59.7
+65537	36.60
+65537	59.70
 65537	80.14
-65537	66.3
+65537	66.30
 65537	94.87
 65537	40.92
-65537	25.2
+65537	25.20
 65537	7.36
 65538	NULL
 65538	53.35
 65538	54.64
 65538	76.67
 65538	15.17
-65538	1.2
+65538	1.20
 65538	13.71
 65538	81.59
 65538	43.33

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/windowing_rank.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/windowing_rank.q.out b/ql/src/test/results/clientpositive/windowing_rank.q.out
index 6a74a8e..67975f3 100644
--- a/ql/src/test/results/clientpositive/windowing_rank.q.out
+++ b/ql/src/test/results/clientpositive/windowing_rank.q.out
@@ -508,16 +508,16 @@ where rnk =  1 limit 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@over10k
 #### A masked pattern was here ####
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
-2013-03-01 09:11:58.70307	0.5	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
+2013-03-01 09:11:58.70307	0.50	1
 PREHOOK: query: select ts, dec, rnk
 from
   (select ts, dec,
@@ -546,16 +546,16 @@ where dec = 89.5 limit 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@over10k
 #### A masked pattern was here ####
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
-2013-03-01 09:11:58.703124	89.5	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
+2013-03-01 09:11:58.703124	89.50	1
 PREHOOK: query: select ts, dec, rnk
 from
   (select ts, dec,
@@ -586,13 +586,13 @@ where rnk = 1 limit 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@over10k
 #### A masked pattern was here ####
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
-2013-03-01 09:11:58.70307	37.3	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1
+2013-03-01 09:11:58.70307	37.30	1

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/ql/src/test/results/clientpositive/windowing_windowspec3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/windowing_windowspec3.q.out b/ql/src/test/results/clientpositive/windowing_windowspec3.q.out
index aeb5adc..e311cf9 100644
--- a/ql/src/test/results/clientpositive/windowing_windowspec3.q.out
+++ b/ql/src/test/results/clientpositive/windowing_windowspec3.q.out
@@ -215,18 +215,18 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@emp
 #### A masked pattern was here ####
 10	7839	NULL	5000.0	5000.0	5000.0	NULL	NULL	1687.5	5000.0
-10	7782	50	2450.0	2450.0	1687.5	NULL	1500.0	NULL	2350.0
-10	7934	100	1300.0	1875.0	1687.5	NULL	NULL	NULL	2350.0
-10	7987	150.5	1500.0	1750.0	1687.5	NULL	NULL	NULL	2350.0
-10	7988	200	1500.0	1687.5	1687.5	2450.0	NULL	NULL	2350.0
+10	7782	50.00	2450.0	2450.0	1687.5	NULL	1500.0	NULL	2350.0
+10	7934	100.00	1300.0	1875.0	1687.5	NULL	NULL	NULL	2350.0
+10	7987	150.50	1500.0	1750.0	1687.5	NULL	NULL	NULL	2350.0
+10	7988	200.00	1500.0	1687.5	1687.5	2450.0	NULL	NULL	2350.0
 20	7788	NULL	3000.0	1975.0	1975.0	NULL	NULL	2975.0	1975.0
 20	7902	NULL	3000.0	1975.0	1975.0	NULL	NULL	2975.0	1975.0
 20	7876	NULL	1100.0	1975.0	1975.0	NULL	NULL	2975.0	1975.0
 20	7369	NULL	800.0	1975.0	1975.0	NULL	NULL	2975.0	1975.0
-20	7566	100	2975.0	2975.0	2975.0	NULL	NULL	NULL	2175.0
+20	7566	100.00	2975.0	2975.0	2975.0	NULL	NULL	NULL	2175.0
 30	7900	NULL	950.0	1900.0	1900.0	NULL	NULL	1400.0	1900.0
 30	7698	NULL	2850.0	1900.0	1900.0	NULL	NULL	1400.0	1900.0
-30	7499	200.5	1600.0	1600.0	1450.0	NULL	NULL	1250.0	1630.0
-30	7844	300	1500.0	1550.0	1400.0	NULL	1250.0	NULL	1566.6666666666667
-30	7521	300.5	1250.0	1450.0	1400.0	NULL	1250.0	NULL	1566.6666666666667
-30	7654	500	1250.0	1333.3333333333333	1333.3333333333333	1375.0	NULL	NULL	1566.6666666666667
+30	7499	200.50	1600.0	1600.0	1450.0	NULL	NULL	1250.0	1630.0
+30	7844	300.00	1500.0	1550.0	1400.0	NULL	1250.0	NULL	1566.6666666666667
+30	7521	300.50	1250.0	1450.0	1400.0	NULL	1250.0	NULL	1566.6666666666667
+30	7654	500.00	1250.0	1333.3333333333333	1333.3333333333333	1375.0	NULL	NULL	1566.6666666666667

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/fast/BinarySortableSerializeWrite.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/fast/BinarySortableSerializeWrite.java b/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/fast/BinarySortableSerializeWrite.java
index 709e53f..9ea6e91 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/fast/BinarySortableSerializeWrite.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/fast/BinarySortableSerializeWrite.java
@@ -366,7 +366,7 @@ public final class BinarySortableSerializeWrite implements SerializeWrite {
    * DECIMAL.
    */
   @Override
-  public void writeHiveDecimal(HiveDecimal dec) throws IOException {
+  public void writeHiveDecimal(HiveDecimal dec, int scale) throws IOException {
     final boolean invert = columnSortOrderIsDesc[++index];
 
     // This field is not a null.

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/java/org/apache/hadoop/hive/serde2/fast/SerializeWrite.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/fast/SerializeWrite.java b/serde/src/java/org/apache/hadoop/hive/serde2/fast/SerializeWrite.java
index e6fb8b6..21daa8b 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/fast/SerializeWrite.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/fast/SerializeWrite.java
@@ -151,5 +151,5 @@ public interface SerializeWrite {
   /*
    * DECIMAL.
    */
-  void writeHiveDecimal(HiveDecimal dec) throws IOException;
+  void writeHiveDecimal(HiveDecimal dec, int scale) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java
index 40601c0..4e82e9b 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java
@@ -102,12 +102,12 @@ public class LazyHiveDecimal extends LazyPrimitive<LazyHiveDecimalObjectInspecto
    * @param hiveDecimal
    * @throws IOException
    */
-  public static void writeUTF8(OutputStream outputStream, HiveDecimal hiveDecimal)
+  public static void writeUTF8(OutputStream outputStream, HiveDecimal hiveDecimal, int scale)
     throws IOException {
     if (hiveDecimal == null) {
       outputStream.write(nullBytes);
     } else {
-      ByteBuffer b = Text.encode(hiveDecimal.toString());
+      ByteBuffer b = Text.encode(hiveDecimal.toFormatString(scale));
       outputStream.write(b.array(), 0, b.limit());
     }
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java
index d6b2219..29d6ad8 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java
@@ -304,8 +304,9 @@ public final class LazyUtils {
       break;
     }
     case DECIMAL: {
+      HiveDecimalObjectInspector decimalOI = (HiveDecimalObjectInspector) oi;
       LazyHiveDecimal.writeUTF8(out,
-        ((HiveDecimalObjectInspector) oi).getPrimitiveJavaObject(o));
+        decimalOI.getPrimitiveJavaObject(o), decimalOI.scale());
       break;
     }
     default: {

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/java/org/apache/hadoop/hive/serde2/lazy/fast/LazySimpleSerializeWrite.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/fast/LazySimpleSerializeWrite.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/fast/LazySimpleSerializeWrite.java
index 986d246..b64a803 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/fast/LazySimpleSerializeWrite.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/fast/LazySimpleSerializeWrite.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hive.serde2.lazy.fast;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.nio.charset.CharacterCodingException;
 import java.sql.Date;
 import java.sql.Timestamp;
 
@@ -34,7 +33,6 @@ import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
 import org.apache.hadoop.hive.common.type.HiveVarchar;
 import org.apache.hadoop.hive.serde2.ByteStream.Output;
 import org.apache.hadoop.hive.serde2.io.DateWritable;
-import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
 import org.apache.hadoop.hive.serde2.io.TimestampWritable;
@@ -47,13 +45,6 @@ import org.apache.hadoop.hive.serde2.lazy.LazyLong;
 import org.apache.hadoop.hive.serde2.lazy.LazySerDeParameters;
 import org.apache.hadoop.hive.serde2.lazy.LazyTimestamp;
 import org.apache.hadoop.hive.serde2.lazy.LazyUtils;
-import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyObjectInspectorParameters;
-import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.ByteObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.DateObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveDecimalObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.LongObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampObjectInspector;
 import org.apache.hadoop.hive.serde2.fast.SerializeWrite;
 import org.apache.hadoop.io.Text;
 import org.apache.hive.common.util.DateUtils;
@@ -506,13 +497,12 @@ public final class LazySimpleSerializeWrite implements SerializeWrite {
    * DECIMAL.
    */
   @Override
-  public void writeHiveDecimal(HiveDecimal v) throws IOException {
-
+  public void writeHiveDecimal(HiveDecimal v, int scale) throws IOException {
     if (index > 0) {
       output.write(separator);
     }
 
-    LazyHiveDecimal.writeUTF8(output, v);
+    LazyHiveDecimal.writeUTF8(output, v, scale);
 
     index++;
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/fast/LazyBinarySerializeWrite.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/fast/LazyBinarySerializeWrite.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/fast/LazyBinarySerializeWrite.java
index ebe4181..8f81df6 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/fast/LazyBinarySerializeWrite.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/fast/LazyBinarySerializeWrite.java
@@ -713,7 +713,7 @@ public class LazyBinarySerializeWrite implements SerializeWrite {
    * DECIMAL.
    */
   @Override
-  public void writeHiveDecimal(HiveDecimal v) throws IOException {
+  public void writeHiveDecimal(HiveDecimal v, int scale) throws IOException {
 
     // Every 8 fields we write a NULL byte.
     if ((fieldIndex % 8) == 0) {

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/test/org/apache/hadoop/hive/serde2/VerifyFast.java
----------------------------------------------------------------------
diff --git a/serde/src/test/org/apache/hadoop/hive/serde2/VerifyFast.java b/serde/src/test/org/apache/hadoop/hive/serde2/VerifyFast.java
index fa46c9e..fc845a5 100644
--- a/serde/src/test/org/apache/hadoop/hive/serde2/VerifyFast.java
+++ b/serde/src/test/org/apache/hadoop/hive/serde2/VerifyFast.java
@@ -259,12 +259,12 @@ public class VerifyFast {
     }
   }
 
-  public static void serializeWrite(SerializeWrite serializeWrite, PrimitiveCategory primitiveCategory, Object object) throws IOException {
+  public static void serializeWrite(SerializeWrite serializeWrite, PrimitiveTypeInfo primitiveTypeInfo, Object object) throws IOException {
     if (object == null) {
       serializeWrite.writeNull();
       return;
     }
-    switch (primitiveCategory) {
+    switch (primitiveTypeInfo.getPrimitiveCategory()) {
       case BOOLEAN:
       {
         boolean value = (Boolean) object;
@@ -330,7 +330,8 @@ public class VerifyFast {
     case DECIMAL:
       {
         HiveDecimal value = (HiveDecimal) object;
-        serializeWrite.writeHiveDecimal(value);
+        DecimalTypeInfo decTypeInfo = (DecimalTypeInfo)primitiveTypeInfo;
+        serializeWrite.writeHiveDecimal(value, decTypeInfo.scale());
       }
       break;
     case DATE:
@@ -365,7 +366,7 @@ public class VerifyFast {
       }
       break;
     default:
-      throw new Error("Unknown primitive category " + primitiveCategory.name());
+      throw new Error("Unknown primitive category " + primitiveTypeInfo.getPrimitiveCategory().name());
     }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableFast.java
----------------------------------------------------------------------
diff --git a/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableFast.java b/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableFast.java
index 4438bdc..ae476ae 100644
--- a/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableFast.java
+++ b/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableFast.java
@@ -62,8 +62,7 @@ public class TestBinarySortableFast extends TestCase {
       int[] perFieldWriteLengths = new int[MyTestPrimitiveClass.primitiveCount];
       for (int index = 0; index < MyTestPrimitiveClass.primitiveCount; index++) {
         Object object = t.getPrimitiveObject(index);
-        PrimitiveCategory primitiveCategory = t.getPrimitiveCategory(index);
-        VerifyFast.serializeWrite(binarySortableSerializeWrite, primitiveCategory, object);
+        VerifyFast.serializeWrite(binarySortableSerializeWrite, primitiveTypeInfoMap.get(t)[index], object);
         perFieldWriteLengths[index] = output.getLength();
       }
       perFieldWriteLengthsArray[i] = perFieldWriteLengths;

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleFast.java
----------------------------------------------------------------------
diff --git a/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleFast.java b/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleFast.java
index 951d91a..7ebe7ae 100644
--- a/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleFast.java
+++ b/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleFast.java
@@ -61,8 +61,7 @@ public class TestLazySimpleFast extends TestCase {
 
       for (int index = 0; index < MyTestPrimitiveClass.primitiveCount; index++) {
         Object object = t.getPrimitiveObject(index);
-        PrimitiveCategory primitiveCategory = t.getPrimitiveCategory(index);
-        VerifyFast.serializeWrite(lazySimpleSerializeWrite, primitiveCategory, object);
+        VerifyFast.serializeWrite(lazySimpleSerializeWrite, primitiveTypeInfosArray[i][index], object);
       }
 
       BytesWritable bytesWritable = new BytesWritable();

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/serde/src/test/org/apache/hadoop/hive/serde2/lazybinary/TestLazyBinaryFast.java
----------------------------------------------------------------------
diff --git a/serde/src/test/org/apache/hadoop/hive/serde2/lazybinary/TestLazyBinaryFast.java b/serde/src/test/org/apache/hadoop/hive/serde2/lazybinary/TestLazyBinaryFast.java
index a169586..4032743 100644
--- a/serde/src/test/org/apache/hadoop/hive/serde2/lazybinary/TestLazyBinaryFast.java
+++ b/serde/src/test/org/apache/hadoop/hive/serde2/lazybinary/TestLazyBinaryFast.java
@@ -60,8 +60,7 @@ public class TestLazyBinaryFast extends TestCase {
 
       for (int index = 0; index < MyTestPrimitiveClass.primitiveCount; index++) {
         Object object = t.getPrimitiveObject(index);
-        PrimitiveCategory primitiveCategory = t.getPrimitiveCategory(index);
-        VerifyFast.serializeWrite(lazyBinarySerializeWrite, primitiveCategory, object);
+        VerifyFast.serializeWrite(lazyBinarySerializeWrite, primitiveTypeInfosArray[i][index], object);
       }
 
       BytesWritable bytesWritable = new BytesWritable();

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
----------------------------------------------------------------------
diff --git a/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java b/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
index 4ed17a2..1c6be91 100644
--- a/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
+++ b/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
@@ -102,6 +102,17 @@ public class HiveDecimal implements Comparable<HiveDecimal> {
   public String toString() {
      return bd.toPlainString();
   }
+  
+  /**
+   * Return a string representation of the number with the number of decimal digits as
+   * the given scale. Please note that this is different from toString().
+   * @param scale the number of digits after the decimal point
+   * @return the string representation of exact number of decimal digits
+   */
+  public String toFormatString(int scale) {
+    return (bd.scale() == scale ? bd :
+      bd.setScale(scale, RoundingMode.HALF_UP)).toPlainString();
+  }
 
   public HiveDecimal setScale(int i) {
     return new HiveDecimal(bd.setScale(i, RoundingMode.HALF_UP));

http://git-wip-us.apache.org/repos/asf/hive/blob/13f8cfec/storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/DecimalColumnVector.java
----------------------------------------------------------------------
diff --git a/storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/DecimalColumnVector.java b/storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/DecimalColumnVector.java
index a7d31fa..fe8ad85 100644
--- a/storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/DecimalColumnVector.java
+++ b/storage-api/src/java/org/apache/hadoop/hive/ql/exec/vector/DecimalColumnVector.java
@@ -17,10 +17,8 @@
  */
 
 package org.apache.hadoop.hive.ql.exec.vector;
-import java.io.IOException;
 import java.math.BigInteger;
 
-
 import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
 import org.apache.hadoop.hive.common.type.HiveDecimal;
 


Mime
View raw message