Index: serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java =================================================================== --- serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java (revision 1297854) +++ serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java (working copy) @@ -31,7 +31,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hive.serde.Constants; import org.apache.hadoop.hive.serde2.io.TimestampWritable; -import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions; import org.apache.hadoop.hive.serde2.objectinspector.primitive.AbstractPrimitiveWritableObjectInspector; @@ -498,11 +497,26 @@ } return r; } - case STRUCT: + case STRUCT:{ + StructObjectInspector structOI = (StructObjectInspector)objIns; + List fields = structOI.getAllStructFieldRefs(); + int r = 0; + for (StructField field : fields){ + r = 31 * r + hashCode(structOI.getStructFieldData(o, field), + field.getFieldObjectInspector()); + } + return r; + } + case UNION: + UnionObjectInspector uOI = (UnionObjectInspector)objIns; + byte tag = uOI.getTag(o); + return hashCode(uOI.getField(o), + uOI.getObjectInspectors().get(tag)); + default: throw new RuntimeException( - "Hash code on complex types not supported yet."); + "Unknown type: "+ objIns.getTypeName()); } } Index: ql/src/test/results/clientpositive/groupby_complex_types.q.out =================================================================== --- ql/src/test/results/clientpositive/groupby_complex_types.q.out (revision 1297854) +++ ql/src/test/results/clientpositive/groupby_complex_types.q.out (working copy) @@ -8,29 +8,39 @@ POSTHOOK: query: CREATE TABLE DEST2(key MAP, value BIGINT) STORED AS TEXTFILE POSTHOOK: type: CREATETABLE POSTHOOK: Output: default@DEST2 +PREHOOK: query: CREATE TABLE DEST3(key STRUCT, value BIGINT) STORED AS TEXTFILE +PREHOOK: type: CREATETABLE +POSTHOOK: query: CREATE TABLE DEST3(key STRUCT, value BIGINT) STORED AS TEXTFILE +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: default@DEST3 PREHOOK: query: EXPLAIN FROM SRC INSERT OVERWRITE TABLE DEST1 SELECT ARRAY(SRC.key), COUNT(1) GROUP BY ARRAY(SRC.key) INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value) +INSERT OVERWRITE TABLE DEST3 SELECT STRUCT(SRC.key, SRC.value), COUNT(1) GROUP BY STRUCT(SRC.key, SRC.value) PREHOOK: type: QUERY POSTHOOK: query: EXPLAIN FROM SRC INSERT OVERWRITE TABLE DEST1 SELECT ARRAY(SRC.key), COUNT(1) GROUP BY ARRAY(SRC.key) INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value) +INSERT OVERWRITE TABLE DEST3 SELECT STRUCT(SRC.key, SRC.value), COUNT(1) GROUP BY STRUCT(SRC.key, SRC.value) POSTHOOK: type: QUERY ABSTRACT SYNTAX TREE: - (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME SRC))) (TOK_INSERT (TOK_DESTINATION (TOK_TAB (TOK_TABNAME DEST1))) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION ARRAY (. (TOK_TABLE_OR_COL SRC) key))) (TOK_SELEXPR (TOK_FUNCTION COUNT 1))) (TOK_GROUPBY (TOK_FUNCTION ARRAY (. (TOK_TABLE_OR_COL SRC) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_TAB (TOK_TABNAME DEST2))) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION MAP (. (TOK_TABLE_OR_COL SRC) key) (. (TOK_TABLE_OR_COL SRC) value))) (TOK_SELEXPR (TOK_FUNCTION COUNT 1))) (TOK_GROUPBY (TOK_FUNCTION MAP (. (TOK_TABLE_OR_COL SRC) key) (. (TOK_TABLE_OR_COL SRC) value))))) + (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME SRC))) (TOK_INSERT (TOK_DESTINATION (TOK_TAB (TOK_TABNAME DEST1))) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION ARRAY (. (TOK_TABLE_OR_COL SRC) key))) (TOK_SELEXPR (TOK_FUNCTION COUNT 1))) (TOK_GROUPBY (TOK_FUNCTION ARRAY (. (TOK_TABLE_OR_COL SRC) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_TAB (TOK_TABNAME DEST2))) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION MAP (. (TOK_TABLE_OR_COL SRC) key) (. (TOK_TABLE_OR_COL SRC) value))) (TOK_SELEXPR (TOK_FUNCTION COUNT 1))) (TOK_GROUPBY (TOK_FUNCTION MAP (. (TOK_TABLE_OR_COL SRC) key) (. (TOK_TABLE_OR_COL SRC) value)))) (TOK_INSERT (TOK_DESTINATION (TOK_TAB (TOK_TABNAME DEST3))) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION STRUCT (. (TOK_TABLE_OR_COL SRC) key) (. (TOK_TABLE_OR_COL SRC) value))) (TOK_SELEXPR (TOK_FUNCTION COUNT 1))) (TOK_GROUPBY (TOK_FUNCTION STRUCT (. (TOK_TABLE_OR_COL SRC) key) (. (TOK_TABLE_OR_COL SRC) value))))) STAGE DEPENDENCIES: - Stage-2 is a root stage - Stage-0 depends on stages: Stage-2 - Stage-3 depends on stages: Stage-0 - Stage-4 depends on stages: Stage-2 - Stage-1 depends on stages: Stage-4 - Stage-5 depends on stages: Stage-1 + Stage-3 is a root stage + Stage-0 depends on stages: Stage-3 + Stage-4 depends on stages: Stage-0 + Stage-5 depends on stages: Stage-3 + Stage-1 depends on stages: Stage-5 + Stage-6 depends on stages: Stage-1 + Stage-7 depends on stages: Stage-3 + Stage-2 depends on stages: Stage-7 + Stage-8 depends on stages: Stage-2 STAGE PLANS: - Stage: Stage-2 + Stage: Stage-3 Map Reduce Alias -> Map Operator Tree: src @@ -84,6 +94,28 @@ table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + Select Operator + expressions: + expr: key + type: string + expr: value + type: string + outputColumnNames: key, value + Group By Operator + aggregations: + expr: count(1) + bucketGroup: false + keys: + expr: struct(key,value) + type: struct + mode: hash + outputColumnNames: _col0, _col1 + File Output Operator + compressed: false + GlobalTableId: 0 + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat Reduce Operator Tree: Group By Operator aggregations: @@ -120,10 +152,10 @@ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe name: default.dest1 - Stage: Stage-3 + Stage: Stage-4 Stats-Aggr Operator - Stage: Stage-4 + Stage: Stage-5 Map Reduce Alias -> Map Operator Tree: #### A masked pattern was here #### @@ -175,28 +207,89 @@ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe name: default.dest2 - Stage: Stage-5 + Stage: Stage-6 Stats-Aggr Operator + Stage: Stage-7 + Map Reduce + Alias -> Map Operator Tree: +#### A masked pattern was here #### + Reduce Output Operator + key expressions: + expr: _col0 + type: struct + sort order: + + Map-reduce partition columns: + expr: _col0 + type: struct + tag: -1 + value expressions: + expr: _col1 + type: bigint + Reduce Operator Tree: + Group By Operator + aggregations: + expr: count(VALUE._col0) + bucketGroup: false + keys: + expr: KEY._col0 + type: struct + mode: mergepartial + outputColumnNames: _col0, _col1 + Select Operator + expressions: + expr: _col0 + type: struct + expr: _col1 + type: bigint + outputColumnNames: _col0, _col1 + File Output Operator + compressed: false + GlobalTableId: 3 + table: + input format: org.apache.hadoop.mapred.TextInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + name: default.dest3 + Stage: Stage-2 + Move Operator + tables: + replace: true + table: + input format: org.apache.hadoop.mapred.TextInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + name: default.dest3 + + Stage: Stage-8 + Stats-Aggr Operator + + PREHOOK: query: FROM SRC INSERT OVERWRITE TABLE DEST1 SELECT ARRAY(SRC.key), COUNT(1) GROUP BY ARRAY(SRC.key) INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value) +INSERT OVERWRITE TABLE DEST3 SELECT STRUCT(SRC.key, SRC.value), COUNT(1) GROUP BY STRUCT(SRC.key, SRC.value) PREHOOK: type: QUERY PREHOOK: Input: default@src PREHOOK: Output: default@dest1 PREHOOK: Output: default@dest2 +PREHOOK: Output: default@dest3 POSTHOOK: query: FROM SRC INSERT OVERWRITE TABLE DEST1 SELECT ARRAY(SRC.key), COUNT(1) GROUP BY ARRAY(SRC.key) INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value) +INSERT OVERWRITE TABLE DEST3 SELECT STRUCT(SRC.key, SRC.value), COUNT(1) GROUP BY STRUCT(SRC.key, SRC.value) POSTHOOK: type: QUERY POSTHOOK: Input: default@src POSTHOOK: Output: default@dest1 POSTHOOK: Output: default@dest2 +POSTHOOK: Output: default@dest3 POSTHOOK: Lineage: dest1.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ] POSTHOOK: Lineage: dest1.value EXPRESSION [(src)src.null, ] POSTHOOK: Lineage: dest2.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] POSTHOOK: Lineage: dest2.value EXPRESSION [(src)src.null, ] +POSTHOOK: Lineage: dest3.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] +POSTHOOK: Lineage: dest3.value EXPRESSION [(src)src.null, ] PREHOOK: query: SELECT DEST1.* FROM DEST1 PREHOOK: type: QUERY PREHOOK: Input: default@dest1 @@ -209,6 +302,8 @@ POSTHOOK: Lineage: dest1.value EXPRESSION [(src)src.null, ] POSTHOOK: Lineage: dest2.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] POSTHOOK: Lineage: dest2.value EXPRESSION [(src)src.null, ] +POSTHOOK: Lineage: dest3.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] +POSTHOOK: Lineage: dest3.value EXPRESSION [(src)src.null, ] ["0"] 3 ["10"] 1 ["100"] 2 @@ -530,6 +625,8 @@ POSTHOOK: Lineage: dest1.value EXPRESSION [(src)src.null, ] POSTHOOK: Lineage: dest2.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] POSTHOOK: Lineage: dest2.value EXPRESSION [(src)src.null, ] +POSTHOOK: Lineage: dest3.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] +POSTHOOK: Lineage: dest3.value EXPRESSION [(src)src.null, ] {"0":"val_0"} 3 {"10":"val_10"} 1 {"100":"val_100"} 2 @@ -839,3 +936,326 @@ {"96":"val_96"} 1 {"97":"val_97"} 2 {"98":"val_98"} 2 +PREHOOK: query: SELECT DEST3.* FROM DEST3 +PREHOOK: type: QUERY +PREHOOK: Input: default@dest3 +#### A masked pattern was here #### +POSTHOOK: query: SELECT DEST3.* FROM DEST3 +POSTHOOK: type: QUERY +POSTHOOK: Input: default@dest3 +#### A masked pattern was here #### +POSTHOOK: Lineage: dest1.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ] +POSTHOOK: Lineage: dest1.value EXPRESSION [(src)src.null, ] +POSTHOOK: Lineage: dest2.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] +POSTHOOK: Lineage: dest2.value EXPRESSION [(src)src.null, ] +POSTHOOK: Lineage: dest3.key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), (src)src.FieldSchema(name:value, type:string, comment:default), ] +POSTHOOK: Lineage: dest3.value EXPRESSION [(src)src.null, ] +{"col1":"0","col2":"val_0"} 3 +{"col1":"10","col2":"val_10"} 1 +{"col1":"100","col2":"val_100"} 2 +{"col1":"103","col2":"val_103"} 2 +{"col1":"104","col2":"val_104"} 2 +{"col1":"105","col2":"val_105"} 1 +{"col1":"11","col2":"val_11"} 1 +{"col1":"111","col2":"val_111"} 1 +{"col1":"113","col2":"val_113"} 2 +{"col1":"114","col2":"val_114"} 1 +{"col1":"116","col2":"val_116"} 1 +{"col1":"118","col2":"val_118"} 2 +{"col1":"119","col2":"val_119"} 3 +{"col1":"12","col2":"val_12"} 2 +{"col1":"120","col2":"val_120"} 2 +{"col1":"125","col2":"val_125"} 2 +{"col1":"126","col2":"val_126"} 1 +{"col1":"128","col2":"val_128"} 3 +{"col1":"129","col2":"val_129"} 2 +{"col1":"131","col2":"val_131"} 1 +{"col1":"133","col2":"val_133"} 1 +{"col1":"134","col2":"val_134"} 2 +{"col1":"136","col2":"val_136"} 1 +{"col1":"137","col2":"val_137"} 2 +{"col1":"138","col2":"val_138"} 4 +{"col1":"143","col2":"val_143"} 1 +{"col1":"145","col2":"val_145"} 1 +{"col1":"146","col2":"val_146"} 2 +{"col1":"149","col2":"val_149"} 2 +{"col1":"15","col2":"val_15"} 2 +{"col1":"150","col2":"val_150"} 1 +{"col1":"152","col2":"val_152"} 2 +{"col1":"153","col2":"val_153"} 1 +{"col1":"155","col2":"val_155"} 1 +{"col1":"156","col2":"val_156"} 1 +{"col1":"157","col2":"val_157"} 1 +{"col1":"158","col2":"val_158"} 1 +{"col1":"160","col2":"val_160"} 1 +{"col1":"162","col2":"val_162"} 1 +{"col1":"163","col2":"val_163"} 1 +{"col1":"164","col2":"val_164"} 2 +{"col1":"165","col2":"val_165"} 2 +{"col1":"166","col2":"val_166"} 1 +{"col1":"167","col2":"val_167"} 3 +{"col1":"168","col2":"val_168"} 1 +{"col1":"169","col2":"val_169"} 4 +{"col1":"17","col2":"val_17"} 1 +{"col1":"170","col2":"val_170"} 1 +{"col1":"172","col2":"val_172"} 2 +{"col1":"174","col2":"val_174"} 2 +{"col1":"175","col2":"val_175"} 2 +{"col1":"176","col2":"val_176"} 2 +{"col1":"177","col2":"val_177"} 1 +{"col1":"178","col2":"val_178"} 1 +{"col1":"179","col2":"val_179"} 2 +{"col1":"18","col2":"val_18"} 2 +{"col1":"180","col2":"val_180"} 1 +{"col1":"181","col2":"val_181"} 1 +{"col1":"183","col2":"val_183"} 1 +{"col1":"186","col2":"val_186"} 1 +{"col1":"187","col2":"val_187"} 3 +{"col1":"189","col2":"val_189"} 1 +{"col1":"19","col2":"val_19"} 1 +{"col1":"190","col2":"val_190"} 1 +{"col1":"191","col2":"val_191"} 2 +{"col1":"192","col2":"val_192"} 1 +{"col1":"193","col2":"val_193"} 3 +{"col1":"194","col2":"val_194"} 1 +{"col1":"195","col2":"val_195"} 2 +{"col1":"196","col2":"val_196"} 1 +{"col1":"197","col2":"val_197"} 2 +{"col1":"199","col2":"val_199"} 3 +{"col1":"2","col2":"val_2"} 1 +{"col1":"20","col2":"val_20"} 1 +{"col1":"200","col2":"val_200"} 2 +{"col1":"201","col2":"val_201"} 1 +{"col1":"202","col2":"val_202"} 1 +{"col1":"203","col2":"val_203"} 2 +{"col1":"205","col2":"val_205"} 2 +{"col1":"207","col2":"val_207"} 2 +{"col1":"208","col2":"val_208"} 3 +{"col1":"209","col2":"val_209"} 2 +{"col1":"213","col2":"val_213"} 2 +{"col1":"214","col2":"val_214"} 1 +{"col1":"216","col2":"val_216"} 2 +{"col1":"217","col2":"val_217"} 2 +{"col1":"218","col2":"val_218"} 1 +{"col1":"219","col2":"val_219"} 2 +{"col1":"221","col2":"val_221"} 2 +{"col1":"222","col2":"val_222"} 1 +{"col1":"223","col2":"val_223"} 2 +{"col1":"224","col2":"val_224"} 2 +{"col1":"226","col2":"val_226"} 1 +{"col1":"228","col2":"val_228"} 1 +{"col1":"229","col2":"val_229"} 2 +{"col1":"230","col2":"val_230"} 5 +{"col1":"233","col2":"val_233"} 2 +{"col1":"235","col2":"val_235"} 1 +{"col1":"237","col2":"val_237"} 2 +{"col1":"238","col2":"val_238"} 2 +{"col1":"239","col2":"val_239"} 2 +{"col1":"24","col2":"val_24"} 2 +{"col1":"241","col2":"val_241"} 1 +{"col1":"242","col2":"val_242"} 2 +{"col1":"244","col2":"val_244"} 1 +{"col1":"247","col2":"val_247"} 1 +{"col1":"248","col2":"val_248"} 1 +{"col1":"249","col2":"val_249"} 1 +{"col1":"252","col2":"val_252"} 1 +{"col1":"255","col2":"val_255"} 2 +{"col1":"256","col2":"val_256"} 2 +{"col1":"257","col2":"val_257"} 1 +{"col1":"258","col2":"val_258"} 1 +{"col1":"26","col2":"val_26"} 2 +{"col1":"260","col2":"val_260"} 1 +{"col1":"262","col2":"val_262"} 1 +{"col1":"263","col2":"val_263"} 1 +{"col1":"265","col2":"val_265"} 2 +{"col1":"266","col2":"val_266"} 1 +{"col1":"27","col2":"val_27"} 1 +{"col1":"272","col2":"val_272"} 2 +{"col1":"273","col2":"val_273"} 3 +{"col1":"274","col2":"val_274"} 1 +{"col1":"275","col2":"val_275"} 1 +{"col1":"277","col2":"val_277"} 4 +{"col1":"278","col2":"val_278"} 2 +{"col1":"28","col2":"val_28"} 1 +{"col1":"280","col2":"val_280"} 2 +{"col1":"281","col2":"val_281"} 2 +{"col1":"282","col2":"val_282"} 2 +{"col1":"283","col2":"val_283"} 1 +{"col1":"284","col2":"val_284"} 1 +{"col1":"285","col2":"val_285"} 1 +{"col1":"286","col2":"val_286"} 1 +{"col1":"287","col2":"val_287"} 1 +{"col1":"288","col2":"val_288"} 2 +{"col1":"289","col2":"val_289"} 1 +{"col1":"291","col2":"val_291"} 1 +{"col1":"292","col2":"val_292"} 1 +{"col1":"296","col2":"val_296"} 1 +{"col1":"298","col2":"val_298"} 3 +{"col1":"30","col2":"val_30"} 1 +{"col1":"302","col2":"val_302"} 1 +{"col1":"305","col2":"val_305"} 1 +{"col1":"306","col2":"val_306"} 1 +{"col1":"307","col2":"val_307"} 2 +{"col1":"308","col2":"val_308"} 1 +{"col1":"309","col2":"val_309"} 2 +{"col1":"310","col2":"val_310"} 1 +{"col1":"311","col2":"val_311"} 3 +{"col1":"315","col2":"val_315"} 1 +{"col1":"316","col2":"val_316"} 3 +{"col1":"317","col2":"val_317"} 2 +{"col1":"318","col2":"val_318"} 3 +{"col1":"321","col2":"val_321"} 2 +{"col1":"322","col2":"val_322"} 2 +{"col1":"323","col2":"val_323"} 1 +{"col1":"325","col2":"val_325"} 2 +{"col1":"327","col2":"val_327"} 3 +{"col1":"33","col2":"val_33"} 1 +{"col1":"331","col2":"val_331"} 2 +{"col1":"332","col2":"val_332"} 1 +{"col1":"333","col2":"val_333"} 2 +{"col1":"335","col2":"val_335"} 1 +{"col1":"336","col2":"val_336"} 1 +{"col1":"338","col2":"val_338"} 1 +{"col1":"339","col2":"val_339"} 1 +{"col1":"34","col2":"val_34"} 1 +{"col1":"341","col2":"val_341"} 1 +{"col1":"342","col2":"val_342"} 2 +{"col1":"344","col2":"val_344"} 2 +{"col1":"345","col2":"val_345"} 1 +{"col1":"348","col2":"val_348"} 5 +{"col1":"35","col2":"val_35"} 3 +{"col1":"351","col2":"val_351"} 1 +{"col1":"353","col2":"val_353"} 2 +{"col1":"356","col2":"val_356"} 1 +{"col1":"360","col2":"val_360"} 1 +{"col1":"362","col2":"val_362"} 1 +{"col1":"364","col2":"val_364"} 1 +{"col1":"365","col2":"val_365"} 1 +{"col1":"366","col2":"val_366"} 1 +{"col1":"367","col2":"val_367"} 2 +{"col1":"368","col2":"val_368"} 1 +{"col1":"369","col2":"val_369"} 3 +{"col1":"37","col2":"val_37"} 2 +{"col1":"373","col2":"val_373"} 1 +{"col1":"374","col2":"val_374"} 1 +{"col1":"375","col2":"val_375"} 1 +{"col1":"377","col2":"val_377"} 1 +{"col1":"378","col2":"val_378"} 1 +{"col1":"379","col2":"val_379"} 1 +{"col1":"382","col2":"val_382"} 2 +{"col1":"384","col2":"val_384"} 3 +{"col1":"386","col2":"val_386"} 1 +{"col1":"389","col2":"val_389"} 1 +{"col1":"392","col2":"val_392"} 1 +{"col1":"393","col2":"val_393"} 1 +{"col1":"394","col2":"val_394"} 1 +{"col1":"395","col2":"val_395"} 2 +{"col1":"396","col2":"val_396"} 3 +{"col1":"397","col2":"val_397"} 2 +{"col1":"399","col2":"val_399"} 2 +{"col1":"4","col2":"val_4"} 1 +{"col1":"400","col2":"val_400"} 1 +{"col1":"401","col2":"val_401"} 5 +{"col1":"402","col2":"val_402"} 1 +{"col1":"403","col2":"val_403"} 3 +{"col1":"404","col2":"val_404"} 2 +{"col1":"406","col2":"val_406"} 4 +{"col1":"407","col2":"val_407"} 1 +{"col1":"409","col2":"val_409"} 3 +{"col1":"41","col2":"val_41"} 1 +{"col1":"411","col2":"val_411"} 1 +{"col1":"413","col2":"val_413"} 2 +{"col1":"414","col2":"val_414"} 2 +{"col1":"417","col2":"val_417"} 3 +{"col1":"418","col2":"val_418"} 1 +{"col1":"419","col2":"val_419"} 1 +{"col1":"42","col2":"val_42"} 2 +{"col1":"421","col2":"val_421"} 1 +{"col1":"424","col2":"val_424"} 2 +{"col1":"427","col2":"val_427"} 1 +{"col1":"429","col2":"val_429"} 2 +{"col1":"43","col2":"val_43"} 1 +{"col1":"430","col2":"val_430"} 3 +{"col1":"431","col2":"val_431"} 3 +{"col1":"432","col2":"val_432"} 1 +{"col1":"435","col2":"val_435"} 1 +{"col1":"436","col2":"val_436"} 1 +{"col1":"437","col2":"val_437"} 1 +{"col1":"438","col2":"val_438"} 3 +{"col1":"439","col2":"val_439"} 2 +{"col1":"44","col2":"val_44"} 1 +{"col1":"443","col2":"val_443"} 1 +{"col1":"444","col2":"val_444"} 1 +{"col1":"446","col2":"val_446"} 1 +{"col1":"448","col2":"val_448"} 1 +{"col1":"449","col2":"val_449"} 1 +{"col1":"452","col2":"val_452"} 1 +{"col1":"453","col2":"val_453"} 1 +{"col1":"454","col2":"val_454"} 3 +{"col1":"455","col2":"val_455"} 1 +{"col1":"457","col2":"val_457"} 1 +{"col1":"458","col2":"val_458"} 2 +{"col1":"459","col2":"val_459"} 2 +{"col1":"460","col2":"val_460"} 1 +{"col1":"462","col2":"val_462"} 2 +{"col1":"463","col2":"val_463"} 2 +{"col1":"466","col2":"val_466"} 3 +{"col1":"467","col2":"val_467"} 1 +{"col1":"468","col2":"val_468"} 4 +{"col1":"469","col2":"val_469"} 5 +{"col1":"47","col2":"val_47"} 1 +{"col1":"470","col2":"val_470"} 1 +{"col1":"472","col2":"val_472"} 1 +{"col1":"475","col2":"val_475"} 1 +{"col1":"477","col2":"val_477"} 1 +{"col1":"478","col2":"val_478"} 2 +{"col1":"479","col2":"val_479"} 1 +{"col1":"480","col2":"val_480"} 3 +{"col1":"481","col2":"val_481"} 1 +{"col1":"482","col2":"val_482"} 1 +{"col1":"483","col2":"val_483"} 1 +{"col1":"484","col2":"val_484"} 1 +{"col1":"485","col2":"val_485"} 1 +{"col1":"487","col2":"val_487"} 1 +{"col1":"489","col2":"val_489"} 4 +{"col1":"490","col2":"val_490"} 1 +{"col1":"491","col2":"val_491"} 1 +{"col1":"492","col2":"val_492"} 2 +{"col1":"493","col2":"val_493"} 1 +{"col1":"494","col2":"val_494"} 1 +{"col1":"495","col2":"val_495"} 1 +{"col1":"496","col2":"val_496"} 1 +{"col1":"497","col2":"val_497"} 1 +{"col1":"498","col2":"val_498"} 3 +{"col1":"5","col2":"val_5"} 3 +{"col1":"51","col2":"val_51"} 2 +{"col1":"53","col2":"val_53"} 1 +{"col1":"54","col2":"val_54"} 1 +{"col1":"57","col2":"val_57"} 1 +{"col1":"58","col2":"val_58"} 2 +{"col1":"64","col2":"val_64"} 1 +{"col1":"65","col2":"val_65"} 1 +{"col1":"66","col2":"val_66"} 1 +{"col1":"67","col2":"val_67"} 2 +{"col1":"69","col2":"val_69"} 1 +{"col1":"70","col2":"val_70"} 3 +{"col1":"72","col2":"val_72"} 2 +{"col1":"74","col2":"val_74"} 1 +{"col1":"76","col2":"val_76"} 2 +{"col1":"77","col2":"val_77"} 1 +{"col1":"78","col2":"val_78"} 1 +{"col1":"8","col2":"val_8"} 1 +{"col1":"80","col2":"val_80"} 1 +{"col1":"82","col2":"val_82"} 1 +{"col1":"83","col2":"val_83"} 2 +{"col1":"84","col2":"val_84"} 2 +{"col1":"85","col2":"val_85"} 1 +{"col1":"86","col2":"val_86"} 1 +{"col1":"87","col2":"val_87"} 1 +{"col1":"9","col2":"val_9"} 1 +{"col1":"90","col2":"val_90"} 3 +{"col1":"92","col2":"val_92"} 1 +{"col1":"95","col2":"val_95"} 2 +{"col1":"96","col2":"val_96"} 1 +{"col1":"97","col2":"val_97"} 2 +{"col1":"98","col2":"val_98"} 2 Index: ql/src/test/queries/clientpositive/groupby_complex_types.q =================================================================== --- ql/src/test/queries/clientpositive/groupby_complex_types.q (revision 1297854) +++ ql/src/test/queries/clientpositive/groupby_complex_types.q (working copy) @@ -1,16 +1,19 @@ - CREATE TABLE DEST1(key ARRAY, value BIGINT) STORED AS TEXTFILE; CREATE TABLE DEST2(key MAP, value BIGINT) STORED AS TEXTFILE; +CREATE TABLE DEST3(key STRUCT, value BIGINT) STORED AS TEXTFILE; EXPLAIN FROM SRC INSERT OVERWRITE TABLE DEST1 SELECT ARRAY(SRC.key), COUNT(1) GROUP BY ARRAY(SRC.key) -INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value); +INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value) +INSERT OVERWRITE TABLE DEST3 SELECT STRUCT(SRC.key, SRC.value), COUNT(1) GROUP BY STRUCT(SRC.key, SRC.value); FROM SRC INSERT OVERWRITE TABLE DEST1 SELECT ARRAY(SRC.key), COUNT(1) GROUP BY ARRAY(SRC.key) -INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value); +INSERT OVERWRITE TABLE DEST2 SELECT MAP(SRC.key, SRC.value), COUNT(1) GROUP BY MAP(SRC.key, SRC.value) +INSERT OVERWRITE TABLE DEST3 SELECT STRUCT(SRC.key, SRC.value), COUNT(1) GROUP BY STRUCT(SRC.key, SRC.value); SELECT DEST1.* FROM DEST1; SELECT DEST2.* FROM DEST2; +SELECT DEST3.* FROM DEST3;