http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/explainuser_2.q.out 
b/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
index 3675d8d..5f5f5f6 100644
--- a/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
@@ -303,124 +303,126 @@ Stage-0
     limit:100
     Stage-1
       Reducer 5 vectorized, llap
-      File Output Operator [FS_216]
-        Limit [LIM_215] (rows=12 width=285)
+      File Output Operator [FS_217]
+        Limit [LIM_216] (rows=12 width=285)
           Number of rows:100
-          Select Operator [SEL_214] (rows=12 width=285)
+          Select Operator [SEL_215] (rows=12 width=285)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
           <-Reducer 4 [SIMPLE_EDGE] vectorized, llap
-            SHUFFLE [RS_213]
-              Group By Operator [GBY_212] (rows=12 width=285)
+            SHUFFLE [RS_214]
+              Group By Operator [GBY_213] (rows=12 width=285)
                 
Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(VALUE._col0)","count(VALUE._col1)","count(VALUE._col2)"],keys:KEY._col0,
 KEY._col1, KEY._col2
               <-Reducer 3 [SIMPLE_EDGE] llap
                 SHUFFLE [RS_49]
                   PartitionCols:_col0, _col1, _col2
                   Group By Operator [GBY_48] (rows=12 width=285)
                     
Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(_col11)","count(_col21)","count(_col3)"],keys:_col10,
 _col20, _col2
-                    Merge Join Operator [MERGEJOIN_187] (rows=9275 width=534)
-                      Conds:RS_44._col1, _col3=RS_45._col15, 
_col17(Inner),Output:["_col2","_col3","_col10","_col11","_col20","_col21"]
-                    <-Reducer 10 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_45]
-                        PartitionCols:_col15, _col17
-                        Select Operator [SEL_40] (rows=420 width=447)
-                          Output:["_col4","_col5","_col14","_col15","_col17"]
-                          Merge Join Operator [MERGEJOIN_186] (rows=420 
width=447)
-                            Conds:RS_37._col4, _col2=RS_38._col4, 
_col2(Inner),Output:["_col0","_col1","_col14","_col15","_col17"]
-                          <-Reducer 11 [SIMPLE_EDGE] llap
-                            SHUFFLE [RS_38]
-                              PartitionCols:_col4, _col2
-                              Merge Join Operator [MERGEJOIN_185] (rows=10 
width=356)
-                                
Conds:RS_211._col0=RS_199._col0(Inner),Output:["_col2","_col3","_col4","_col5"]
-                              <-Map 6 [SIMPLE_EDGE] vectorized, llap
-                                SHUFFLE [RS_199]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_196] (rows=25 width=178)
-                                    Output:["_col0"]
-                                    Filter Operator [FIL_193] (rows=25 
width=178)
-                                      predicate:((value) IN ('2000Q1', 
'2000Q2', '2000Q3') and key is not null)
-                                      TableScan [TS_3] (rows=500 width=178)
-                                        
default@src,d3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
-                              <-Map 15 [SIMPLE_EDGE] vectorized, llap
-                                SHUFFLE [RS_211]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_210] (rows=7 width=531)
-                                    
Output:["_col0","_col2","_col3","_col4","_col5"]
-                                    Filter Operator [FIL_209] (rows=7 
width=534)
-                                      predicate:((v1 = 'srv1') and k1 is not 
null and k2 is not null and k3 is not null and v2 is not null and v3 is not 
null)
-                                      TableScan [TS_18] (rows=85 width=534)
-                                        
default@sr,sr,Tbl:COMPLETE,Col:COMPLETE,Output:["k1","v1","k2","v2","k3","v3"]
-                          <-Reducer 9 [SIMPLE_EDGE] llap
-                            SHUFFLE [RS_37]
-                              PartitionCols:_col4, _col2
-                              Merge Join Operator [MERGEJOIN_184] (rows=42 
width=352)
-                                
Conds:RS_34._col1=RS_208._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
-                              <-Map 14 [SIMPLE_EDGE] vectorized, llap
-                                SHUFFLE [RS_208]
-                                  PartitionCols:_col1
-                                  Select Operator [SEL_207] (rows=2 width=180)
-                                    Output:["_col1"]
-                                    Filter Operator [FIL_206] (rows=2 
width=175)
-                                      predicate:((key = 'src1key') and value 
is not null)
-                                      TableScan [TS_15] (rows=25 width=175)
-                                        
default@src1,src1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
-                              <-Reducer 8 [SIMPLE_EDGE] llap
-                                SHUFFLE [RS_34]
-                                  PartitionCols:_col1
-                                  Merge Join Operator [MERGEJOIN_183] (rows=42 
width=352)
-                                    
Conds:RS_31._col3=RS_205._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
-                                  <-Map 13 [SIMPLE_EDGE] vectorized, llap
-                                    SHUFFLE [RS_205]
-                                      PartitionCols:_col1
-                                      Select Operator [SEL_204] (rows=6 
width=185)
-                                        Output:["_col1"]
-                                        Filter Operator [FIL_203] (rows=6 
width=178)
-                                          predicate:((key = 'srcpartkey') and 
value is not null)
-                                          TableScan [TS_12] (rows=2000 
width=178)
-                                            
default@srcpart,srcpart,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
-                                  <-Reducer 7 [SIMPLE_EDGE] llap
-                                    SHUFFLE [RS_31]
-                                      PartitionCols:_col3
-                                      Merge Join Operator [MERGEJOIN_182] 
(rows=7 width=443)
-                                        
Conds:RS_202._col0=RS_198._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
-                                      <-Map 6 [SIMPLE_EDGE] vectorized, llap
-                                        SHUFFLE [RS_198]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_195] (rows=2 
width=178)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_192] (rows=2 
width=178)
-                                              predicate:((value = 'd1value') 
and key is not null)
-                                               Please refer to the previous 
TableScan [TS_3]
-                                      <-Map 12 [SIMPLE_EDGE] vectorized, llap
-                                        SHUFFLE [RS_202]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_201] (rows=7 
width=531)
-                                            
Output:["_col0","_col1","_col2","_col3","_col4"]
-                                            Filter Operator [FIL_200] (rows=7 
width=534)
-                                              predicate:((v3 = 'ssv3') and k1 
is not null and k2 is not null and k3 is not null and v1 is not null and v2 is 
not null)
-                                              TableScan [TS_6] (rows=85 
width=534)
-                                                
default@ss_n1,ss_n1,Tbl:COMPLETE,Col:COMPLETE,Output:["k1","v1","k2","v2","k3","v3"]
-                    <-Reducer 2 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_44]
-                        PartitionCols:_col1, _col3
-                        Merge Join Operator [MERGEJOIN_181] (rows=265 
width=269)
-                          
Conds:RS_190._col0=RS_197._col0(Inner),Output:["_col1","_col2","_col3"]
-                        <-Map 6 [SIMPLE_EDGE] vectorized, llap
-                          SHUFFLE [RS_197]
-                            PartitionCols:_col0
-                            Select Operator [SEL_194] (rows=25 width=178)
-                              Output:["_col0"]
-                              Filter Operator [FIL_191] (rows=25 width=178)
-                                predicate:((value) IN ('2000Q1', '2000Q2', 
'2000Q3') and key is not null)
-                                 Please refer to the previous TableScan [TS_3]
-                        <-Map 1 [SIMPLE_EDGE] vectorized, llap
-                          SHUFFLE [RS_190]
-                            PartitionCols:_col0
-                            Select Operator [SEL_189] (rows=170 width=356)
-                              Output:["_col0","_col1","_col2","_col3"]
-                              Filter Operator [FIL_188] (rows=170 width=356)
-                                predicate:(k1 is not null and v2 is not null 
and v3 is not null)
-                                TableScan [TS_0] (rows=170 width=356)
-                                  
default@cs,cs,Tbl:COMPLETE,Col:COMPLETE,Output:["k1","v2","k3","v3"]
+                    Top N Key Operator [TNK_91] (rows=9275 width=534)
+                      keys:_col10, _col20, _col2,sort order:+++,top n:100
+                      Merge Join Operator [MERGEJOIN_188] (rows=9275 width=534)
+                        Conds:RS_44._col1, _col3=RS_45._col15, 
_col17(Inner),Output:["_col2","_col3","_col10","_col11","_col20","_col21"]
+                      <-Reducer 10 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_45]
+                          PartitionCols:_col15, _col17
+                          Select Operator [SEL_40] (rows=420 width=447)
+                            Output:["_col4","_col5","_col14","_col15","_col17"]
+                            Merge Join Operator [MERGEJOIN_187] (rows=420 
width=447)
+                              Conds:RS_37._col4, _col2=RS_38._col4, 
_col2(Inner),Output:["_col0","_col1","_col14","_col15","_col17"]
+                            <-Reducer 11 [SIMPLE_EDGE] llap
+                              SHUFFLE [RS_38]
+                                PartitionCols:_col4, _col2
+                                Merge Join Operator [MERGEJOIN_186] (rows=10 
width=356)
+                                  
Conds:RS_212._col0=RS_200._col0(Inner),Output:["_col2","_col3","_col4","_col5"]
+                                <-Map 6 [SIMPLE_EDGE] vectorized, llap
+                                  SHUFFLE [RS_200]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_197] (rows=25 
width=178)
+                                      Output:["_col0"]
+                                      Filter Operator [FIL_194] (rows=25 
width=178)
+                                        predicate:((value) IN ('2000Q1', 
'2000Q2', '2000Q3') and key is not null)
+                                        TableScan [TS_3] (rows=500 width=178)
+                                          
default@src,d3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
+                                <-Map 15 [SIMPLE_EDGE] vectorized, llap
+                                  SHUFFLE [RS_212]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_211] (rows=7 
width=531)
+                                      
Output:["_col0","_col2","_col3","_col4","_col5"]
+                                      Filter Operator [FIL_210] (rows=7 
width=534)
+                                        predicate:((v1 = 'srv1') and k1 is not 
null and k2 is not null and k3 is not null and v2 is not null and v3 is not 
null)
+                                        TableScan [TS_18] (rows=85 width=534)
+                                          
default@sr,sr,Tbl:COMPLETE,Col:COMPLETE,Output:["k1","v1","k2","v2","k3","v3"]
+                            <-Reducer 9 [SIMPLE_EDGE] llap
+                              SHUFFLE [RS_37]
+                                PartitionCols:_col4, _col2
+                                Merge Join Operator [MERGEJOIN_185] (rows=42 
width=352)
+                                  
Conds:RS_34._col1=RS_209._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                                <-Map 14 [SIMPLE_EDGE] vectorized, llap
+                                  SHUFFLE [RS_209]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_208] (rows=2 
width=180)
+                                      Output:["_col1"]
+                                      Filter Operator [FIL_207] (rows=2 
width=175)
+                                        predicate:((key = 'src1key') and value 
is not null)
+                                        TableScan [TS_15] (rows=25 width=175)
+                                          
default@src1,src1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
+                                <-Reducer 8 [SIMPLE_EDGE] llap
+                                  SHUFFLE [RS_34]
+                                    PartitionCols:_col1
+                                    Merge Join Operator [MERGEJOIN_184] 
(rows=42 width=352)
+                                      
Conds:RS_31._col3=RS_206._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                                    <-Map 13 [SIMPLE_EDGE] vectorized, llap
+                                      SHUFFLE [RS_206]
+                                        PartitionCols:_col1
+                                        Select Operator [SEL_205] (rows=6 
width=185)
+                                          Output:["_col1"]
+                                          Filter Operator [FIL_204] (rows=6 
width=178)
+                                            predicate:((key = 'srcpartkey') 
and value is not null)
+                                            TableScan [TS_12] (rows=2000 
width=178)
+                                              
default@srcpart,srcpart,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
+                                    <-Reducer 7 [SIMPLE_EDGE] llap
+                                      SHUFFLE [RS_31]
+                                        PartitionCols:_col3
+                                        Merge Join Operator [MERGEJOIN_183] 
(rows=7 width=443)
+                                          
Conds:RS_203._col0=RS_199._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
+                                        <-Map 6 [SIMPLE_EDGE] vectorized, llap
+                                          SHUFFLE [RS_199]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_196] (rows=2 
width=178)
+                                              Output:["_col0"]
+                                              Filter Operator [FIL_193] 
(rows=2 width=178)
+                                                predicate:((value = 'd1value') 
and key is not null)
+                                                 Please refer to the previous 
TableScan [TS_3]
+                                        <-Map 12 [SIMPLE_EDGE] vectorized, llap
+                                          SHUFFLE [RS_203]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_202] (rows=7 
width=531)
+                                              
Output:["_col0","_col1","_col2","_col3","_col4"]
+                                              Filter Operator [FIL_201] 
(rows=7 width=534)
+                                                predicate:((v3 = 'ssv3') and 
k1 is not null and k2 is not null and k3 is not null and v1 is not null and v2 
is not null)
+                                                TableScan [TS_6] (rows=85 
width=534)
+                                                  
default@ss_n1,ss_n1,Tbl:COMPLETE,Col:COMPLETE,Output:["k1","v1","k2","v2","k3","v3"]
+                      <-Reducer 2 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_44]
+                          PartitionCols:_col1, _col3
+                          Merge Join Operator [MERGEJOIN_182] (rows=265 
width=269)
+                            
Conds:RS_191._col0=RS_198._col0(Inner),Output:["_col1","_col2","_col3"]
+                          <-Map 6 [SIMPLE_EDGE] vectorized, llap
+                            SHUFFLE [RS_198]
+                              PartitionCols:_col0
+                              Select Operator [SEL_195] (rows=25 width=178)
+                                Output:["_col0"]
+                                Filter Operator [FIL_192] (rows=25 width=178)
+                                  predicate:((value) IN ('2000Q1', '2000Q2', 
'2000Q3') and key is not null)
+                                   Please refer to the previous TableScan 
[TS_3]
+                          <-Map 1 [SIMPLE_EDGE] vectorized, llap
+                            SHUFFLE [RS_191]
+                              PartitionCols:_col0
+                              Select Operator [SEL_190] (rows=170 width=356)
+                                Output:["_col0","_col1","_col2","_col3"]
+                                Filter Operator [FIL_189] (rows=170 width=356)
+                                  predicate:(k1 is not null and v2 is not null 
and v3 is not null)
+                                  TableScan [TS_0] (rows=170 width=356)
+                                    
default@cs,cs,Tbl:COMPLETE,Col:COMPLETE,Output:["k1","v2","k3","v3"]
 
 PREHOOK: query: explain
 SELECT x.key, z.value, y.value
@@ -992,105 +994,107 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7 vectorized, llap
-      File Output Operator [FS_232]
-        Limit [LIM_231] (rows=100 width=10)
+      File Output Operator [FS_234]
+        Limit [LIM_233] (rows=100 width=10)
           Number of rows:100
-          Select Operator [SEL_230] (rows=732 width=10)
+          Select Operator [SEL_232] (rows=732 width=10)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
           <-Reducer 6 [SIMPLE_EDGE] vectorized, llap
-            SHUFFLE [RS_229]
-              Group By Operator [GBY_228] (rows=732 width=10)
+            SHUFFLE [RS_231]
+              Group By Operator [GBY_230] (rows=732 width=10)
                 
Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(VALUE._col0)","count(VALUE._col1)","count(VALUE._col2)"],keys:KEY._col0,
 KEY._col1, KEY._col2
               <-Map 5 [SIMPLE_EDGE] vectorized, llap
-                SHUFFLE [RS_227]
+                SHUFFLE [RS_229]
                   PartitionCols:_col0, _col1, _col2
-                  Group By Operator [GBY_226] (rows=1464 width=10)
+                  Group By Operator [GBY_228] (rows=1464 width=10)
                     
Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(_col11)","count(_col21)","count(_col3)"],keys:_col10,
 _col20, _col2
-                    Map Join Operator [MAPJOIN_225] (rows=1464 width=10)
-                      Conds:RS_208._col1, _col3=SEL_224._col15, 
_col17(Inner),Output:["_col2","_col3","_col10","_col11","_col20","_col21"]
-                    <-Map 2 [BROADCAST_EDGE] vectorized, llap
-                      BROADCAST [RS_208]
-                        PartitionCols:_col1, _col3
-                        Map Join Operator [MAPJOIN_207] (rows=275 width=10)
-                          
Conds:RS_204._col0=SEL_206._col0(Inner),Output:["_col1","_col2","_col3"]
-                        <-Map 1 [BROADCAST_EDGE] vectorized, llap
-                          BROADCAST [RS_204]
-                            PartitionCols:_col0
-                            Select Operator [SEL_203] (rows=170 width=34)
-                              Output:["_col0","_col1","_col2","_col3"]
-                              Filter Operator [FIL_202] (rows=170 width=34)
-                                predicate:(k1 is not null and v2 is not null 
and v3 is not null)
-                                TableScan [TS_0] (rows=170 width=34)
-                                  
default@cs,cs,Tbl:COMPLETE,Col:NONE,Output:["k1","v2","k3","v3"]
-                        <-Select Operator [SEL_206] (rows=250 width=10)
-                            Output:["_col0"]
-                            Filter Operator [FIL_205] (rows=250 width=10)
-                              predicate:((value) IN ('2000Q1', '2000Q2', 
'2000Q3') and key is not null)
-                              TableScan [TS_3] (rows=500 width=10)
-                                
default@src,d3,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
-                    <-Select Operator [SEL_224] (rows=1331 width=10)
-                        Output:["_col4","_col5","_col14","_col15","_col17"]
-                        Map Join Operator [MAPJOIN_223] (rows=1331 width=10)
-                          Conds:MAPJOIN_222._col4, _col2=RS_218._col4, 
_col2(Inner),Output:["_col0","_col1","_col14","_col15","_col17"]
-                        <-Map 10 [BROADCAST_EDGE] vectorized, llap
-                          BROADCAST [RS_218]
-                            PartitionCols:_col4, _col2
-                            Map Join Operator [MAPJOIN_217] (rows=275 width=10)
-                              
Conds:RS_214._col0=SEL_216._col0(Inner),Output:["_col2","_col3","_col4","_col5"]
-                            <-Map 9 [BROADCAST_EDGE] vectorized, llap
-                              BROADCAST [RS_214]
-                                PartitionCols:_col0
-                                Select Operator [SEL_213] (rows=42 width=34)
-                                  
Output:["_col0","_col2","_col3","_col4","_col5"]
-                                  Filter Operator [FIL_212] (rows=42 width=34)
-                                    predicate:((v1 = 'srv1') and k1 is not 
null and k2 is not null and k3 is not null and v2 is not null and v3 is not 
null)
-                                    TableScan [TS_18] (rows=85 width=34)
-                                      
default@sr,sr,Tbl:COMPLETE,Col:NONE,Output:["k1","v1","k2","v2","k3","v3"]
-                            <-Select Operator [SEL_216] (rows=250 width=10)
-                                Output:["_col0"]
-                                Filter Operator [FIL_215] (rows=250 width=10)
-                                  predicate:((value) IN ('2000Q1', '2000Q2', 
'2000Q3') and key is not null)
-                                  TableScan [TS_21] (rows=500 width=10)
-                                    
default@src,d2,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
-                        <-Map Join Operator [MAPJOIN_222] (rows=1210 width=10)
-                            
Conds:MAPJOIN_221._col1=RS_211._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
-                          <-Map 8 [BROADCAST_EDGE] vectorized, llap
-                            BROADCAST [RS_211]
-                              PartitionCols:_col1
-                              Select Operator [SEL_210] (rows=12 width=7)
-                                Output:["_col1"]
-                                Filter Operator [FIL_209] (rows=12 width=7)
-                                  predicate:((key = 'src1key') and value is 
not null)
-                                  TableScan [TS_15] (rows=25 width=7)
-                                    
default@src1,src1,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
-                          <-Map Join Operator [MAPJOIN_221] (rows=1100 
width=10)
-                              
Conds:RS_201._col3=SEL_220._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
-                            <-Map 4 [BROADCAST_EDGE] vectorized, llap
-                              BROADCAST [RS_201]
-                                PartitionCols:_col3
-                                Map Join Operator [MAPJOIN_200] (rows=275 
width=10)
-                                  
Conds:RS_197._col0=SEL_199._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
-                                <-Map 3 [BROADCAST_EDGE] vectorized, llap
-                                  BROADCAST [RS_197]
-                                    PartitionCols:_col0
-                                    Select Operator [SEL_196] (rows=42 
width=34)
-                                      
Output:["_col0","_col1","_col2","_col3","_col4"]
-                                      Filter Operator [FIL_195] (rows=42 
width=34)
-                                        predicate:((v3 = 'ssv3') and k1 is not 
null and k2 is not null and k3 is not null and v1 is not null and v2 is not 
null)
-                                        TableScan [TS_6] (rows=85 width=34)
-                                          
default@ss_n1,ss_n1,Tbl:COMPLETE,Col:NONE,Output:["k1","v1","k2","v2","k3","v3"]
-                                <-Select Operator [SEL_199] (rows=250 width=10)
-                                    Output:["_col0"]
-                                    Filter Operator [FIL_198] (rows=250 
width=10)
-                                      predicate:((value = 'd1value') and key 
is not null)
-                                      TableScan [TS_9] (rows=500 width=10)
-                                        
default@src,d1,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
-                            <-Select Operator [SEL_220] (rows=1000 width=10)
-                                Output:["_col1"]
-                                Filter Operator [FIL_219] (rows=1000 width=10)
-                                  predicate:((key = 'srcpartkey') and value is 
not null)
-                                  TableScan [TS_12] (rows=2000 width=10)
-                                    
default@srcpart,srcpart,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
+                    Top N Key Operator [TNK_227] (rows=1464 width=10)
+                      keys:_col10, _col20, _col2,sort order:+++,top n:100
+                      Map Join Operator [MAPJOIN_226] (rows=1464 width=10)
+                        Conds:RS_209._col1, _col3=SEL_225._col15, 
_col17(Inner),Output:["_col2","_col3","_col10","_col11","_col20","_col21"]
+                      <-Map 2 [BROADCAST_EDGE] vectorized, llap
+                        BROADCAST [RS_209]
+                          PartitionCols:_col1, _col3
+                          Map Join Operator [MAPJOIN_208] (rows=275 width=10)
+                            
Conds:RS_205._col0=SEL_207._col0(Inner),Output:["_col1","_col2","_col3"]
+                          <-Map 1 [BROADCAST_EDGE] vectorized, llap
+                            BROADCAST [RS_205]
+                              PartitionCols:_col0
+                              Select Operator [SEL_204] (rows=170 width=34)
+                                Output:["_col0","_col1","_col2","_col3"]
+                                Filter Operator [FIL_203] (rows=170 width=34)
+                                  predicate:(k1 is not null and v2 is not null 
and v3 is not null)
+                                  TableScan [TS_0] (rows=170 width=34)
+                                    
default@cs,cs,Tbl:COMPLETE,Col:NONE,Output:["k1","v2","k3","v3"]
+                          <-Select Operator [SEL_207] (rows=250 width=10)
+                              Output:["_col0"]
+                              Filter Operator [FIL_206] (rows=250 width=10)
+                                predicate:((value) IN ('2000Q1', '2000Q2', 
'2000Q3') and key is not null)
+                                TableScan [TS_3] (rows=500 width=10)
+                                  
default@src,d3,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
+                      <-Select Operator [SEL_225] (rows=1331 width=10)
+                          Output:["_col4","_col5","_col14","_col15","_col17"]
+                          Map Join Operator [MAPJOIN_224] (rows=1331 width=10)
+                            Conds:MAPJOIN_223._col4, _col2=RS_219._col4, 
_col2(Inner),Output:["_col0","_col1","_col14","_col15","_col17"]
+                          <-Map 10 [BROADCAST_EDGE] vectorized, llap
+                            BROADCAST [RS_219]
+                              PartitionCols:_col4, _col2
+                              Map Join Operator [MAPJOIN_218] (rows=275 
width=10)
+                                
Conds:RS_215._col0=SEL_217._col0(Inner),Output:["_col2","_col3","_col4","_col5"]
+                              <-Map 9 [BROADCAST_EDGE] vectorized, llap
+                                BROADCAST [RS_215]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_214] (rows=42 width=34)
+                                    
Output:["_col0","_col2","_col3","_col4","_col5"]
+                                    Filter Operator [FIL_213] (rows=42 
width=34)
+                                      predicate:((v1 = 'srv1') and k1 is not 
null and k2 is not null and k3 is not null and v2 is not null and v3 is not 
null)
+                                      TableScan [TS_18] (rows=85 width=34)
+                                        
default@sr,sr,Tbl:COMPLETE,Col:NONE,Output:["k1","v1","k2","v2","k3","v3"]
+                              <-Select Operator [SEL_217] (rows=250 width=10)
+                                  Output:["_col0"]
+                                  Filter Operator [FIL_216] (rows=250 width=10)
+                                    predicate:((value) IN ('2000Q1', '2000Q2', 
'2000Q3') and key is not null)
+                                    TableScan [TS_21] (rows=500 width=10)
+                                      
default@src,d2,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
+                          <-Map Join Operator [MAPJOIN_223] (rows=1210 
width=10)
+                              
Conds:MAPJOIN_222._col1=RS_212._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                            <-Map 8 [BROADCAST_EDGE] vectorized, llap
+                              BROADCAST [RS_212]
+                                PartitionCols:_col1
+                                Select Operator [SEL_211] (rows=12 width=7)
+                                  Output:["_col1"]
+                                  Filter Operator [FIL_210] (rows=12 width=7)
+                                    predicate:((key = 'src1key') and value is 
not null)
+                                    TableScan [TS_15] (rows=25 width=7)
+                                      
default@src1,src1,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
+                            <-Map Join Operator [MAPJOIN_222] (rows=1100 
width=10)
+                                
Conds:RS_202._col3=SEL_221._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                              <-Map 4 [BROADCAST_EDGE] vectorized, llap
+                                BROADCAST [RS_202]
+                                  PartitionCols:_col3
+                                  Map Join Operator [MAPJOIN_201] (rows=275 
width=10)
+                                    
Conds:RS_198._col0=SEL_200._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
+                                  <-Map 3 [BROADCAST_EDGE] vectorized, llap
+                                    BROADCAST [RS_198]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_197] (rows=42 
width=34)
+                                        
Output:["_col0","_col1","_col2","_col3","_col4"]
+                                        Filter Operator [FIL_196] (rows=42 
width=34)
+                                          predicate:((v3 = 'ssv3') and k1 is 
not null and k2 is not null and k3 is not null and v1 is not null and v2 is not 
null)
+                                          TableScan [TS_6] (rows=85 width=34)
+                                            
default@ss_n1,ss_n1,Tbl:COMPLETE,Col:NONE,Output:["k1","v1","k2","v2","k3","v3"]
+                                  <-Select Operator [SEL_200] (rows=250 
width=10)
+                                      Output:["_col0"]
+                                      Filter Operator [FIL_199] (rows=250 
width=10)
+                                        predicate:((value = 'd1value') and key 
is not null)
+                                        TableScan [TS_9] (rows=500 width=10)
+                                          
default@src,d1,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
+                              <-Select Operator [SEL_221] (rows=1000 width=10)
+                                  Output:["_col1"]
+                                  Filter Operator [FIL_220] (rows=1000 
width=10)
+                                    predicate:((key = 'srcpartkey') and value 
is not null)
+                                    TableScan [TS_12] (rows=2000 width=10)
+                                      
default@srcpart,srcpart,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
 
 PREHOOK: query: explain
 SELECT x.key, z.value, y.value

http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/limit_pushdown.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/limit_pushdown.q.out 
b/ql/src/test/results/clientpositive/llap/limit_pushdown.q.out
index 1463b32..252831e 100644
--- a/ql/src/test/results/clientpositive/llap/limit_pushdown.q.out
+++ b/ql/src/test/results/clientpositive/llap/limit_pushdown.q.out
@@ -199,19 +199,24 @@ STAGE PLANS:
                     expressions: value (type: string), (UDFToDouble(key) + 
1.0D) (type: double)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: sum(_col1)
+                    Top N Key Operator
+                      sort order: +
                       keys: _col0 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 250 Data size: 24750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 20
+                      Group By Operator
+                        aggregations: sum(_col1)
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 250 Data size: 24750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: double)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 24750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: double)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -295,19 +300,24 @@ STAGE PLANS:
                     expressions: value (type: string), (UDFToDouble(key) + 
1.0D) (type: double)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: sum(_col1), count(_col1)
+                    Top N Key Operator
+                      sort order: +
                       keys: _col0 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 250 Data size: 26750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 20
+                      Group By Operator
+                        aggregations: sum(_col1), count(_col1)
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
                         Statistics: Num rows: 250 Data size: 26750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: double), _col2 (type: 
bigint)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 26750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: double), _col2 
(type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -395,17 +405,22 @@ STAGE PLANS:
                     expressions: cdouble (type: double)
                     outputColumnNames: cdouble
                     Statistics: Num rows: 12288 Data size: 73400 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
+                    Top N Key Operator
+                      sort order: +
                       keys: cdouble (type: double)
-                      mode: hash
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: double)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: double)
-                        Statistics: Num rows: 5528 Data size: 33024 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
+                      Statistics: Num rows: 12288 Data size: 73400 Basic 
stats: COMPLETE Column stats: COMPLETE
+                      top n: 20
+                      Group By Operator
+                        keys: cdouble (type: double)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 5528 Data size: 21816 Basic 
stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: double)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: double)
+                          Statistics: Num rows: 5528 Data size: 21816 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
             Execution mode: vectorized, llap
             LLAP IO: all inputs
         Reducer 2 
@@ -415,13 +430,13 @@ STAGE PLANS:
                 keys: KEY._col0 (type: double)
                 mode: mergepartial
                 outputColumnNames: _col0
-                Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 5528 Data size: 21816 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Limit
                   Number of rows: 20
-                  Statistics: Num rows: 20 Data size: 128 Basic stats: 
COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 20 Data size: 88 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 20 Data size: 128 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 20 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
@@ -921,26 +936,42 @@ STAGE PLANS:
                     expressions: key (type: string)
                     outputColumnNames: key
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: count()
+                    Top N Key Operator
+                      sort order: +
                       keys: key (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 250 Data size: 23750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 43500 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 2
+                      Group By Operator
+                        aggregations: count()
+                        keys: key (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 250 Data size: 23750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: bigint)
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 23750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: bigint)
+                    Top N Key Operator
+                      sort order: +
+                      keys: key (type: string)
+                      Statistics: Num rows: 500 Data size: 43500 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 3
+                      Group By Operator
+                        aggregations: count()
+                        keys: key (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 250 Data size: 23750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: bigint)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 23750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 

http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/limit_pushdown3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/limit_pushdown3.q.out 
b/ql/src/test/results/clientpositive/llap/limit_pushdown3.q.out
index 260ce3d..1027bfe 100644
--- a/ql/src/test/results/clientpositive/llap/limit_pushdown3.q.out
+++ b/ql/src/test/results/clientpositive/llap/limit_pushdown3.q.out
@@ -200,19 +200,24 @@ STAGE PLANS:
                     expressions: value (type: string), (UDFToDouble(key) + 
1.0D) (type: double)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: sum(_col1)
+                    Top N Key Operator
+                      sort order: +
                       keys: _col0 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 250 Data size: 24750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 20
+                      Group By Operator
+                        aggregations: sum(_col1)
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 250 Data size: 24750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: double)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 24750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: double)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -310,19 +315,24 @@ STAGE PLANS:
                     expressions: value (type: string), (UDFToDouble(key) + 
1.0D) (type: double)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: sum(_col1), count(_col1)
+                    Top N Key Operator
+                      sort order: +
                       keys: _col0 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 250 Data size: 26750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 20
+                      Group By Operator
+                        aggregations: sum(_col1), count(_col1)
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
                         Statistics: Num rows: 250 Data size: 26750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: double), _col2 (type: 
bigint)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 26750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: double), _col2 
(type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -424,17 +434,22 @@ STAGE PLANS:
                     expressions: cdouble (type: double)
                     outputColumnNames: cdouble
                     Statistics: Num rows: 12288 Data size: 73400 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
+                    Top N Key Operator
+                      sort order: +
                       keys: cdouble (type: double)
-                      mode: hash
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: double)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: double)
-                        Statistics: Num rows: 5528 Data size: 33024 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
+                      Statistics: Num rows: 12288 Data size: 73400 Basic 
stats: COMPLETE Column stats: COMPLETE
+                      top n: 20
+                      Group By Operator
+                        keys: cdouble (type: double)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 5528 Data size: 21816 Basic 
stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: double)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: double)
+                          Statistics: Num rows: 5528 Data size: 21816 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
             Execution mode: vectorized, llap
             LLAP IO: all inputs
         Reducer 2 
@@ -444,11 +459,11 @@ STAGE PLANS:
                 keys: KEY._col0 (type: double)
                 mode: mergepartial
                 outputColumnNames: _col0
-                Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 5528 Data size: 21816 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: double)
                   sort order: +
-                  Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 5528 Data size: 21816 Basic stats: 
COMPLETE Column stats: COMPLETE
                   TopN Hash Memory Usage: 0.3
         Reducer 3 
             Execution mode: vectorized, llap
@@ -456,13 +471,13 @@ STAGE PLANS:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: double)
                 outputColumnNames: _col0
-                Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 5528 Data size: 21816 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Limit
                   Number of rows: 20
-                  Statistics: Num rows: 20 Data size: 128 Basic stats: 
COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 20 Data size: 88 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 20 Data size: 128 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 20 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

http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/llap_decimal64_reader.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/llap/llap_decimal64_reader.q.out 
b/ql/src/test/results/clientpositive/llap/llap_decimal64_reader.q.out
index 0041206..88ddd9c 100644
--- a/ql/src/test/results/clientpositive/llap/llap_decimal64_reader.q.out
+++ b/ql/src/test/results/clientpositive/llap/llap_decimal64_reader.q.out
@@ -131,17 +131,22 @@ STAGE PLANS:
                   Filter Operator
                     predicate: ((cdecimal1 = 3.35) or (cdecimal1 = 4.46)) 
(type: boolean)
                     Statistics: Num rows: 24576 Data size: 5505024 Basic 
stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
+                    Top N Key Operator
+                      sort order: ++
                       keys: cdecimal1 (type: decimal(10,2)), cdecimal2 (type: 
decimal(38,5))
-                      mode: hash
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 2 Data size: 448 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: decimal(10,2)), _col1 
(type: decimal(38,5))
-                        sort order: ++
-                        Map-reduce partition columns: _col0 (type: 
decimal(10,2)), _col1 (type: decimal(38,5))
+                      Statistics: Num rows: 24576 Data size: 5505024 Basic 
stats: COMPLETE Column stats: COMPLETE
+                      top n: 2
+                      Group By Operator
+                        keys: cdecimal1 (type: decimal(10,2)), cdecimal2 
(type: decimal(38,5))
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 2 Data size: 448 Basic stats: 
COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.1
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(10,2)), _col1 
(type: decimal(38,5))
+                          sort order: ++
+                          Map-reduce partition columns: _col0 (type: 
decimal(10,2)), _col1 (type: decimal(38,5))
+                          Statistics: Num rows: 2 Data size: 448 Basic stats: 
COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.1
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -227,17 +232,22 @@ STAGE PLANS:
                   Filter Operator
                     predicate: ((cdecimal1 = 3.35) or (cdecimal1 = 4.46)) 
(type: boolean)
                     Statistics: Num rows: 24576 Data size: 5505024 Basic 
stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
+                    Top N Key Operator
+                      sort order: ++
                       keys: cdecimal1 (type: decimal(10,2)), cdecimal2 (type: 
decimal(38,5))
-                      mode: hash
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 2 Data size: 448 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: decimal(10,2)), _col1 
(type: decimal(38,5))
-                        sort order: ++
-                        Map-reduce partition columns: _col0 (type: 
decimal(10,2)), _col1 (type: decimal(38,5))
+                      Statistics: Num rows: 24576 Data size: 5505024 Basic 
stats: COMPLETE Column stats: COMPLETE
+                      top n: 2
+                      Group By Operator
+                        keys: cdecimal1 (type: decimal(10,2)), cdecimal2 
(type: decimal(38,5))
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 2 Data size: 448 Basic stats: 
COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.1
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(10,2)), _col1 
(type: decimal(38,5))
+                          sort order: ++
+                          Map-reduce partition columns: _col0 (type: 
decimal(10,2)), _col1 (type: decimal(38,5))
+                          Statistics: Num rows: 2 Data size: 448 Basic stats: 
COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.1
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:

http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/offset_limit.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/offset_limit.q.out 
b/ql/src/test/results/clientpositive/llap/offset_limit.q.out
index 0e718fd..97d2ac2 100644
--- a/ql/src/test/results/clientpositive/llap/offset_limit.q.out
+++ b/ql/src/test/results/clientpositive/llap/offset_limit.q.out
@@ -26,19 +26,24 @@ STAGE PLANS:
                     expressions: key (type: string), substr(value, 5) (type: 
string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: sum(_col1)
+                    Top N Key Operator
+                      sort order: +
                       keys: _col0 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 250 Data size: 23750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 20
+                      Group By Operator
+                        aggregations: sum(_col1)
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 250 Data size: 23750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.1
-                        value expressions: _col1 (type: double)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 23750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.1
+                          value expressions: _col1 (type: double)
             Execution mode: llap
             LLAP IO: no inputs
         Reducer 2 

http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/offset_limit_ppd_optimizer.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/llap/offset_limit_ppd_optimizer.q.out 
b/ql/src/test/results/clientpositive/llap/offset_limit_ppd_optimizer.q.out
index 4c62d7f..2e8d5f3 100644
--- a/ql/src/test/results/clientpositive/llap/offset_limit_ppd_optimizer.q.out
+++ b/ql/src/test/results/clientpositive/llap/offset_limit_ppd_optimizer.q.out
@@ -201,19 +201,24 @@ STAGE PLANS:
                     expressions: value (type: string), (UDFToDouble(key) + 
1.0D) (type: double)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: sum(_col1)
+                    Top N Key Operator
+                      sort order: +
                       keys: _col0 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 250 Data size: 24750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 30
+                      Group By Operator
+                        aggregations: sum(_col1)
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 250 Data size: 24750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: double)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 24750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: double)
             Execution mode: llap
             LLAP IO: no inputs
         Reducer 2 
@@ -298,19 +303,24 @@ STAGE PLANS:
                     expressions: value (type: string), (UDFToDouble(key) + 
1.0D) (type: double)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: sum(_col1), count(_col1)
+                    Top N Key Operator
+                      sort order: +
                       keys: _col0 (type: string)
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 250 Data size: 26750 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: string)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 500 Data size: 89000 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      top n: 30
+                      Group By Operator
+                        aggregations: sum(_col1), count(_col1)
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0, _col1, _col2
                         Statistics: Num rows: 250 Data size: 26750 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
-                        value expressions: _col1 (type: double), _col2 (type: 
bigint)
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 250 Data size: 26750 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
+                          value expressions: _col1 (type: double), _col2 
(type: bigint)
             Execution mode: llap
             LLAP IO: no inputs
         Reducer 2 
@@ -399,17 +409,22 @@ STAGE PLANS:
                     expressions: cdouble (type: double)
                     outputColumnNames: cdouble
                     Statistics: Num rows: 12288 Data size: 73400 Basic stats: 
COMPLETE Column stats: COMPLETE
-                    Group By Operator
+                    Top N Key Operator
+                      sort order: +
                       keys: cdouble (type: double)
-                      mode: hash
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: double)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: double)
-                        Statistics: Num rows: 5528 Data size: 33024 Basic 
stats: COMPLETE Column stats: COMPLETE
-                        TopN Hash Memory Usage: 0.3
+                      Statistics: Num rows: 12288 Data size: 73400 Basic 
stats: COMPLETE Column stats: COMPLETE
+                      top n: 30
+                      Group By Operator
+                        keys: cdouble (type: double)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 5528 Data size: 21816 Basic 
stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: double)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: double)
+                          Statistics: Num rows: 5528 Data size: 21816 Basic 
stats: COMPLETE Column stats: COMPLETE
+                          TopN Hash Memory Usage: 0.3
             Execution mode: llap
             LLAP IO: all inputs
         Reducer 2 
@@ -419,14 +434,14 @@ STAGE PLANS:
                 keys: KEY._col0 (type: double)
                 mode: mergepartial
                 outputColumnNames: _col0
-                Statistics: Num rows: 5528 Data size: 33024 Basic stats: 
COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 5528 Data size: 21816 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Limit
                   Number of rows: 20
                   Offset of rows: 10
-                  Statistics: Num rows: 20 Data size: 128 Basic stats: 
COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 20 Data size: 88 Basic stats: COMPLETE 
Column stats: COMPLETE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 20 Data size: 128 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 20 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

http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/orc_struct_type_vectorization.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/llap/orc_struct_type_vectorization.q.out 
b/ql/src/test/results/clientpositive/llap/orc_struct_type_vectorization.q.out
index 5c6b481..a804e3c 100644
--- 
a/ql/src/test/results/clientpositive/llap/orc_struct_type_vectorization.q.out
+++ 
b/ql/src/test/results/clientpositive/llap/orc_struct_type_vectorization.q.out
@@ -238,31 +238,40 @@ STAGE PLANS:
                           projectedOutputColumnNums: [4]
                           selectExpressions: VectorUDFStructField(col 
1:struct<f1:int,f2:string>, col 0:int) -> 4:int
                       Statistics: Num rows: 341 Data size: 76542 Basic stats: 
COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: sum(_col0)
-                        Group By Vectorization:
-                            aggregators: VectorUDAFSumLong(col 4:int) -> bigint
-                            className: VectorGroupByOperator
-                            groupByMode: HASH
-                            keyExpressions: col 4:int
-                            native: false
-                            vectorProcessingMode: HASH
-                            projectedOutputColumnNums: [0]
+                      Top N Key Operator
+                        sort order: +
                         keys: _col0 (type: int)
-                        mode: hash
-                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 341 Data size: 76542 Basic 
stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: int)
-                          sort order: +
-                          Map-reduce partition columns: _col0 (type: int)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkLongOperator
-                              native: true
-                              nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                        top n: 10
+                        Top N Key Vectorization:
+                            className: VectorTopNKeyOperator
+                            keyExpressions: col 4:int
+                            native: true
+                        Group By Operator
+                          aggregations: sum(_col0)
+                          Group By Vectorization:
+                              aggregators: VectorUDAFSumLong(col 4:int) -> 
bigint
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 4:int
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: [0]
+                          keys: _col0 (type: int)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 341 Data size: 76542 Basic 
stats: COMPLETE Column stats: NONE
-                          TopN Hash Memory Usage: 0.1
-                          value expressions: _col1 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int)
+                            sort order: +
+                            Map-reduce partition columns: _col0 (type: int)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkLongOperator
+                                native: true
+                                nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                            Statistics: Num rows: 341 Data size: 76542 Basic 
stats: COMPLETE Column stats: NONE
+                            TopN Hash Memory Usage: 0.1
+                            value expressions: _col1 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:

http://git-wip-us.apache.org/repos/asf/hive/blob/851c8aba/ql/src/test/results/clientpositive/llap/parquet_complex_types_vectorization.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/llap/parquet_complex_types_vectorization.q.out
 
b/ql/src/test/results/clientpositive/llap/parquet_complex_types_vectorization.q.out
index da9dd4e..baeb60e 100644
--- 
a/ql/src/test/results/clientpositive/llap/parquet_complex_types_vectorization.q.out
+++ 
b/ql/src/test/results/clientpositive/llap/parquet_complex_types_vectorization.q.out
@@ -214,31 +214,40 @@ STAGE PLANS:
                           projectedOutputColumnNums: [6, 7]
                           selectExpressions: ListIndexColScalar(col 
2:array<int>, col 1:int) -> 6:int, ListIndexColScalar(col 2:array<int>, col 
0:int) -> 7:int
                       Statistics: Num rows: 341 Data size: 38920 Basic stats: 
COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: sum(_col1)
-                        Group By Vectorization:
-                            aggregators: VectorUDAFSumLong(col 7:int) -> bigint
-                            className: VectorGroupByOperator
-                            groupByMode: HASH
-                            keyExpressions: col 6:int
-                            native: false
-                            vectorProcessingMode: HASH
-                            projectedOutputColumnNums: [0]
+                      Top N Key Operator
+                        sort order: +
                         keys: _col0 (type: int)
-                        mode: hash
-                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 341 Data size: 38920 Basic 
stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: int)
-                          sort order: +
-                          Map-reduce partition columns: _col0 (type: int)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkLongOperator
-                              native: true
-                              nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                        top n: 10
+                        Top N Key Vectorization:
+                            className: VectorTopNKeyOperator
+                            keyExpressions: col 6:int
+                            native: true
+                        Group By Operator
+                          aggregations: sum(_col1)
+                          Group By Vectorization:
+                              aggregators: VectorUDAFSumLong(col 7:int) -> 
bigint
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 6:int
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: [0]
+                          keys: _col0 (type: int)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 341 Data size: 38920 Basic 
stats: COMPLETE Column stats: NONE
-                          TopN Hash Memory Usage: 0.1
-                          value expressions: _col1 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int)
+                            sort order: +
+                            Map-reduce partition columns: _col0 (type: int)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkLongOperator
+                                native: true
+                                nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                            Statistics: Num rows: 341 Data size: 38920 Basic 
stats: COMPLETE Column stats: NONE
+                            TopN Hash Memory Usage: 0.1
+                            value expressions: _col1 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs (cache only)
             Map Vectorization:
@@ -503,31 +512,40 @@ STAGE PLANS:
                           projectedOutputColumnNums: [6, 7]
                           selectExpressions: ListIndexColScalar(col 
2:array<int>, col 1:int) -> 6:int, ListIndexColScalar(col 2:array<int>, col 
0:int) -> 7:int
                       Statistics: Num rows: 341 Data size: 38921 Basic stats: 
COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: sum(_col1)
-                        Group By Vectorization:
-                            aggregators: VectorUDAFSumLong(col 7:int) -> bigint
-                            className: VectorGroupByOperator
-                            groupByMode: HASH
-                            keyExpressions: col 6:int
-                            native: false
-                            vectorProcessingMode: HASH
-                            projectedOutputColumnNums: [0]
+                      Top N Key Operator
+                        sort order: +
                         keys: _col0 (type: int)
-                        mode: hash
-                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 341 Data size: 38921 Basic 
stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: int)
-                          sort order: +
-                          Map-reduce partition columns: _col0 (type: int)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkLongOperator
-                              native: true
-                              nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                        top n: 10
+                        Top N Key Vectorization:
+                            className: VectorTopNKeyOperator
+                            keyExpressions: col 6:int
+                            native: true
+                        Group By Operator
+                          aggregations: sum(_col1)
+                          Group By Vectorization:
+                              aggregators: VectorUDAFSumLong(col 7:int) -> 
bigint
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 6:int
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: [0]
+                          keys: _col0 (type: int)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 341 Data size: 38921 Basic 
stats: COMPLETE Column stats: NONE
-                          TopN Hash Memory Usage: 0.1
-                          value expressions: _col1 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int)
+                            sort order: +
+                            Map-reduce partition columns: _col0 (type: int)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkLongOperator
+                                native: true
+                                nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                            Statistics: Num rows: 341 Data size: 38921 Basic 
stats: COMPLETE Column stats: NONE
+                            TopN Hash Memory Usage: 0.1
+                            value expressions: _col1 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs (cache only)
             Map Vectorization:
@@ -792,31 +810,40 @@ STAGE PLANS:
                           projectedOutputColumnNums: [6, 7]
                           selectExpressions: ListIndexColScalar(col 
2:array<int>, col 1:int) -> 6:int, ListIndexColScalar(col 2:array<int>, col 
0:int) -> 7:int
                       Statistics: Num rows: 341 Data size: 38923 Basic stats: 
COMPLETE Column stats: NONE
-                      Group By Operator
-                        aggregations: sum(_col1)
-                        Group By Vectorization:
-                            aggregators: VectorUDAFSumLong(col 7:int) -> bigint
-                            className: VectorGroupByOperator
-                            groupByMode: HASH
-                            keyExpressions: col 6:int
-                            native: false
-                            vectorProcessingMode: HASH
-                            projectedOutputColumnNums: [0]
+                      Top N Key Operator
+                        sort order: +
                         keys: _col0 (type: int)
-                        mode: hash
-                        outputColumnNames: _col0, _col1
                         Statistics: Num rows: 341 Data size: 38923 Basic 
stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: int)
-                          sort order: +
-                          Map-reduce partition columns: _col0 (type: int)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkLongOperator
-                              native: true
-                              nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                        top n: 10
+                        Top N Key Vectorization:
+                            className: VectorTopNKeyOperator
+                            keyExpressions: col 6:int
+                            native: true
+                        Group By Operator
+                          aggregations: sum(_col1)
+                          Group By Vectorization:
+                              aggregators: VectorUDAFSumLong(col 7:int) -> 
bigint
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 6:int
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: [0]
+                          keys: _col0 (type: int)
+                          mode: hash
+                          outputColumnNames: _col0, _col1
                           Statistics: Num rows: 341 Data size: 38923 Basic 
stats: COMPLETE Column stats: NONE
-                          TopN Hash Memory Usage: 0.1
-                          value expressions: _col1 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int)
+                            sort order: +
+                            Map-reduce partition columns: _col0 (type: int)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkLongOperator
+                                native: true
+                                nativeConditionsMet: 
hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine 
tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, 
BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                            Statistics: Num rows: 341 Data size: 38923 Basic 
stats: COMPLETE Column stats: NONE
+                            TopN Hash Memory Usage: 0.1
+                            value expressions: _col1 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs (cache only)
             Map Vectorization:

Reply via email to