diff --git ql/src/test/results/clientpositive/case_sensitivity.q.out ql/src/test/results/clientpositive/case_sensitivity.q.out index 5af42ad..77ad8d2 100644 --- ql/src/test/results/clientpositive/case_sensitivity.q.out +++ ql/src/test/results/clientpositive/case_sensitivity.q.out @@ -96,7 +96,7 @@ POSTHOOK: type: QUERY POSTHOOK: Input: default@src_thrift POSTHOOK: Output: default@dest1 POSTHOOK: Lineage: dest1.key EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] PREHOOK: query: SELECT DEST1.* FROM Dest1 PREHOOK: type: QUERY PREHOOK: Input: default@dest1 @@ -106,7 +106,7 @@ POSTHOOK: type: QUERY POSTHOOK: Input: default@dest1 #### A masked pattern was here #### POSTHOOK: Lineage: dest1.key EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] 2 1 4 8 6 27 diff --git ql/src/test/results/clientpositive/input17.q.out ql/src/test/results/clientpositive/input17.q.out index 193bdfd..4d9d63f 100644 --- ql/src/test/results/clientpositive/input17.q.out +++ ql/src/test/results/clientpositive/input17.q.out @@ -121,8 +121,8 @@ INSERT OVERWRITE TABLE dest1 SELECT tmap.tkey, tmap.tvalue POSTHOOK: type: QUERY POSTHOOK: Input: default@src_thrift POSTHOOK: Output: default@dest1 -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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, 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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, 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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] PREHOOK: query: SELECT dest1.* FROM dest1 PREHOOK: type: QUERY PREHOOK: Input: default@dest1 @@ -131,8 +131,8 @@ POSTHOOK: query: SELECT dest1.* FROM dest1 POSTHOOK: type: QUERY 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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, 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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, 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, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] NULL null -1461153966 {"myint":49,"mystring":"343","underscore_int":7} -1952710705 {"myint":25,"mystring":"125","underscore_int":5} diff --git ql/src/test/results/clientpositive/input5.q.out ql/src/test/results/clientpositive/input5.q.out index 3be0c3a..fad35f4 100644 --- ql/src/test/results/clientpositive/input5.q.out +++ ql/src/test/results/clientpositive/input5.q.out @@ -114,8 +114,8 @@ INSERT OVERWRITE TABLE dest1 SELECT tmap.tkey, tmap.tvalue POSTHOOK: type: QUERY POSTHOOK: Input: default@src_thrift POSTHOOK: Output: default@dest1 -POSTHOOK: Lineage: dest1.key SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.value SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.key SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.value SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] PREHOOK: query: SELECT dest1.* FROM dest1 PREHOOK: type: QUERY PREHOOK: Input: default@dest1 @@ -124,8 +124,8 @@ POSTHOOK: query: SELECT dest1.* FROM dest1 POSTHOOK: type: QUERY POSTHOOK: Input: default@dest1 #### A masked pattern was here #### -POSTHOOK: Lineage: dest1.key SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.value SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.key SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.value SCRIPT [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), (src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] [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}] diff --git ql/src/test/results/clientpositive/input_testxpath.q.out ql/src/test/results/clientpositive/input_testxpath.q.out index 1a59164..62b6fad 100644 --- ql/src/test/results/clientpositive/input_testxpath.q.out +++ ql/src/test/results/clientpositive/input_testxpath.q.out @@ -95,7 +95,7 @@ POSTHOOK: Input: default@src_thrift POSTHOOK: Output: default@dest1 POSTHOOK: Lineage: dest1.key EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), ] POSTHOOK: Lineage: dest1.mapvalue EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:mstringstring, type:map, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] PREHOOK: query: SELECT dest1.* FROM dest1 PREHOOK: type: QUERY PREHOOK: Input: default@dest1 @@ -106,7 +106,7 @@ POSTHOOK: Input: default@dest1 #### A masked pattern was here #### POSTHOOK: Lineage: dest1.key EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), ] POSTHOOK: Lineage: dest1.mapvalue EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:mstringstring, type:map, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.value EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] 0 0 NULL 2 1 NULL 4 8 value_2 diff --git ql/src/test/results/clientpositive/input_testxpath2.q.out ql/src/test/results/clientpositive/input_testxpath2.q.out index eaeb588..c23e748 100644 --- ql/src/test/results/clientpositive/input_testxpath2.q.out +++ ql/src/test/results/clientpositive/input_testxpath2.q.out @@ -98,7 +98,7 @@ POSTHOOK: type: QUERY POSTHOOK: Input: default@src_thrift POSTHOOK: Output: default@dest1 POSTHOOK: Lineage: dest1.lint_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.lintstring_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.lintstring_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] POSTHOOK: Lineage: dest1.mstringstring_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:mstringstring, type:map, comment:from deserializer), ] PREHOOK: query: SELECT dest1.* FROM dest1 PREHOOK: type: QUERY @@ -109,7 +109,7 @@ POSTHOOK: type: QUERY POSTHOOK: Input: default@dest1 #### A masked pattern was here #### POSTHOOK: Lineage: dest1.lint_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lint, type:array, comment:from deserializer), ] -POSTHOOK: Lineage: dest1.lintstring_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array, comment:from deserializer), ] +POSTHOOK: Lineage: dest1.lintstring_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:lintstring, type:array>, comment:from deserializer), ] POSTHOOK: Lineage: dest1.mstringstring_size EXPRESSION [(src_thrift)src_thrift.FieldSchema(name:mstringstring, type:map, comment:from deserializer), ] 3 1 1 3 1 1 diff --git ql/src/test/results/clientpositive/inputddl8.q.out ql/src/test/results/clientpositive/inputddl8.q.out index 491d5f4..cff41f5 100644 --- ql/src/test/results/clientpositive/inputddl8.q.out +++ ql/src/test/results/clientpositive/inputddl8.q.out @@ -23,7 +23,7 @@ aint int from deserializer astring string from deserializer lint array from deserializer lstring array from deserializer -lintstring array from deserializer +lintstring array> from deserializer mstringstring map from deserializer ds string country string diff --git ql/src/test/results/clientpositive/join_thrift.q.out ql/src/test/results/clientpositive/join_thrift.q.out index cad60ff..da05fc4 100644 --- ql/src/test/results/clientpositive/join_thrift.q.out +++ ql/src/test/results/clientpositive/join_thrift.q.out @@ -6,7 +6,7 @@ aint int from deserializer astring string from deserializer lint array from deserializer lstring array from deserializer -lintstring array from deserializer +lintstring array> from deserializer mstringstring map from deserializer PREHOOK: query: EXPLAIN SELECT s1.aint, s2.lintstring diff --git serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java index ff63163..4689dc4 100644 --- serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java +++ serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ReflectionStructObjectInspector.java @@ -76,7 +76,19 @@ public class ReflectionStructObjectInspector extends } public String getTypeName() { - return objectClass.getName(); + StringBuilder sb = new StringBuilder("struct<"); + boolean first = true; + for (StructField structField : getAllStructFieldRefs()) { + if (first) { + first = false; + } else { + sb.append(","); + } + sb.append(structField.getFieldName()).append(":") + .append(structField.getFieldObjectInspector().getTypeName()); + } + sb.append(">"); + return sb.toString(); } /**