You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2018/07/19 21:24:15 UTC

[02/13] hive git commit: HIVE-17896: TopNKey: Create a standalone vectorizable TopNKey operator (Teddy Choi, reviewed by Jesus Camacho Rodriguez)

http://git-wip-us.apache.org/repos/asf/hive/blob/cc294d32/ql/src/test/results/clientpositive/perf/tez/query80.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query80.q.out b/ql/src/test/results/clientpositive/perf/tez/query80.q.out
index fb4cd56..f250c5a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query80.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query80.q.out
@@ -217,262 +217,268 @@ Stage-0
     limit:100
     Stage-1
       Reducer 10 vectorized
-      File Output Operator [FS_266]
-        Limit [LIM_265] (rows=100 width=108)
+      File Output Operator [FS_271]
+        Limit [LIM_270] (rows=100 width=108)
           Number of rows:100
-          Select Operator [SEL_264] (rows=1217531358 width=108)
+          Select Operator [SEL_269] (rows=1217531358 width=108)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 9 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_263]
-              Select Operator [SEL_262] (rows=1217531358 width=108)
+            SHUFFLE [RS_268]
+              Select Operator [SEL_267] (rows=1217531358 width=108)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_261] (rows=1217531358 width=108)
+                Group By Operator [GBY_266] (rows=1217531358 width=108)
                   Output:["_col0","_col1","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Union 8 [SIMPLE_EDGE]
                   <-Reducer 17 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_279]
+                    Reduce Output Operator [RS_285]
                       PartitionCols:_col0, _col1, _col2
-                      Group By Operator [GBY_278] (rows=2435062716 width=108)
+                      Group By Operator [GBY_284] (rows=2435062716 width=108)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                        Select Operator [SEL_277] (rows=231905279 width=135)
-                          Output:["_col0","_col1","_col2","_col3","_col4"]
-                          Group By Operator [GBY_276] (rows=231905279 width=135)
-                            Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
-                          <-Reducer 16 [SIMPLE_EDGE]
-                            SHUFFLE [RS_75]
-                              PartitionCols:_col0
-                              Group By Operator [GBY_74] (rows=463810558 width=135)
-                                Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
-                                Select Operator [SEL_72] (rows=463810558 width=135)
-                                  Output:["_col0","_col1","_col2","_col3"]
-                                  Merge Join Operator [MERGEJOIN_212] (rows=463810558 width=135)
-                                    Conds:RS_69._col1=RS_275._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
-                                  <-Map 29 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_275]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_274] (rows=46000 width=460)
-                                        Output:["_col0","_col1"]
-                                        Filter Operator [FIL_273] (rows=46000 width=460)
-                                          predicate:cp_catalog_page_sk is not null
-                                          TableScan [TS_54] (rows=46000 width=460)
-                                            default@catalog_page,catalog_page,Tbl:COMPLETE,Col:NONE,Output:["cp_catalog_page_sk","cp_catalog_page_id"]
-                                  <-Reducer 15 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_69]
-                                      PartitionCols:_col1
-                                      Merge Join Operator [MERGEJOIN_211] (rows=421645953 width=135)
-                                        Conds:RS_66._col3=RS_252._col0(Inner),Output:["_col1","_col5","_col6","_col9","_col10"]
-                                      <-Map 24 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_252]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_250] (rows=1150 width=1179)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_249] (rows=1150 width=1179)
-                                              predicate:((p_channel_tv = 'N') and p_promo_sk is not null)
-                                              TableScan [TS_12] (rows=2300 width=1179)
-                                                default@promotion,promotion,Tbl:COMPLETE,Col:NONE,Output:["p_promo_sk","p_channel_tv"]
-                                      <-Reducer 14 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_66]
-                                          PartitionCols:_col3
-                                          Merge Join Operator [MERGEJOIN_210] (rows=383314495 width=135)
-                                            Conds:RS_63._col2=RS_247._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col9","_col10"]
-                                          <-Map 23 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_247]
-                                              PartitionCols:_col0
-                                              Select Operator [SEL_245] (rows=154000 width=1436)
-                                                Output:["_col0"]
-                                                Filter Operator [FIL_244] (rows=154000 width=1436)
-                                                  predicate:((i_current_price > 50) and i_item_sk is not null)
-                                                  TableScan [TS_9] (rows=462000 width=1436)
-                                                    default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_current_price"]
-                                          <-Reducer 13 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_63]
-                                              PartitionCols:_col2
-                                              Merge Join Operator [MERGEJOIN_209] (rows=348467716 width=135)
-                                                Conds:RS_60._col0=RS_242._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
-                                              <-Map 12 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_242]
-                                                  PartitionCols:_col0
-                                                  Select Operator [SEL_240] (rows=8116 width=1119)
-                                                    Output:["_col0"]
-                                                    Filter Operator [FIL_239] (rows=8116 width=1119)
-                                                      predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00' and d_date_sk is not null)
-                                                      TableScan [TS_6] (rows=73049 width=1119)
-                                                        default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_date"]
-                                              <-Reducer 27 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_60]
-                                                  PartitionCols:_col0
-                                                  Merge Join Operator [MERGEJOIN_208] (rows=316788826 width=135)
-                                                    Conds:RS_269._col2, _col4=RS_272._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
-                                                  <-Map 26 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_269]
-                                                      PartitionCols:_col2, _col4
-                                                      Select Operator [SEL_268] (rows=287989836 width=135)
-                                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                        Filter Operator [FIL_267] (rows=287989836 width=135)
-                                                          predicate:(cs_catalog_page_sk is not null and cs_item_sk is not null and cs_promo_sk is not null and cs_sold_date_sk is not null)
-                                                          TableScan [TS_39] (rows=287989836 width=135)
-                                                            default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_catalog_page_sk","cs_item_sk","cs_promo_sk","cs_order_number","cs_ext_sales_price","cs_net_profit"]
-                                                  <-Map 28 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_272]
-                                                      PartitionCols:_col0, _col1
-                                                      Select Operator [SEL_271] (rows=28798881 width=106)
-                                                        Output:["_col0","_col1","_col2","_col3"]
-                                                        Filter Operator [FIL_270] (rows=28798881 width=106)
-                                                          predicate:cr_item_sk is not null
-                                                          TableScan [TS_42] (rows=28798881 width=106)
-                                                            default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:NONE,Output:["cr_item_sk","cr_order_number","cr_return_amount","cr_net_loss"]
+                        Top N Key Operator [TNK_283] (rows=811687572 width=108)
+                          keys:_col0, _col1, 0L,sort order:+++,top n:100
+                          Select Operator [SEL_282] (rows=231905279 width=135)
+                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                            Group By Operator [GBY_281] (rows=231905279 width=135)
+                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
+                            <-Reducer 16 [SIMPLE_EDGE]
+                              SHUFFLE [RS_75]
+                                PartitionCols:_col0
+                                Group By Operator [GBY_74] (rows=463810558 width=135)
+                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
+                                  Select Operator [SEL_72] (rows=463810558 width=135)
+                                    Output:["_col0","_col1","_col2","_col3"]
+                                    Merge Join Operator [MERGEJOIN_213] (rows=463810558 width=135)
+                                      Conds:RS_69._col1=RS_280._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
+                                    <-Map 29 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_280]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_279] (rows=46000 width=460)
+                                          Output:["_col0","_col1"]
+                                          Filter Operator [FIL_278] (rows=46000 width=460)
+                                            predicate:cp_catalog_page_sk is not null
+                                            TableScan [TS_54] (rows=46000 width=460)
+                                              default@catalog_page,catalog_page,Tbl:COMPLETE,Col:NONE,Output:["cp_catalog_page_sk","cp_catalog_page_id"]
+                                    <-Reducer 15 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_69]
+                                        PartitionCols:_col1
+                                        Merge Join Operator [MERGEJOIN_212] (rows=421645953 width=135)
+                                          Conds:RS_66._col3=RS_256._col0(Inner),Output:["_col1","_col5","_col6","_col9","_col10"]
+                                        <-Map 24 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_256]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_254] (rows=1150 width=1179)
+                                              Output:["_col0"]
+                                              Filter Operator [FIL_253] (rows=1150 width=1179)
+                                                predicate:((p_channel_tv = 'N') and p_promo_sk is not null)
+                                                TableScan [TS_12] (rows=2300 width=1179)
+                                                  default@promotion,promotion,Tbl:COMPLETE,Col:NONE,Output:["p_promo_sk","p_channel_tv"]
+                                        <-Reducer 14 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_66]
+                                            PartitionCols:_col3
+                                            Merge Join Operator [MERGEJOIN_211] (rows=383314495 width=135)
+                                              Conds:RS_63._col2=RS_251._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col9","_col10"]
+                                            <-Map 23 [SIMPLE_EDGE] vectorized
+                                              SHUFFLE [RS_251]
+                                                PartitionCols:_col0
+                                                Select Operator [SEL_249] (rows=154000 width=1436)
+                                                  Output:["_col0"]
+                                                  Filter Operator [FIL_248] (rows=154000 width=1436)
+                                                    predicate:((i_current_price > 50) and i_item_sk is not null)
+                                                    TableScan [TS_9] (rows=462000 width=1436)
+                                                      default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_current_price"]
+                                            <-Reducer 13 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_63]
+                                                PartitionCols:_col2
+                                                Merge Join Operator [MERGEJOIN_210] (rows=348467716 width=135)
+                                                  Conds:RS_60._col0=RS_246._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                <-Map 12 [SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_246]
+                                                    PartitionCols:_col0
+                                                    Select Operator [SEL_244] (rows=8116 width=1119)
+                                                      Output:["_col0"]
+                                                      Filter Operator [FIL_243] (rows=8116 width=1119)
+                                                        predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00' and d_date_sk is not null)
+                                                        TableScan [TS_6] (rows=73049 width=1119)
+                                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_date"]
+                                                <-Reducer 27 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_60]
+                                                    PartitionCols:_col0
+                                                    Merge Join Operator [MERGEJOIN_209] (rows=316788826 width=135)
+                                                      Conds:RS_274._col2, _col4=RS_277._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    <-Map 26 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_274]
+                                                        PartitionCols:_col2, _col4
+                                                        Select Operator [SEL_273] (rows=287989836 width=135)
+                                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                                          Filter Operator [FIL_272] (rows=287989836 width=135)
+                                                            predicate:(cs_catalog_page_sk is not null and cs_item_sk is not null and cs_promo_sk is not null and cs_sold_date_sk is not null)
+                                                            TableScan [TS_39] (rows=287989836 width=135)
+                                                              default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_catalog_page_sk","cs_item_sk","cs_promo_sk","cs_order_number","cs_ext_sales_price","cs_net_profit"]
+                                                    <-Map 28 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_277]
+                                                        PartitionCols:_col0, _col1
+                                                        Select Operator [SEL_276] (rows=28798881 width=106)
+                                                          Output:["_col0","_col1","_col2","_col3"]
+                                                          Filter Operator [FIL_275] (rows=28798881 width=106)
+                                                            predicate:cr_item_sk is not null
+                                                            TableScan [TS_42] (rows=28798881 width=106)
+                                                              default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:NONE,Output:["cr_item_sk","cr_order_number","cr_return_amount","cr_net_loss"]
                   <-Reducer 22 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_292]
+                    Reduce Output Operator [RS_299]
                       PartitionCols:_col0, _col1, _col2
-                      Group By Operator [GBY_291] (rows=2435062716 width=108)
+                      Group By Operator [GBY_298] (rows=2435062716 width=108)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                        Select Operator [SEL_290] (rows=115958879 width=135)
-                          Output:["_col0","_col1","_col2","_col3","_col4"]
-                          Group By Operator [GBY_289] (rows=115958879 width=135)
-                            Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
-                          <-Reducer 21 [SIMPLE_EDGE]
-                            SHUFFLE [RS_115]
-                              PartitionCols:_col0
-                              Group By Operator [GBY_114] (rows=231917759 width=135)
-                                Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
-                                Select Operator [SEL_112] (rows=231917759 width=135)
-                                  Output:["_col0","_col1","_col2","_col3"]
-                                  Merge Join Operator [MERGEJOIN_217] (rows=231917759 width=135)
-                                    Conds:RS_109._col2=RS_288._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
-                                  <-Map 33 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_288]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_287] (rows=84 width=1850)
-                                        Output:["_col0","_col1"]
-                                        Filter Operator [FIL_286] (rows=84 width=1850)
-                                          predicate:web_site_sk is not null
-                                          TableScan [TS_94] (rows=84 width=1850)
-                                            default@web_site,web_site,Tbl:COMPLETE,Col:NONE,Output:["web_site_sk","web_site_id"]
-                                  <-Reducer 20 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_109]
-                                      PartitionCols:_col2
-                                      Merge Join Operator [MERGEJOIN_216] (rows=210834322 width=135)
-                                        Conds:RS_106._col3=RS_253._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
-                                      <-Map 24 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_253]
-                                          PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_250]
-                                      <-Reducer 19 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_106]
-                                          PartitionCols:_col3
-                                          Merge Join Operator [MERGEJOIN_215] (rows=191667562 width=135)
-                                            Conds:RS_103._col1=RS_248._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
-                                          <-Map 23 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_248]
-                                              PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_245]
-                                          <-Reducer 18 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_103]
-                                              PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_214] (rows=174243235 width=135)
-                                                Conds:RS_100._col0=RS_243._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
-                                              <-Map 12 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_243]
-                                                  PartitionCols:_col0
-                                                   Please refer to the previous Select Operator [SEL_240]
-                                              <-Reducer 31 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_100]
-                                                  PartitionCols:_col0
-                                                  Merge Join Operator [MERGEJOIN_213] (rows=158402938 width=135)
-                                                    Conds:RS_282._col1, _col4=RS_285._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
-                                                  <-Map 30 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_282]
-                                                      PartitionCols:_col1, _col4
-                                                      Select Operator [SEL_281] (rows=144002668 width=135)
-                                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                        Filter Operator [FIL_280] (rows=144002668 width=135)
-                                                          predicate:(ws_item_sk is not null and ws_promo_sk is not null and ws_sold_date_sk is not null and ws_web_site_sk is not null)
-                                                          TableScan [TS_79] (rows=144002668 width=135)
-                                                            default@web_sales,web_sales,Tbl:COMPLETE,Col:NONE,Output:["ws_sold_date_sk","ws_item_sk","ws_web_site_sk","ws_promo_sk","ws_order_number","ws_ext_sales_price","ws_net_profit"]
-                                                  <-Map 32 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_285]
-                                                      PartitionCols:_col0, _col1
-                                                      Select Operator [SEL_284] (rows=14398467 width=92)
-                                                        Output:["_col0","_col1","_col2","_col3"]
-                                                        Filter Operator [FIL_283] (rows=14398467 width=92)
-                                                          predicate:wr_item_sk is not null
-                                                          TableScan [TS_82] (rows=14398467 width=92)
-                                                            default@web_returns,web_returns,Tbl:COMPLETE,Col:NONE,Output:["wr_item_sk","wr_order_number","wr_return_amt","wr_net_loss"]
+                        Top N Key Operator [TNK_297] (rows=811687572 width=108)
+                          keys:_col0, _col1, 0L,sort order:+++,top n:100
+                          Select Operator [SEL_296] (rows=115958879 width=135)
+                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                            Group By Operator [GBY_295] (rows=115958879 width=135)
+                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
+                            <-Reducer 21 [SIMPLE_EDGE]
+                              SHUFFLE [RS_115]
+                                PartitionCols:_col0
+                                Group By Operator [GBY_114] (rows=231917759 width=135)
+                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
+                                  Select Operator [SEL_112] (rows=231917759 width=135)
+                                    Output:["_col0","_col1","_col2","_col3"]
+                                    Merge Join Operator [MERGEJOIN_218] (rows=231917759 width=135)
+                                      Conds:RS_109._col2=RS_294._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
+                                    <-Map 33 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_294]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_293] (rows=84 width=1850)
+                                          Output:["_col0","_col1"]
+                                          Filter Operator [FIL_292] (rows=84 width=1850)
+                                            predicate:web_site_sk is not null
+                                            TableScan [TS_94] (rows=84 width=1850)
+                                              default@web_site,web_site,Tbl:COMPLETE,Col:NONE,Output:["web_site_sk","web_site_id"]
+                                    <-Reducer 20 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_109]
+                                        PartitionCols:_col2
+                                        Merge Join Operator [MERGEJOIN_217] (rows=210834322 width=135)
+                                          Conds:RS_106._col3=RS_257._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
+                                        <-Map 24 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_257]
+                                            PartitionCols:_col0
+                                             Please refer to the previous Select Operator [SEL_254]
+                                        <-Reducer 19 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_106]
+                                            PartitionCols:_col3
+                                            Merge Join Operator [MERGEJOIN_216] (rows=191667562 width=135)
+                                              Conds:RS_103._col1=RS_252._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
+                                            <-Map 23 [SIMPLE_EDGE] vectorized
+                                              SHUFFLE [RS_252]
+                                                PartitionCols:_col0
+                                                 Please refer to the previous Select Operator [SEL_249]
+                                            <-Reducer 18 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_103]
+                                                PartitionCols:_col1
+                                                Merge Join Operator [MERGEJOIN_215] (rows=174243235 width=135)
+                                                  Conds:RS_100._col0=RS_247._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                <-Map 12 [SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_247]
+                                                    PartitionCols:_col0
+                                                     Please refer to the previous Select Operator [SEL_244]
+                                                <-Reducer 31 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_100]
+                                                    PartitionCols:_col0
+                                                    Merge Join Operator [MERGEJOIN_214] (rows=158402938 width=135)
+                                                      Conds:RS_288._col1, _col4=RS_291._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    <-Map 30 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_288]
+                                                        PartitionCols:_col1, _col4
+                                                        Select Operator [SEL_287] (rows=144002668 width=135)
+                                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                                          Filter Operator [FIL_286] (rows=144002668 width=135)
+                                                            predicate:(ws_item_sk is not null and ws_promo_sk is not null and ws_sold_date_sk is not null and ws_web_site_sk is not null)
+                                                            TableScan [TS_79] (rows=144002668 width=135)
+                                                              default@web_sales,web_sales,Tbl:COMPLETE,Col:NONE,Output:["ws_sold_date_sk","ws_item_sk","ws_web_site_sk","ws_promo_sk","ws_order_number","ws_ext_sales_price","ws_net_profit"]
+                                                    <-Map 32 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_291]
+                                                        PartitionCols:_col0, _col1
+                                                        Select Operator [SEL_290] (rows=14398467 width=92)
+                                                          Output:["_col0","_col1","_col2","_col3"]
+                                                          Filter Operator [FIL_289] (rows=14398467 width=92)
+                                                            predicate:wr_item_sk is not null
+                                                            TableScan [TS_82] (rows=14398467 width=92)
+                                                              default@web_returns,web_returns,Tbl:COMPLETE,Col:NONE,Output:["wr_item_sk","wr_order_number","wr_return_amt","wr_net_loss"]
                   <-Reducer 7 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_260]
+                    Reduce Output Operator [RS_265]
                       PartitionCols:_col0, _col1, _col2
-                      Group By Operator [GBY_259] (rows=2435062716 width=108)
+                      Group By Operator [GBY_264] (rows=2435062716 width=108)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                        Select Operator [SEL_258] (rows=463823414 width=88)
-                          Output:["_col0","_col1","_col2","_col3","_col4"]
-                          Group By Operator [GBY_257] (rows=463823414 width=88)
-                            Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
-                          <-Reducer 6 [SIMPLE_EDGE]
-                            SHUFFLE [RS_36]
-                              PartitionCols:_col0
-                              Group By Operator [GBY_35] (rows=927646829 width=88)
-                                Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
-                                Select Operator [SEL_33] (rows=927646829 width=88)
-                                  Output:["_col0","_col1","_col2","_col3"]
-                                  Merge Join Operator [MERGEJOIN_207] (rows=927646829 width=88)
-                                    Conds:RS_30._col2=RS_256._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
-                                  <-Map 25 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_256]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_255] (rows=1704 width=1910)
-                                        Output:["_col0","_col1"]
-                                        Filter Operator [FIL_254] (rows=1704 width=1910)
-                                          predicate:s_store_sk is not null
-                                          TableScan [TS_15] (rows=1704 width=1910)
-                                            default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_id"]
-                                  <-Reducer 5 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_30]
-                                      PartitionCols:_col2
-                                      Merge Join Operator [MERGEJOIN_206] (rows=843315281 width=88)
-                                        Conds:RS_27._col3=RS_251._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
-                                      <-Map 24 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_251]
-                                          PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_250]
-                                      <-Reducer 4 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_27]
-                                          PartitionCols:_col3
-                                          Merge Join Operator [MERGEJOIN_205] (rows=766650239 width=88)
-                                            Conds:RS_24._col1=RS_246._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
-                                          <-Map 23 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_246]
-                                              PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_245]
-                                          <-Reducer 3 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_24]
-                                              PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_204] (rows=696954748 width=88)
-                                                Conds:RS_21._col0=RS_241._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
-                                              <-Map 12 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_241]
-                                                  PartitionCols:_col0
-                                                   Please refer to the previous Select Operator [SEL_240]
-                                              <-Reducer 2 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_21]
-                                                  PartitionCols:_col0
-                                                  Merge Join Operator [MERGEJOIN_203] (rows=633595212 width=88)
-                                                    Conds:RS_235._col1, _col4=RS_238._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
-                                                  <-Map 1 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_235]
-                                                      PartitionCols:_col1, _col4
-                                                      Select Operator [SEL_234] (rows=575995635 width=88)
-                                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                        Filter Operator [FIL_233] (rows=575995635 width=88)
-                                                          predicate:(ss_item_sk is not null and ss_promo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
-                                                          TableScan [TS_0] (rows=575995635 width=88)
-                                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_promo_sk","ss_ticket_number","ss_ext_sales_price","ss_net_profit"]
-                                                  <-Map 11 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_238]
-                                                      PartitionCols:_col0, _col1
-                                                      Select Operator [SEL_237] (rows=57591150 width=77)
-                                                        Output:["_col0","_col1","_col2","_col3"]
-                                                        Filter Operator [FIL_236] (rows=57591150 width=77)
-                                                          predicate:sr_item_sk is not null
-                                                          TableScan [TS_3] (rows=57591150 width=77)
-                                                            default@store_returns,store_returns,Tbl:COMPLETE,Col:NONE,Output:["sr_item_sk","sr_ticket_number","sr_return_amt","sr_net_loss"]
+                        Top N Key Operator [TNK_263] (rows=811687572 width=108)
+                          keys:_col0, _col1, 0L,sort order:+++,top n:100
+                          Select Operator [SEL_262] (rows=463823414 width=88)
+                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                            Group By Operator [GBY_261] (rows=463823414 width=88)
+                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
+                            <-Reducer 6 [SIMPLE_EDGE]
+                              SHUFFLE [RS_36]
+                                PartitionCols:_col0
+                                Group By Operator [GBY_35] (rows=927646829 width=88)
+                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
+                                  Select Operator [SEL_33] (rows=927646829 width=88)
+                                    Output:["_col0","_col1","_col2","_col3"]
+                                    Merge Join Operator [MERGEJOIN_208] (rows=927646829 width=88)
+                                      Conds:RS_30._col2=RS_260._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
+                                    <-Map 25 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_260]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_259] (rows=1704 width=1910)
+                                          Output:["_col0","_col1"]
+                                          Filter Operator [FIL_258] (rows=1704 width=1910)
+                                            predicate:s_store_sk is not null
+                                            TableScan [TS_15] (rows=1704 width=1910)
+                                              default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_id"]
+                                    <-Reducer 5 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_30]
+                                        PartitionCols:_col2
+                                        Merge Join Operator [MERGEJOIN_207] (rows=843315281 width=88)
+                                          Conds:RS_27._col3=RS_255._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
+                                        <-Map 24 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_255]
+                                            PartitionCols:_col0
+                                             Please refer to the previous Select Operator [SEL_254]
+                                        <-Reducer 4 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_27]
+                                            PartitionCols:_col3
+                                            Merge Join Operator [MERGEJOIN_206] (rows=766650239 width=88)
+                                              Conds:RS_24._col1=RS_250._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
+                                            <-Map 23 [SIMPLE_EDGE] vectorized
+                                              SHUFFLE [RS_250]
+                                                PartitionCols:_col0
+                                                 Please refer to the previous Select Operator [SEL_249]
+                                            <-Reducer 3 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_24]
+                                                PartitionCols:_col1
+                                                Merge Join Operator [MERGEJOIN_205] (rows=696954748 width=88)
+                                                  Conds:RS_21._col0=RS_245._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                <-Map 12 [SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_245]
+                                                    PartitionCols:_col0
+                                                     Please refer to the previous Select Operator [SEL_244]
+                                                <-Reducer 2 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_21]
+                                                    PartitionCols:_col0
+                                                    Merge Join Operator [MERGEJOIN_204] (rows=633595212 width=88)
+                                                      Conds:RS_239._col1, _col4=RS_242._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    <-Map 1 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_239]
+                                                        PartitionCols:_col1, _col4
+                                                        Select Operator [SEL_238] (rows=575995635 width=88)
+                                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                                          Filter Operator [FIL_237] (rows=575995635 width=88)
+                                                            predicate:(ss_item_sk is not null and ss_promo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                                            TableScan [TS_0] (rows=575995635 width=88)
+                                                              default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_promo_sk","ss_ticket_number","ss_ext_sales_price","ss_net_profit"]
+                                                    <-Map 11 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_242]
+                                                        PartitionCols:_col0, _col1
+                                                        Select Operator [SEL_241] (rows=57591150 width=77)
+                                                          Output:["_col0","_col1","_col2","_col3"]
+                                                          Filter Operator [FIL_240] (rows=57591150 width=77)
+                                                            predicate:sr_item_sk is not null
+                                                            TableScan [TS_3] (rows=57591150 width=77)
+                                                              default@store_returns,store_returns,Tbl:COMPLETE,Col:NONE,Output:["sr_item_sk","sr_ticket_number","sr_return_amt","sr_net_loss"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/cc294d32/ql/src/test/results/clientpositive/perf/tez/query82.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query82.q.out b/ql/src/test/results/clientpositive/perf/tez/query82.q.out
index 9a9b707..d948b7d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query82.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query82.q.out
@@ -43,61 +43,63 @@ Stage-0
     limit:100
     Stage-1
       Reducer 4 vectorized
-      File Output Operator [FS_61]
-        Limit [LIM_60] (rows=100 width=88)
+      File Output Operator [FS_62]
+        Limit [LIM_61] (rows=100 width=88)
           Number of rows:100
-          Select Operator [SEL_59] (rows=633595212 width=88)
+          Select Operator [SEL_60] (rows=633595212 width=88)
             Output:["_col0","_col1","_col2"]
           <-Reducer 3 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_58]
-              Group By Operator [GBY_57] (rows=633595212 width=88)
+            SHUFFLE [RS_59]
+              Group By Operator [GBY_58] (rows=633595212 width=88)
                 Output:["_col0","_col1","_col2"],keys:KEY._col0, KEY._col1, KEY._col2
               <-Reducer 2 [SIMPLE_EDGE]
                 SHUFFLE [RS_22]
                   PartitionCols:_col0, _col1, _col2
                   Group By Operator [GBY_21] (rows=1267190424 width=88)
                     Output:["_col0","_col1","_col2"],keys:_col2, _col3, _col4
-                    Merge Join Operator [MERGEJOIN_44] (rows=1267190424 width=88)
-                      Conds:RS_47._col0=RS_50._col0(Inner),RS_50._col0=RS_18._col1(Inner),Output:["_col2","_col3","_col4"]
-                    <-Map 1 [SIMPLE_EDGE] vectorized
-                      SHUFFLE [RS_47]
-                        PartitionCols:_col0
-                        Select Operator [SEL_46] (rows=575995635 width=88)
-                          Output:["_col0"]
-                          Filter Operator [FIL_45] (rows=575995635 width=88)
-                            predicate:ss_item_sk is not null
-                            TableScan [TS_0] (rows=575995635 width=88)
-                              default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_item_sk"]
-                    <-Map 5 [SIMPLE_EDGE] vectorized
-                      SHUFFLE [RS_50]
-                        PartitionCols:_col0
-                        Select Operator [SEL_49] (rows=25666 width=1436)
-                          Output:["_col0","_col1","_col2","_col3"]
-                          Filter Operator [FIL_48] (rows=25666 width=1436)
-                            predicate:((i_manufact_id) IN (437, 129, 727, 663) and i_current_price BETWEEN 30 AND 60 and i_item_sk is not null)
-                            TableScan [TS_3] (rows=462000 width=1436)
-                              default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_item_id","i_item_desc","i_current_price","i_manufact_id"]
-                    <-Reducer 7 [SIMPLE_EDGE]
-                      SHUFFLE [RS_18]
-                        PartitionCols:_col1
-                        Merge Join Operator [MERGEJOIN_43] (rows=4593600 width=15)
-                          Conds:RS_53._col0=RS_56._col0(Inner),Output:["_col1"]
-                        <-Map 6 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_53]
-                            PartitionCols:_col0
-                            Select Operator [SEL_52] (rows=4176000 width=15)
-                              Output:["_col0","_col1"]
-                              Filter Operator [FIL_51] (rows=4176000 width=15)
-                                predicate:(inv_date_sk is not null and inv_item_sk is not null and inv_quantity_on_hand BETWEEN 100 AND 500)
-                                TableScan [TS_6] (rows=37584000 width=15)
-                                  default@inventory,inventory,Tbl:COMPLETE,Col:NONE,Output:["inv_date_sk","inv_item_sk","inv_quantity_on_hand"]
-                        <-Map 8 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_56]
-                            PartitionCols:_col0
-                            Select Operator [SEL_55] (rows=8116 width=1119)
-                              Output:["_col0"]
-                              Filter Operator [FIL_54] (rows=8116 width=1119)
-                                predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'2002-05-30 00:00:00' AND TIMESTAMP'2002-07-29 00:00:00' and d_date_sk is not null)
-                                TableScan [TS_9] (rows=73049 width=1119)
-                                  default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_date"]
+                    Top N Key Operator [TNK_43] (rows=1267190424 width=88)
+                      keys:_col2, _col3, _col4,sort order:+++,top n:100
+                      Merge Join Operator [MERGEJOIN_45] (rows=1267190424 width=88)
+                        Conds:RS_48._col0=RS_51._col0(Inner),RS_51._col0=RS_18._col1(Inner),Output:["_col2","_col3","_col4"]
+                      <-Map 1 [SIMPLE_EDGE] vectorized
+                        SHUFFLE [RS_48]
+                          PartitionCols:_col0
+                          Select Operator [SEL_47] (rows=575995635 width=88)
+                            Output:["_col0"]
+                            Filter Operator [FIL_46] (rows=575995635 width=88)
+                              predicate:ss_item_sk is not null
+                              TableScan [TS_0] (rows=575995635 width=88)
+                                default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_item_sk"]
+                      <-Map 5 [SIMPLE_EDGE] vectorized
+                        SHUFFLE [RS_51]
+                          PartitionCols:_col0
+                          Select Operator [SEL_50] (rows=25666 width=1436)
+                            Output:["_col0","_col1","_col2","_col3"]
+                            Filter Operator [FIL_49] (rows=25666 width=1436)
+                              predicate:((i_manufact_id) IN (437, 129, 727, 663) and i_current_price BETWEEN 30 AND 60 and i_item_sk is not null)
+                              TableScan [TS_3] (rows=462000 width=1436)
+                                default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_item_id","i_item_desc","i_current_price","i_manufact_id"]
+                      <-Reducer 7 [SIMPLE_EDGE]
+                        SHUFFLE [RS_18]
+                          PartitionCols:_col1
+                          Merge Join Operator [MERGEJOIN_44] (rows=4593600 width=15)
+                            Conds:RS_54._col0=RS_57._col0(Inner),Output:["_col1"]
+                          <-Map 6 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_54]
+                              PartitionCols:_col0
+                              Select Operator [SEL_53] (rows=4176000 width=15)
+                                Output:["_col0","_col1"]
+                                Filter Operator [FIL_52] (rows=4176000 width=15)
+                                  predicate:(inv_date_sk is not null and inv_item_sk is not null and inv_quantity_on_hand BETWEEN 100 AND 500)
+                                  TableScan [TS_6] (rows=37584000 width=15)
+                                    default@inventory,inventory,Tbl:COMPLETE,Col:NONE,Output:["inv_date_sk","inv_item_sk","inv_quantity_on_hand"]
+                          <-Map 8 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_57]
+                              PartitionCols:_col0
+                              Select Operator [SEL_56] (rows=8116 width=1119)
+                                Output:["_col0"]
+                                Filter Operator [FIL_55] (rows=8116 width=1119)
+                                  predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'2002-05-30 00:00:00' AND TIMESTAMP'2002-07-29 00:00:00' and d_date_sk is not null)
+                                  TableScan [TS_9] (rows=73049 width=1119)
+                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_date"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/cc294d32/ql/src/test/results/clientpositive/perf/tez/query99.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query99.q.out b/ql/src/test/results/clientpositive/perf/tez/query99.q.out
index 32fb96e..ec14e0a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query99.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query99.q.out
@@ -81,84 +81,86 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_81]
-        Limit [LIM_80] (rows=100 width=135)
+      File Output Operator [FS_82]
+        Limit [LIM_81] (rows=100 width=135)
           Number of rows:100
-          Select Operator [SEL_79] (rows=210822976 width=135)
+          Select Operator [SEL_80] (rows=210822976 width=135)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
           <-Reducer 6 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_78]
-              Select Operator [SEL_77] (rows=210822976 width=135)
+            SHUFFLE [RS_79]
+              Select Operator [SEL_78] (rows=210822976 width=135)
                 Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                Group By Operator [GBY_76] (rows=210822976 width=135)
+                Group By Operator [GBY_77] (rows=210822976 width=135)
                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)","sum(VALUE._col4)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Reducer 5 [SIMPLE_EDGE]
                   SHUFFLE [RS_30]
                     PartitionCols:_col0, _col1, _col2
                     Group By Operator [GBY_29] (rows=421645953 width=135)
                       Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col3)","sum(_col4)","sum(_col5)","sum(_col6)","sum(_col7)"],keys:_col0, _col1, _col2
-                      Select Operator [SEL_27] (rows=421645953 width=135)
-                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                        Merge Join Operator [MERGEJOIN_60] (rows=421645953 width=135)
-                          Conds:RS_24._col3=RS_75._col0(Inner),Output:["_col0","_col1","_col8","_col10","_col12"]
-                        <-Map 11 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_75]
-                            PartitionCols:_col0
-                            Select Operator [SEL_74] (rows=1 width=0)
-                              Output:["_col0","_col1"]
-                              Filter Operator [FIL_73] (rows=1 width=0)
-                                predicate:sm_ship_mode_sk is not null
-                                TableScan [TS_12] (rows=1 width=0)
-                                  default@ship_mode,ship_mode,Tbl:PARTIAL,Col:NONE,Output:["sm_ship_mode_sk","sm_type"]
-                        <-Reducer 4 [SIMPLE_EDGE]
-                          SHUFFLE [RS_24]
-                            PartitionCols:_col3
-                            Merge Join Operator [MERGEJOIN_59] (rows=383314495 width=135)
-                              Conds:RS_21._col4=RS_72._col0(Inner),Output:["_col0","_col1","_col3","_col8","_col10"]
-                            <-Map 10 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_72]
-                                PartitionCols:_col0
-                                Select Operator [SEL_71] (rows=27 width=1029)
-                                  Output:["_col0","_col1"]
-                                  Filter Operator [FIL_70] (rows=27 width=1029)
-                                    predicate:w_warehouse_sk is not null
-                                    TableScan [TS_9] (rows=27 width=1029)
-                                      default@warehouse,warehouse,Tbl:COMPLETE,Col:NONE,Output:["w_warehouse_sk","w_warehouse_name"]
-                            <-Reducer 3 [SIMPLE_EDGE]
-                              SHUFFLE [RS_21]
-                                PartitionCols:_col4
-                                Merge Join Operator [MERGEJOIN_58] (rows=348467716 width=135)
-                                  Conds:RS_18._col2=RS_69._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col8"]
-                                <-Map 9 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_69]
-                                    PartitionCols:_col0
-                                    Select Operator [SEL_68] (rows=60 width=2045)
-                                      Output:["_col0","_col1"]
-                                      Filter Operator [FIL_67] (rows=60 width=2045)
-                                        predicate:cc_call_center_sk is not null
-                                        TableScan [TS_6] (rows=60 width=2045)
-                                          default@call_center,call_center,Tbl:COMPLETE,Col:NONE,Output:["cc_call_center_sk","cc_name"]
-                                <-Reducer 2 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_18]
-                                    PartitionCols:_col2
-                                    Merge Join Operator [MERGEJOIN_57] (rows=316788826 width=135)
-                                      Conds:RS_63._col1=RS_66._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
-                                    <-Map 1 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_63]
-                                        PartitionCols:_col1
-                                        Select Operator [SEL_62] (rows=287989836 width=135)
-                                          Output:["_col0","_col1","_col2","_col3","_col4"]
-                                          Filter Operator [FIL_61] (rows=287989836 width=135)
-                                            predicate:(cs_call_center_sk is not null and cs_ship_date_sk is not null and cs_ship_mode_sk is not null and cs_warehouse_sk is not null)
-                                            TableScan [TS_0] (rows=287989836 width=135)
-                                              default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_ship_date_sk","cs_call_center_sk","cs_ship_mode_sk","cs_warehouse_sk"]
-                                    <-Map 8 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_66]
-                                        PartitionCols:_col0
-                                        Select Operator [SEL_65] (rows=8116 width=1119)
-                                          Output:["_col0"]
-                                          Filter Operator [FIL_64] (rows=8116 width=1119)
-                                            predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
-                                            TableScan [TS_3] (rows=73049 width=1119)
-                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_month_seq"]
+                      Top N Key Operator [TNK_57] (rows=421645953 width=135)
+                        keys:_col0, _col1, _col2,sort order:+++,top n:100
+                        Select Operator [SEL_27] (rows=421645953 width=135)
+                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                          Merge Join Operator [MERGEJOIN_61] (rows=421645953 width=135)
+                            Conds:RS_24._col3=RS_76._col0(Inner),Output:["_col0","_col1","_col8","_col10","_col12"]
+                          <-Map 11 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_76]
+                              PartitionCols:_col0
+                              Select Operator [SEL_75] (rows=1 width=0)
+                                Output:["_col0","_col1"]
+                                Filter Operator [FIL_74] (rows=1 width=0)
+                                  predicate:sm_ship_mode_sk is not null
+                                  TableScan [TS_12] (rows=1 width=0)
+                                    default@ship_mode,ship_mode,Tbl:PARTIAL,Col:NONE,Output:["sm_ship_mode_sk","sm_type"]
+                          <-Reducer 4 [SIMPLE_EDGE]
+                            SHUFFLE [RS_24]
+                              PartitionCols:_col3
+                              Merge Join Operator [MERGEJOIN_60] (rows=383314495 width=135)
+                                Conds:RS_21._col4=RS_73._col0(Inner),Output:["_col0","_col1","_col3","_col8","_col10"]
+                              <-Map 10 [SIMPLE_EDGE] vectorized
+                                SHUFFLE [RS_73]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_72] (rows=27 width=1029)
+                                    Output:["_col0","_col1"]
+                                    Filter Operator [FIL_71] (rows=27 width=1029)
+                                      predicate:w_warehouse_sk is not null
+                                      TableScan [TS_9] (rows=27 width=1029)
+                                        default@warehouse,warehouse,Tbl:COMPLETE,Col:NONE,Output:["w_warehouse_sk","w_warehouse_name"]
+                              <-Reducer 3 [SIMPLE_EDGE]
+                                SHUFFLE [RS_21]
+                                  PartitionCols:_col4
+                                  Merge Join Operator [MERGEJOIN_59] (rows=348467716 width=135)
+                                    Conds:RS_18._col2=RS_70._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col8"]
+                                  <-Map 9 [SIMPLE_EDGE] vectorized
+                                    SHUFFLE [RS_70]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_69] (rows=60 width=2045)
+                                        Output:["_col0","_col1"]
+                                        Filter Operator [FIL_68] (rows=60 width=2045)
+                                          predicate:cc_call_center_sk is not null
+                                          TableScan [TS_6] (rows=60 width=2045)
+                                            default@call_center,call_center,Tbl:COMPLETE,Col:NONE,Output:["cc_call_center_sk","cc_name"]
+                                  <-Reducer 2 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_18]
+                                      PartitionCols:_col2
+                                      Merge Join Operator [MERGEJOIN_58] (rows=316788826 width=135)
+                                        Conds:RS_64._col1=RS_67._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
+                                      <-Map 1 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_64]
+                                          PartitionCols:_col1
+                                          Select Operator [SEL_63] (rows=287989836 width=135)
+                                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                                            Filter Operator [FIL_62] (rows=287989836 width=135)
+                                              predicate:(cs_call_center_sk is not null and cs_ship_date_sk is not null and cs_ship_mode_sk is not null and cs_warehouse_sk is not null)
+                                              TableScan [TS_0] (rows=287989836 width=135)
+                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_ship_date_sk","cs_call_center_sk","cs_ship_mode_sk","cs_warehouse_sk"]
+                                      <-Map 8 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_67]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_66] (rows=8116 width=1119)
+                                            Output:["_col0"]
+                                            Filter Operator [FIL_65] (rows=8116 width=1119)
+                                              predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
+                                              TableScan [TS_3] (rows=73049 width=1119)
+                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_month_seq"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/cc294d32/ql/src/test/results/clientpositive/tez/topnkey.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/topnkey.q.out b/ql/src/test/results/clientpositive/tez/topnkey.q.out
new file mode 100644
index 0000000..66b9191
--- /dev/null
+++ b/ql/src/test/results/clientpositive/tez/topnkey.q.out
@@ -0,0 +1,162 @@
+PREHOOK: query: EXPLAIN
+SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:5
+    Stage-1
+      Reducer 3
+      File Output Operator [FS_10]
+        Limit [LIM_9] (rows=5 width=95)
+          Number of rows:5
+          Select Operator [SEL_8] (rows=250 width=95)
+            Output:["_col0","_col1"]
+          <-Reducer 2 [SIMPLE_EDGE]
+            SHUFFLE [RS_7]
+              Group By Operator [GBY_5] (rows=250 width=95)
+                Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+              <-Map 1 [SIMPLE_EDGE]
+                SHUFFLE [RS_4]
+                  PartitionCols:_col0
+                  Group By Operator [GBY_3] (rows=250 width=95)
+                    Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
+                    Top N Key Operator [TNK_11] (rows=500 width=178)
+                      keys:_col0,sort order:+,top n:5
+                      Select Operator [SEL_1] (rows=500 width=178)
+                        Output:["_col0","_col1"]
+                        TableScan [TS_0] (rows=500 width=178)
+                          default@src,src,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
+
+PREHOOK: query: SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+0	0
+10	10
+100	200
+103	206
+104	208
+PREHOOK: query: EXPLAIN
+SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:5
+    Stage-1
+      Reducer 3
+      File Output Operator [FS_9]
+        Limit [LIM_8] (rows=5 width=87)
+          Number of rows:5
+          Select Operator [SEL_7] (rows=250 width=87)
+            Output:["_col0"]
+          <-Reducer 2 [SIMPLE_EDGE]
+            SHUFFLE [RS_6]
+              Group By Operator [GBY_4] (rows=250 width=87)
+                Output:["_col0"],keys:KEY._col0
+              <-Map 1 [SIMPLE_EDGE]
+                SHUFFLE [RS_3]
+                  PartitionCols:_col0
+                  Group By Operator [GBY_2] (rows=250 width=87)
+                    Output:["_col0"],keys:key
+                    Top N Key Operator [TNK_10] (rows=500 width=87)
+                      keys:key,sort order:+,top n:5
+                      Select Operator [SEL_1] (rows=500 width=87)
+                        Output:["key"]
+                        TableScan [TS_0] (rows=500 width=87)
+                          default@src,src,Tbl:COMPLETE,Col:COMPLETE,Output:["key"]
+
+PREHOOK: query: SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+0
+10
+100
+103
+104
+PREHOOK: query: explain vectorization detail
+SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+PREHOOK: type: QUERY
+POSTHOOK: query: explain vectorization detail
+SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 4 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:5
+    Stage-1
+      Reducer 3
+      File Output Operator [FS_13]
+        Limit [LIM_12] (rows=5 width=178)
+          Number of rows:5
+          Select Operator [SEL_11] (rows=791 width=178)
+            Output:["_col0","_col1"]
+          <-Reducer 2 [SIMPLE_EDGE]
+            SHUFFLE [RS_10]
+              Select Operator [SEL_9] (rows=791 width=178)
+                Output:["_col0","_col1"]
+                Merge Join Operator [MERGEJOIN_28] (rows=791 width=178)
+                  Conds:RS_6._col0=RS_7._col0(Inner),Output:["_col0","_col2"]
+                <-Map 1 [SIMPLE_EDGE]
+                  SHUFFLE [RS_6]
+                    PartitionCols:_col0
+                    Select Operator [SEL_2] (rows=500 width=87)
+                      Output:["_col0"]
+                      Filter Operator [FIL_16] (rows=500 width=87)
+                        predicate:key is not null
+                        TableScan [TS_0] (rows=500 width=87)
+                          default@src,src1,Tbl:COMPLETE,Col:COMPLETE,Output:["key"]
+                <-Map 4 [SIMPLE_EDGE]
+                  SHUFFLE [RS_7]
+                    PartitionCols:_col0
+                    Select Operator [SEL_5] (rows=500 width=178)
+                      Output:["_col0","_col1"]
+                      Filter Operator [FIL_17] (rows=500 width=178)
+                        predicate:key is not null
+                        TableScan [TS_3] (rows=500 width=178)
+                          default@src,src2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
+
+PREHOOK: query: SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+0	val_0
+0	val_0
+0	val_0
+0	val_0
+0	val_0

http://git-wip-us.apache.org/repos/asf/hive/blob/cc294d32/ql/src/test/results/clientpositive/tez/vector_topnkey.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/vector_topnkey.q.out b/ql/src/test/results/clientpositive/tez/vector_topnkey.q.out
new file mode 100644
index 0000000..d6f7cc2
--- /dev/null
+++ b/ql/src/test/results/clientpositive/tez/vector_topnkey.q.out
@@ -0,0 +1,162 @@
+PREHOOK: query: explain vectorization detail
+SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+POSTHOOK: query: explain vectorization detail
+SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:5
+    Stage-1
+      Reducer 3 vectorized
+      File Output Operator [FS_20]
+        Limit [LIM_19] (rows=5 width=95)
+          Number of rows:5
+          Select Operator [SEL_18] (rows=250 width=95)
+            Output:["_col0","_col1"]
+          <-Reducer 2 [SIMPLE_EDGE] vectorized
+            SHUFFLE [RS_17]
+              Group By Operator [GBY_16] (rows=250 width=95)
+                Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+              <-Map 1 [SIMPLE_EDGE] vectorized
+                SHUFFLE [RS_15]
+                  PartitionCols:_col0
+                  Group By Operator [GBY_14] (rows=250 width=95)
+                    Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
+                    Top N Key Operator [TNK_13] (rows=500 width=178)
+                      keys:_col0,sort order:+,top n:5
+                      Select Operator [SEL_12] (rows=500 width=178)
+                        Output:["_col0","_col1"]
+                        TableScan [TS_0] (rows=500 width=178)
+                          default@src,src,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
+
+PREHOOK: query: SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT key, SUM(CAST(SUBSTR(value,5) AS INT)) FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+0	0
+10	10
+100	200
+103	206
+104	208
+PREHOOK: query: explain vectorization detail
+SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+POSTHOOK: query: explain vectorization detail
+SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:5
+    Stage-1
+      Reducer 3 vectorized
+      File Output Operator [FS_19]
+        Limit [LIM_18] (rows=5 width=87)
+          Number of rows:5
+          Select Operator [SEL_17] (rows=250 width=87)
+            Output:["_col0"]
+          <-Reducer 2 [SIMPLE_EDGE] vectorized
+            SHUFFLE [RS_16]
+              Group By Operator [GBY_15] (rows=250 width=87)
+                Output:["_col0"],keys:KEY._col0
+              <-Map 1 [SIMPLE_EDGE] vectorized
+                SHUFFLE [RS_14]
+                  PartitionCols:_col0
+                  Group By Operator [GBY_13] (rows=250 width=87)
+                    Output:["_col0"],keys:key
+                    Top N Key Operator [TNK_12] (rows=500 width=87)
+                      keys:key,sort order:+,top n:5
+                      Select Operator [SEL_11] (rows=500 width=87)
+                        Output:["key"]
+                        TableScan [TS_0] (rows=500 width=87)
+                          default@src,src,Tbl:COMPLETE,Col:COMPLETE,Output:["key"]
+
+PREHOOK: query: SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT key FROM src GROUP BY key ORDER BY key LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+0
+10
+100
+103
+104
+PREHOOK: query: explain vectorization detail
+SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+PREHOOK: type: QUERY
+POSTHOOK: query: explain vectorization detail
+SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 4 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:5
+    Stage-1
+      Reducer 3 vectorized
+      File Output Operator [FS_37]
+        Limit [LIM_36] (rows=5 width=178)
+          Number of rows:5
+          Select Operator [SEL_35] (rows=791 width=178)
+            Output:["_col0","_col1"]
+          <-Reducer 2 [SIMPLE_EDGE]
+            SHUFFLE [RS_10]
+              Select Operator [SEL_9] (rows=791 width=178)
+                Output:["_col0","_col1"]
+                Merge Join Operator [MERGEJOIN_28] (rows=791 width=178)
+                  Conds:RS_31._col0=RS_34._col0(Inner),Output:["_col0","_col2"]
+                <-Map 1 [SIMPLE_EDGE] vectorized
+                  SHUFFLE [RS_31]
+                    PartitionCols:_col0
+                    Select Operator [SEL_30] (rows=500 width=87)
+                      Output:["_col0"]
+                      Filter Operator [FIL_29] (rows=500 width=87)
+                        predicate:key is not null
+                        TableScan [TS_0] (rows=500 width=87)
+                          default@src,src1,Tbl:COMPLETE,Col:COMPLETE,Output:["key"]
+                <-Map 4 [SIMPLE_EDGE] vectorized
+                  SHUFFLE [RS_34]
+                    PartitionCols:_col0
+                    Select Operator [SEL_33] (rows=500 width=178)
+                      Output:["_col0","_col1"]
+                      Filter Operator [FIL_32] (rows=500 width=178)
+                        predicate:key is not null
+                        TableScan [TS_3] (rows=500 width=178)
+                          default@src,src2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
+
+PREHOOK: query: SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT src1.key, src2.value FROM src src1 JOIN src src2 ON (src1.key = src2.key) ORDER BY src1.key LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+0	val_0
+0	val_0
+0	val_0
+0	val_0
+0	val_0