hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1465261 - in /hive/trunk: ql/src/test/results/clientpositive/ serde/src/java/org/apache/hadoop/hive/serde2/
Date Sat, 06 Apr 2013 15:25:37 GMT
Author: hashutosh
Date: Sat Apr  6 15:25:37 2013
New Revision: 1465261

URL: http://svn.apache.org/r1465261
Log:
HIVE-3840 : hive cli null representation in output is inconsistent (Thejas Nair via Ashutosh
Chauhan)

Modified:
    hive/trunk/ql/src/test/results/clientpositive/avro_nullable_fields.q.out
    hive/trunk/ql/src/test/results/clientpositive/columnarserde_create_shortcut.q.out
    hive/trunk/ql/src/test/results/clientpositive/create_nested_type.q.out
    hive/trunk/ql/src/test/results/clientpositive/input17.q.out
    hive/trunk/ql/src/test/results/clientpositive/input5.q.out
    hive/trunk/ql/src/test/results/clientpositive/input_columnarserde.q.out
    hive/trunk/ql/src/test/results/clientpositive/input_dynamicserde.q.out
    hive/trunk/ql/src/test/results/clientpositive/input_lazyserde.q.out
    hive/trunk/ql/src/test/results/clientpositive/input_testxpath3.q.out
    hive/trunk/ql/src/test/results/clientpositive/join_thrift.q.out
    hive/trunk/ql/src/test/results/clientpositive/udf_percentile.q.out
    hive/trunk/ql/src/test/results/clientpositive/udf_substr.q.out
    hive/trunk/ql/src/test/results/clientpositive/udtf_stack.q.out
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java

Modified: hive/trunk/ql/src/test/results/clientpositive/avro_nullable_fields.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/avro_nullable_fields.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/avro_nullable_fields.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/avro_nullable_fields.q.out Sat Apr  6 15:25:37
2013
@@ -171,10 +171,10 @@ string	42	3	100	NULL	true	42.43	85.23423
 string	42	3	100	1412341	NULL	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
 string	42	3	100	1412341	true	NULL	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
 string	42	3	100	1412341	true	42.43	NULL	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
-string	42	3	100	1412341	true	42.43	85.23423424	null	{"Earth":42,"Bob":31,"Control":86}	{"sint":17,"sboolean":true,"sstring":"Abe
Linkedin"}	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
-string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	null	{"sint":17,"sboolean":true,"sstring":"Abe
Linkedin"}	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
-string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
null	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
+string	42	3	100	1412341	true	42.43	85.23423424	NULL	{"Earth":42,"Bob":31,"Control":86}	{"sint":17,"sboolean":true,"sstring":"Abe
Linkedin"}	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
+string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	NULL	{"sint":17,"sboolean":true,"sstring":"Abe
Linkedin"}	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
+string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
NULL	BLUE	72	[0,1,2,3,4,5]	[50,51,53]
 string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	NULL	72	[0,1,2,3,4,5]	[50,51,53]
 string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	NULL	[0,1,2,3,4,5]	[50,51,53]
-string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	72	null	[50,51,53]
-string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	72	[0,1,2,3,4,5]	null
+string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	72	NULL	[50,51,53]
+string	42	3	100	1412341	true	42.43	85.23423424	["alpha","beta","gamma"]	{"Earth":42,"Bob":31,"Control":86}
{"sint":17,"sboolean":true,"sstring":"Abe Linkedin"}	BLUE	72	[0,1,2,3,4,5]	NULL

Modified: hive/trunk/ql/src/test/results/clientpositive/columnarserde_create_shortcut.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/columnarserde_create_shortcut.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/columnarserde_create_shortcut.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/columnarserde_create_shortcut.q.out Sat
Apr  6 15:25:37 2013
@@ -119,7 +119,7 @@ POSTHOOK: Lineage: columnarserde_create_
 [7,14,21]	["70","700","7000"]	{"key_7":"value_7"}	-1461153973	record_7
 [8,16,24]	["80","800","8000"]	{"key_8":"value_8"}	1638581578	record_8
 [9,18,27]	["90","900","9000"]	{"key_9":"value_9"}	336964413	record_9
-null	null	null	0	NULL
+NULL	NULL	NULL	0	NULL
 PREHOOK: query: SELECT columnarserde_create_shortcut.a[0], columnarserde_create_shortcut.b[0],
columnarserde_create_shortcut.c['key2'], columnarserde_create_shortcut.d, columnarserde_create_shortcut.e
FROM columnarserde_create_shortcut CLUSTER BY 1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@columnarserde_create_shortcut

Modified: hive/trunk/ql/src/test/results/clientpositive/create_nested_type.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/create_nested_type.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/create_nested_type.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/create_nested_type.q.out Sat Apr  6 15:25:37
2013
@@ -52,4 +52,4 @@ POSTHOOK: Input: default@table1
 a0	["b00","b01"]	[{"c001":"C001","c002":"C002"},{"c011":null,"c012":"C012"}]	{"d01":["d011","d012"],"d02":["d021","d022"]}
 a1	["b10"]	[{"c001":"C001","c002":"C002"}]	{"d01":["d011","d012"],"d02":null}
 a2	[]	[{"c001":null,"c002":"C002"},{"c011":"C011","c012":"C012"}]	{"d01":[null,"d012"],"d02":["d021","d022"]}
-a3	null	null	null
+a3	NULL	NULL	NULL

Modified: hive/trunk/ql/src/test/results/clientpositive/input17.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/input17.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/input17.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/input17.q.out Sat Apr  6 15:25:37 2013
@@ -126,7 +126,7 @@ POSTHOOK: Input: default@dest1
 #### A masked pattern was here ####
 POSTHOOK: Lineage: dest1.key SCRIPT [(src_thrift)src_thrift.FieldSchema(name:aint, type:int,
comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lint, type:array<int>,
comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array<struct<myint:int,mystring:string,underscore_int:int>>,
comment:from deserializer), ]
 POSTHOOK: Lineage: dest1.value SCRIPT [(src_thrift)src_thrift.FieldSchema(name:aint, type:int,
comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lint, type:array<int>,
comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array<struct<myint:int,mystring:string,underscore_int:int>>,
comment:from deserializer), ]
-NULL	null
+NULL	NULL
 -1461153966	{"myint":49,"mystring":"343","underscore_int":7}
 -1952710705	{"myint":25,"mystring":"125","underscore_int":5}
 -734328905	{"myint":16,"mystring":"64","underscore_int":4}

Modified: hive/trunk/ql/src/test/results/clientpositive/input5.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/input5.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/input5.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/input5.q.out Sat Apr  6 15:25:37 2013
@@ -126,6 +126,7 @@ POSTHOOK: Input: default@dest1
 #### A masked pattern was here ####
 POSTHOOK: Lineage: dest1.key SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array<int>,
comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array<struct<myint:int,mystring:string,underscore_int:int>>,
comment:from deserializer), ]
 POSTHOOK: Lineage: dest1.value SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array<int>,
comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array<struct<myint:int,mystring:string,underscore_int:int>>,
comment:from deserializer), ]
+NULL	NULL
 [0,0,0]	[{"myint":0,"mystring":"0","underscore_int":0}]
 [1,2,3]	[{"myint":1,"mystring":"1","underscore_int":1}]
 [2,4,6]	[{"myint":4,"mystring":"8","underscore_int":2}]
@@ -136,4 +137,3 @@ POSTHOOK: Lineage: dest1.value SCRIPT [(
 [7,14,21]	[{"myint":49,"mystring":"343","underscore_int":7}]
 [8,16,24]	[{"myint":64,"mystring":"512","underscore_int":8}]
 [9,18,27]	[{"myint":81,"mystring":"729","underscore_int":9}]
-null	null

Modified: hive/trunk/ql/src/test/results/clientpositive/input_columnarserde.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/input_columnarserde.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/input_columnarserde.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/input_columnarserde.q.out Sat Apr  6 15:25:37
2013
@@ -129,7 +129,7 @@ POSTHOOK: Lineage: input_columnarserde.e
 [7,14,21]	["70","700","7000"]	{"key_7":"value_7"}	-1461153973	record_7
 [8,16,24]	["80","800","8000"]	{"key_8":"value_8"}	1638581578	record_8
 [9,18,27]	["90","900","9000"]	{"key_9":"value_9"}	336964413	record_9
-null	null	null	0	NULL
+NULL	NULL	NULL	0	NULL
 PREHOOK: query: SELECT input_columnarserde.a[0], input_columnarserde.b[0], input_columnarserde.c['key2'],
input_columnarserde.d, input_columnarserde.e FROM input_columnarserde DISTRIBUTE BY 1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@input_columnarserde

Modified: hive/trunk/ql/src/test/results/clientpositive/input_dynamicserde.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/input_dynamicserde.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/input_dynamicserde.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/input_dynamicserde.q.out Sat Apr  6 15:25:37
2013
@@ -158,7 +158,7 @@ POSTHOOK: Lineage: dest1.e SIMPLE [(src_
 [7,14,21]	["70","700","7000"]	{"key_7":"value_7"}	-1461153973	record_7
 [8,16,24]	["80","800","8000"]	{"key_8":"value_8"}	1638581578	record_8
 [9,18,27]	["90","900","9000"]	{"key_9":"value_9"}	336964413	record_9
-null	null	null	0	NULL
+NULL	NULL	NULL	0	NULL
 PREHOOK: query: SELECT dest1.a[0], dest1.b[0], dest1.c['key2'], dest1.d, dest1.e FROM dest1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@dest1

Modified: hive/trunk/ql/src/test/results/clientpositive/input_lazyserde.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/input_lazyserde.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/input_lazyserde.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/input_lazyserde.q.out Sat Apr  6 15:25:37
2013
@@ -131,7 +131,7 @@ POSTHOOK: Lineage: dest1.e SIMPLE [(src_
 [7,14,21]	["70","700","7000"]	{"key_7":"value_7"}	-1461153973	record_7
 [8,16,24]	["80","800","8000"]	{"key_8":"value_8"}	1638581578	record_8
 [9,18,27]	["90","900","9000"]	{"key_9":"value_9"}	336964413	record_9
-null	null	null	0	NULL
+NULL	NULL	NULL	0	NULL
 PREHOOK: query: SELECT dest1.a[0], dest1.b[0], dest1.c['key2'], dest1.d, dest1.e FROM dest1
CLUSTER BY 1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@dest1
@@ -217,7 +217,7 @@ POSTHOOK: Lineage: dest1.e SIMPLE [(src_
 [7,14,21]
 [8,16,24]
 [9,18,27]
-null
+NULL
 PREHOOK: query: DROP TABLE dest1
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@dest1
@@ -283,4 +283,4 @@ POSTHOOK: Lineage: dest1.e SIMPLE [(src_
 {"key_7":"value_7"}
 {"key_8":"value_8"}
 {"key_9":"value_9"}
-null
+NULL

Modified: hive/trunk/ql/src/test/results/clientpositive/input_testxpath3.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/input_testxpath3.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/input_testxpath3.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/input_testxpath3.q.out Sat Apr  6 15:25:37
2013
@@ -59,4 +59,4 @@ NULL	[36]
 NULL	[49]
 NULL	[64]
 value_9	[81]
-NULL	null
+NULL	NULL

Modified: hive/trunk/ql/src/test/results/clientpositive/join_thrift.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/join_thrift.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/join_thrift.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/join_thrift.q.out Sat Apr  6 15:25:37 2013
@@ -109,7 +109,7 @@ POSTHOOK: Input: default@src_thrift
 -1461153973	[{"myint":49,"mystring":"343","underscore_int":7}]
 -751827638	[{"myint":4,"mystring":"8","underscore_int":2}]
 -734328909	[{"myint":16,"mystring":"64","underscore_int":4}]
-0	null
+0	NULL
 336964413	[{"myint":81,"mystring":"729","underscore_int":9}]
 465985200	[{"myint":1,"mystring":"1","underscore_int":1}]
 477111222	[{"myint":9,"mystring":"27","underscore_int":3}]

Modified: hive/trunk/ql/src/test/results/clientpositive/udf_percentile.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/udf_percentile.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/udf_percentile.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/udf_percentile.q.out Sat Apr  6 15:25:37
2013
@@ -306,56 +306,56 @@ GROUP BY CAST(key AS INT) DIV 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-0	NULL	null
-1	NULL	null
-2	NULL	null
-3	NULL	null
-4	NULL	null
-5	NULL	null
-6	NULL	null
-7	NULL	null
-8	NULL	null
-9	NULL	null
-10	NULL	null
-11	NULL	null
-12	NULL	null
-13	NULL	null
-14	NULL	null
-15	NULL	null
-16	NULL	null
-17	NULL	null
-18	NULL	null
-19	NULL	null
-20	NULL	null
-21	NULL	null
-22	NULL	null
-23	NULL	null
-24	NULL	null
-25	NULL	null
-26	NULL	null
-27	NULL	null
-28	NULL	null
-29	NULL	null
-30	NULL	null
-31	NULL	null
-32	NULL	null
-33	NULL	null
-34	NULL	null
-35	NULL	null
-36	NULL	null
-37	NULL	null
-38	NULL	null
-39	NULL	null
-40	NULL	null
-41	NULL	null
-42	NULL	null
-43	NULL	null
-44	NULL	null
-45	NULL	null
-46	NULL	null
-47	NULL	null
-48	NULL	null
-49	NULL	null
+0	NULL	NULL
+1	NULL	NULL
+2	NULL	NULL
+3	NULL	NULL
+4	NULL	NULL
+5	NULL	NULL
+6	NULL	NULL
+7	NULL	NULL
+8	NULL	NULL
+9	NULL	NULL
+10	NULL	NULL
+11	NULL	NULL
+12	NULL	NULL
+13	NULL	NULL
+14	NULL	NULL
+15	NULL	NULL
+16	NULL	NULL
+17	NULL	NULL
+18	NULL	NULL
+19	NULL	NULL
+20	NULL	NULL
+21	NULL	NULL
+22	NULL	NULL
+23	NULL	NULL
+24	NULL	NULL
+25	NULL	NULL
+26	NULL	NULL
+27	NULL	NULL
+28	NULL	NULL
+29	NULL	NULL
+30	NULL	NULL
+31	NULL	NULL
+32	NULL	NULL
+33	NULL	NULL
+34	NULL	NULL
+35	NULL	NULL
+36	NULL	NULL
+37	NULL	NULL
+38	NULL	NULL
+39	NULL	NULL
+40	NULL	NULL
+41	NULL	NULL
+42	NULL	NULL
+43	NULL	NULL
+44	NULL	NULL
+45	NULL	NULL
+46	NULL	NULL
+47	NULL	NULL
+48	NULL	NULL
+49	NULL	NULL
 PREHOOK: query: -- test empty array handling
 SELECT CAST(key AS INT) DIV 10,
        percentile(IF(CAST(key AS INT) DIV 10 < 5, 1, NULL), 0.5),
@@ -379,51 +379,51 @@ POSTHOOK: Input: default@src
 2	1.0	[1.0,1.0,1.0,1.0]
 3	1.0	[1.0,1.0,1.0,1.0]
 4	1.0	[1.0,1.0,1.0,1.0]
-5	NULL	null
-6	NULL	null
-7	NULL	null
-8	NULL	null
-9	NULL	null
-10	NULL	null
-11	NULL	null
-12	NULL	null
-13	NULL	null
-14	NULL	null
-15	NULL	null
-16	NULL	null
-17	NULL	null
-18	NULL	null
-19	NULL	null
-20	NULL	null
-21	NULL	null
-22	NULL	null
-23	NULL	null
-24	NULL	null
-25	NULL	null
-26	NULL	null
-27	NULL	null
-28	NULL	null
-29	NULL	null
-30	NULL	null
-31	NULL	null
-32	NULL	null
-33	NULL	null
-34	NULL	null
-35	NULL	null
-36	NULL	null
-37	NULL	null
-38	NULL	null
-39	NULL	null
-40	NULL	null
-41	NULL	null
-42	NULL	null
-43	NULL	null
-44	NULL	null
-45	NULL	null
-46	NULL	null
-47	NULL	null
-48	NULL	null
-49	NULL	null
+5	NULL	NULL
+6	NULL	NULL
+7	NULL	NULL
+8	NULL	NULL
+9	NULL	NULL
+10	NULL	NULL
+11	NULL	NULL
+12	NULL	NULL
+13	NULL	NULL
+14	NULL	NULL
+15	NULL	NULL
+16	NULL	NULL
+17	NULL	NULL
+18	NULL	NULL
+19	NULL	NULL
+20	NULL	NULL
+21	NULL	NULL
+22	NULL	NULL
+23	NULL	NULL
+24	NULL	NULL
+25	NULL	NULL
+26	NULL	NULL
+27	NULL	NULL
+28	NULL	NULL
+29	NULL	NULL
+30	NULL	NULL
+31	NULL	NULL
+32	NULL	NULL
+33	NULL	NULL
+34	NULL	NULL
+35	NULL	NULL
+36	NULL	NULL
+37	NULL	NULL
+38	NULL	NULL
+39	NULL	NULL
+40	NULL	NULL
+41	NULL	NULL
+42	NULL	NULL
+43	NULL	NULL
+44	NULL	NULL
+45	NULL	NULL
+46	NULL	NULL
+47	NULL	NULL
+48	NULL	NULL
+49	NULL	NULL
 PREHOOK: query: select percentile(cast(key as bigint), 0.5) from src where false
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
@@ -443,4 +443,4 @@ select percentile(cast(key as bigint), a
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-null
+NULL

Modified: hive/trunk/ql/src/test/results/clientpositive/udf_substr.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/udf_substr.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/udf_substr.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/udf_substr.q.out Sat Apr  6 15:25:37 2013
@@ -181,7 +181,7 @@ FROM (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
-NULL	NULL	null	null	null	A	AB	ABC	ABC	A	AB	ABC	ABC	B	BC	BC	BC	C	C	C	C		C	C	C	C	B	BC	BC	BC
A	AB	ABC	ABC	
+NULL	NULL	NULL	NULL	NULL	A	AB	ABC	ABC	A	AB	ABC	ABC	B	BC	BC	BC	C	C	C	C		C	C	C	C	B	BC	BC	BC
A	AB	ABC	ABC	
 PREHOOK: query: -- test UTF-8 substr
 SELECT
   substr("玩", 1),

Modified: hive/trunk/ql/src/test/results/clientpositive/udtf_stack.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/udtf_stack.q.out?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/udtf_stack.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/udtf_stack.q.out Sat Apr  6 15:25:37 2013
@@ -156,7 +156,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####
 x	[1]
-z	null
+z	NULL
 PREHOOK: query: SELECT x, y FROM src LATERAL VIEW STACK(2, 'x', array(1), 'z', array(4))
a AS x, y LIMIT 2
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java Sat Apr
 6 15:25:37 2013
@@ -55,8 +55,9 @@ public class DelimitedJSONSerDe extends 
   protected void serializeField(ByteStream.Output out, Object obj, ObjectInspector objInspector,
       SerDeParameters serdeParams) throws SerDeException {
     if (!objInspector.getCategory().equals(Category.PRIMITIVE) || (objInspector.getTypeName().equalsIgnoreCase(serdeConstants.BINARY_TYPE_NAME)))
{
+      //do this for all complex types and binary
       try {
-        serialize(out, SerDeUtils.getJSONString(obj, objInspector),
+        serialize(out, SerDeUtils.getJSONString(obj, objInspector, serdeParams.getNullSequence().toString()),
             PrimitiveObjectInspectorFactory.javaStringObjectInspector, serdeParams.getSeparators(),
             1, serdeParams.getNullSequence(), serdeParams.isEscaped(), serdeParams.getEscapeChar(),
             serdeParams.getNeedsEscape());
@@ -66,6 +67,7 @@ public class DelimitedJSONSerDe extends 
       }
 
     } else {
+      //primitives except binary
       super.serializeField(out, obj, objInspector, serdeParams);
     }
   }

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java?rev=1465261&r1=1465260&r2=1465261&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java Sat Apr  6 15:25:37
2013
@@ -62,6 +62,9 @@ public final class SerDeUtils {
   public static final String LBRACE = "{";
   public static final String RBRACE = "}";
 
+  // lower case null is used within json objects
+  private static final String JSON_NULL = "null";
+
   private static ConcurrentHashMap<String, Class<?>> serdes =
     new ConcurrentHashMap<String, Class<?>>();
 
@@ -216,18 +219,32 @@ public final class SerDeUtils {
   }
 
   public static String getJSONString(Object o, ObjectInspector oi) {
+    return getJSONString(o, oi, JSON_NULL);
+  }
+
+  /**
+   * Use this if you need to have custom representation of top level null .
+   * (ie something other than 'null')
+   * eg, for hive output, we want to to print NULL for a null map object.
+   * @param o Object
+   * @param oi ObjectInspector
+   * @param nullStr The custom string used to represent null value
+   * @return
+   */
+  public static String getJSONString(Object o, ObjectInspector oi, String nullStr) {
     StringBuilder sb = new StringBuilder();
-    buildJSONString(sb, o, oi);
+    buildJSONString(sb, o, oi, nullStr);
     return sb.toString();
   }
 
-  static void buildJSONString(StringBuilder sb, Object o, ObjectInspector oi) {
+
+  static void buildJSONString(StringBuilder sb, Object o, ObjectInspector oi, String nullStr)
{
 
     switch (oi.getCategory()) {
     case PRIMITIVE: {
       PrimitiveObjectInspector poi = (PrimitiveObjectInspector) oi;
       if (o == null) {
-        sb.append("null");
+        sb.append(nullStr);
       } else {
         switch (poi.getPrimitiveCategory()) {
         case BOOLEAN: {
@@ -297,14 +314,14 @@ public final class SerDeUtils {
           .getListElementObjectInspector();
       List<?> olist = loi.getList(o);
       if (olist == null) {
-        sb.append("null");
+        sb.append(nullStr);
       } else {
         sb.append(LBRACKET);
         for (int i = 0; i < olist.size(); i++) {
           if (i > 0) {
             sb.append(COMMA);
           }
-          buildJSONString(sb, olist.get(i), listElementObjectInspector);
+          buildJSONString(sb, olist.get(i), listElementObjectInspector, JSON_NULL);
         }
         sb.append(RBRACKET);
       }
@@ -317,7 +334,7 @@ public final class SerDeUtils {
           .getMapValueObjectInspector();
       Map<?, ?> omap = moi.getMap(o);
       if (omap == null) {
-        sb.append("null");
+        sb.append(nullStr);
       } else {
         sb.append(LBRACE);
         boolean first = true;
@@ -328,9 +345,9 @@ public final class SerDeUtils {
             sb.append(COMMA);
           }
           Map.Entry<?, ?> e = (Map.Entry<?, ?>) entry;
-          buildJSONString(sb, e.getKey(), mapKeyObjectInspector);
+          buildJSONString(sb, e.getKey(), mapKeyObjectInspector, JSON_NULL);
           sb.append(COLON);
-          buildJSONString(sb, e.getValue(), mapValueObjectInspector);
+          buildJSONString(sb, e.getValue(), mapValueObjectInspector, JSON_NULL);
         }
         sb.append(RBRACE);
       }
@@ -340,7 +357,7 @@ public final class SerDeUtils {
       StructObjectInspector soi = (StructObjectInspector) oi;
       List<? extends StructField> structFields = soi.getAllStructFieldRefs();
       if (o == null) {
-        sb.append("null");
+        sb.append(nullStr);
       } else {
         sb.append(LBRACE);
         for (int i = 0; i < structFields.size(); i++) {
@@ -352,7 +369,7 @@ public final class SerDeUtils {
           sb.append(QUOTE);
           sb.append(COLON);
           buildJSONString(sb, soi.getStructFieldData(o, structFields.get(i)),
-              structFields.get(i).getFieldObjectInspector());
+              structFields.get(i).getFieldObjectInspector(), JSON_NULL);
         }
         sb.append(RBRACE);
       }
@@ -361,13 +378,13 @@ public final class SerDeUtils {
     case UNION: {
       UnionObjectInspector uoi = (UnionObjectInspector) oi;
       if (o == null) {
-        sb.append("null");
+        sb.append(nullStr);
       } else {
         sb.append(LBRACE);
         sb.append(uoi.getTag(o));
         sb.append(COLON);
         buildJSONString(sb, uoi.getField(o),
-              uoi.getObjectInspectors().get(uoi.getTag(o)));
+              uoi.getObjectInspectors().get(uoi.getTag(o)), JSON_NULL);
         sb.append(RBRACE);
       }
       break;



Mime
View raw message