diff --git ql/src/java/org/apache/hadoop/hive/ql/plan/TopNKeyDesc.java ql/src/java/org/apache/hadoop/hive/ql/plan/TopNKeyDesc.java index a9e2a527df..f752967a96 100644 --- ql/src/java/org/apache/hadoop/hive/ql/plan/TopNKeyDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/plan/TopNKeyDesc.java @@ -46,9 +46,23 @@ public TopNKeyDesc( final List keyColumns) { this.topN = topN; - this.columnSortOrder = columnSortOrder; - this.nullOrder = nullOrder; - this.keyColumns = keyColumns; + + this.keyColumns = new ArrayList<>(keyColumns.size()); + StringBuilder sortOrder = new StringBuilder(columnSortOrder.length()); + StringBuilder nullSortOrder = new StringBuilder(nullOrder.length()); + + for (int i = 0; i < keyColumns.size(); ++i) { + ExprNodeDesc keyExpression = keyColumns.get(i); + if (keyExpression instanceof ExprNodeConstantDesc) { + continue; + } + this.keyColumns.add(keyExpression); + sortOrder.append(columnSortOrder.charAt(i)); + nullSortOrder.append(nullOrder.charAt(i)); + } + + this.columnSortOrder = sortOrder.toString(); + this.nullOrder = nullSortOrder.toString(); } @Explain(displayName = "top n", explainLevels = { Level.DEFAULT, Level.EXTENDED, Level.USER }) diff --git ql/src/test/results/clientpositive/llap/topnkey_grouping_sets.q.out ql/src/test/results/clientpositive/llap/topnkey_grouping_sets.q.out index b1ec8d8847..1015ebf481 100644 --- ql/src/test/results/clientpositive/llap/topnkey_grouping_sets.q.out +++ ql/src/test/results/clientpositive/llap/topnkey_grouping_sets.q.out @@ -72,34 +72,28 @@ STAGE PLANS: alias: t_test_grouping_sets Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE Top N Key Operator - sort order: + - keys: a (type: int) - null sort order: z + sort order: ++ + keys: a (type: int), b (type: int) + null sort order: za Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE top n: 3 Select Operator expressions: a (type: int), b (type: int) outputColumnNames: _col0, _col1 Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: +++ + Group By Operator keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint) - null sort order: zaa - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 3 - Group By Operator - keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zaa - sort order: +++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zaa + sort order: +++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -109,16 +103,16 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE Select Operator expressions: _col0 (type: int), _col1 (type: int), grouping(_col2, 1L) (type: bigint), grouping(_col2, 0L) (type: bigint), grouping(_col2, 1L, 0L) (type: bigint) outputColumnNames: _col0, _col1, _col2, _col3, _col4 - Statistics: Num rows: 26 Data size: 632 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 712 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: _col0 (type: int) null sort order: z sort order: + - Statistics: Num rows: 26 Data size: 632 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 712 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 value expressions: _col1 (type: int), _col2 (type: bigint), _col3 (type: bigint), _col4 (type: bigint) Reducer 3 @@ -127,13 +121,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: int), VALUE._col1 (type: bigint), VALUE._col2 (type: bigint), VALUE._col3 (type: bigint) outputColumnNames: _col0, _col1, _col2, _col3, _col4 - Statistics: Num rows: 26 Data size: 632 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 712 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 3 - Statistics: Num rows: 3 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 3 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 3 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 3 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat @@ -196,34 +190,28 @@ STAGE PLANS: alias: t_test_grouping_sets Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE Top N Key Operator - sort order: + - keys: a (type: int) - null sort order: z + sort order: ++ + keys: a (type: int), b (type: int) + null sort order: za Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE top n: 10 Select Operator expressions: a (type: int), b (type: int) outputColumnNames: a, b Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: +++ + Group By Operator keys: a (type: int), b (type: int), 0L (type: bigint) - null sort order: zaa - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 10 - Group By Operator - keys: a (type: int), b (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zaa - sort order: +++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zaa + sort order: +++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -233,13 +221,13 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Reduce Output Operator key expressions: _col0 (type: int) null sort order: z sort order: + - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 value expressions: _col1 (type: int) Reducer 3 @@ -248,13 +236,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: int) outputColumnNames: _col0, _col1 - Statistics: Num rows: 26 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 10 - Statistics: Num rows: 10 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 10 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat @@ -686,25 +674,19 @@ STAGE PLANS: expressions: a (type: int), b (type: int) outputColumnNames: a, b Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: -++ + Group By Operator keys: a (type: int), b (type: int), 0L (type: bigint) - null sort order: zza - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 7 - Group By Operator - keys: a (type: int), b (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zza - sort order: -++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zza + sort order: -++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -714,13 +696,13 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Reduce Output Operator key expressions: _col0 (type: int), _col1 (type: int) null sort order: zz sort order: -+ - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 Reducer 3 Execution mode: llap @@ -728,13 +710,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int) outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 7 - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat @@ -814,25 +796,19 @@ STAGE PLANS: expressions: a (type: int), b (type: int) outputColumnNames: a, b Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: -++ + Group By Operator keys: a (type: int), b (type: int), 0L (type: bigint) - null sort order: zza - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 7 - Group By Operator - keys: a (type: int), b (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zza - sort order: -++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zza + sort order: -++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -842,13 +818,13 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Reduce Output Operator key expressions: _col0 (type: int), _col1 (type: int) null sort order: zz sort order: -+ - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 Reducer 3 Execution mode: llap @@ -856,13 +832,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int) outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 7 - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat @@ -942,25 +918,19 @@ STAGE PLANS: expressions: a (type: int), b (type: int) outputColumnNames: a, b Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: -++ + Group By Operator keys: a (type: int), b (type: int), 0L (type: bigint) - null sort order: zza - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 7 - Group By Operator - keys: a (type: int), b (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zza - sort order: -++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zza + sort order: -++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -970,13 +940,13 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Reduce Output Operator key expressions: _col0 (type: int), _col1 (type: int) null sort order: zz sort order: -+ - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 Reducer 3 Execution mode: llap @@ -984,13 +954,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int) outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 7 - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat @@ -1070,25 +1040,19 @@ STAGE PLANS: expressions: a (type: int), b (type: int) outputColumnNames: a, b Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: -++ + Group By Operator keys: a (type: int), b (type: int), 0L (type: bigint) - null sort order: zza - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 7 - Group By Operator - keys: a (type: int), b (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zza - sort order: -++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zza + sort order: -++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -1098,13 +1062,13 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Reduce Output Operator key expressions: _col0 (type: int), _col1 (type: int) null sort order: zz sort order: -+ - Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 Reducer 3 Execution mode: llap @@ -1112,13 +1076,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int) outputColumnNames: _col0, _col1 - Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 13 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 7 - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat @@ -1225,27 +1189,21 @@ STAGE PLANS: mode: mergepartial outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 6 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: -++ + Group By Operator + aggregations: max(_col2) keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint) - null sort order: zza - Statistics: Num rows: 6 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE - top n: 7 - Group By Operator - aggregations: max(_col2) - keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint) - minReductionHashAggr: 0.0 - mode: hash - outputColumnNames: _col0, _col1, _col2, _col3 - Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zza - sort order: -++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 - value expressions: _col3 (type: int) + minReductionHashAggr: 0.0 + mode: hash + outputColumnNames: _col0, _col1, _col2, _col3 + Statistics: Num rows: 6 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zza + sort order: -++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 6 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 + value expressions: _col3 (type: int) Reducer 3 Execution mode: llap Reduce Operator Tree: @@ -1254,17 +1212,17 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1, _col3 - Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 6 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Select Operator expressions: _col0 (type: int), _col1 (type: int), _col3 (type: int) outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator key expressions: _col0 (type: int), _col1 (type: int) null sort order: zz sort order: -+ - Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 value expressions: _col2 (type: int) Reducer 4 @@ -1273,13 +1231,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int), VALUE._col0 (type: int) outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 7 - Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat diff --git ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_functions.q.out ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_functions.q.out index 0ec6e6de43..84657327ec 100644 --- ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_functions.q.out +++ ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_functions.q.out @@ -284,8 +284,8 @@ NULL 1 2 5 2 3 NULL 2 1 6 2 1 -7 8 4 NULL 8 4 +7 8 4 PREHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7 PREHOOK: type: QUERY PREHOOK: Input: default@t_test_grouping_sets @@ -413,8 +413,8 @@ NULL 1 2 5 2 3 NULL 2 3 6 2 1 -NULL 8 4 7 8 4 +NULL 8 4 PREHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7 PREHOOK: type: QUERY PREHOOK: Input: default@t_test_grouping_sets diff --git ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_order.q.out ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_order.q.out index d3ff1a6256..598d86b11c 100644 --- ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_order.q.out +++ ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_order.q.out @@ -146,8 +146,8 @@ POSTHOOK: Input: default@t_test_grouping_sets NULL NULL 5 NULL 6 NULL -10 NULL 7 NULL +10 NULL NULL NULL NULL NULL PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7 @@ -270,8 +270,8 @@ NULL 1 5 2 NULL 2 6 2 -NULL 8 7 8 +NULL 8 PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7 PREHOOK: type: QUERY PREHOOK: Input: default@t_test_grouping_sets @@ -285,8 +285,8 @@ NULL 1 5 2 NULL 2 6 2 -NULL 8 7 8 +NULL 8 PREHOOK: query: EXPLAIN SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7 PREHOOK: type: QUERY @@ -325,25 +325,19 @@ STAGE PLANS: expressions: a (type: int), b (type: int) outputColumnNames: a, b Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: -++ + Group By Operator keys: a (type: int), b (type: int), 0L (type: bigint) - null sort order: zza - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 7 - Group By Operator - keys: a (type: int), b (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: zza - sort order: -++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: zza + sort order: -++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -353,13 +347,13 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Reduce Output Operator key expressions: _col0 (type: int), _col1 (type: int) null sort order: zz sort order: -+ - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 Reducer 3 Execution mode: llap @@ -367,13 +361,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int) outputColumnNames: _col0, _col1 - Statistics: Num rows: 26 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 7 - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat @@ -453,25 +447,19 @@ STAGE PLANS: expressions: a (type: int), b (type: int) outputColumnNames: a, b Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - Top N Key Operator - sort order: -++ + Group By Operator keys: a (type: int), b (type: int), 0L (type: bigint) - null sort order: aaa - Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE - top n: 7 - Group By Operator - keys: a (type: int), b (type: int), 0L (type: bigint) - minReductionHashAggr: 0.15384614 - mode: hash - outputColumnNames: _col0, _col1, _col2 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - Reduce Output Operator - key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - null sort order: aaa - sort order: -++ - Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE - TopN Hash Memory Usage: 0.1 + minReductionHashAggr: 0.15384614 + mode: hash + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + null sort order: aaa + sort order: -++ + Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint) + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE + TopN Hash Memory Usage: 0.1 Execution mode: llap LLAP IO: no inputs Reducer 2 @@ -481,13 +469,13 @@ STAGE PLANS: keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint) mode: mergepartial outputColumnNames: _col0, _col1 - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE pruneGroupingSetId: true Reduce Output Operator key expressions: _col0 (type: int), _col1 (type: int) null sort order: aa sort order: -+ - Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE TopN Hash Memory Usage: 0.1 Reducer 3 Execution mode: llap @@ -495,13 +483,13 @@ STAGE PLANS: Select Operator expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int) outputColumnNames: _col0, _col1 - Statistics: Num rows: 26 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 26 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE Limit Number of rows: 7 - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false - Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat