This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new e331e0420b [improvement](topn)add per scanner limit check for new 
scanner (#15231)
e331e0420b is described below

commit e331e0420b4431bdc5d64b0ecccf0caeefe2a960
Author: Kang <kxiao.ti...@gmail.com>
AuthorDate: Thu Dec 22 22:39:31 2022 +0800

    [improvement](topn)add per scanner limit check for new scanner (#15231)
    
    Optimize for key topn query like `SELECT * FROM store_sales ORDER BY 
ss_sold_date_sk, ss_sold_time_sk LIMIT 100`
    (ss_sold_date_sk, ss_sold_time_sk is prefix of table sort key).
    
    Check per scanner limit and set eof true to reduce the data need to be read.
---
 be/src/vec/exec/scan/vscanner.cpp                  |   8 ++
 be/src/vec/exec/scan/vscanner.h                    |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_1.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_2.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_3.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_4.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_5.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_6.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_7.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_8.out  | 103 +++++++++++++++++++++
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_1.sql  |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_2.sql  |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_3.sql  |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_4.sql  |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_5.sql  |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_6.sql  |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_7.sql  |   3 +
 .../tpcds_sf1_p1/sql/test_orderby_key_limit_8.sql  |   3 +
 18 files changed, 859 insertions(+)

diff --git a/be/src/vec/exec/scan/vscanner.cpp 
b/be/src/vec/exec/scan/vscanner.cpp
index 9a8b2858a4..e9518fbe91 100644
--- a/be/src/vec/exec/scan/vscanner.cpp
+++ b/be/src/vec/exec/scan/vscanner.cpp
@@ -62,10 +62,18 @@ Status VScanner::get_block(RuntimeState* state, Block* 
block, bool* eof) {
             {
                 SCOPED_TIMER(_parent->_filter_timer);
                 RETURN_IF_ERROR(_filter_output_block(block));
+                // record rows return (after filter) for _limit check
+                _num_rows_return += block->rows();
             }
         } while (block->rows() == 0 && !(*eof) && raw_rows_read() < 
raw_rows_threshold);
     }
 
+    // set eof to true if per scanner limit is reached
+    // currently for query: ORDER BY key LIMIT n
+    if (_limit > 0 && _num_rows_return >= _limit) {
+        *eof = true;
+    }
+
     return Status::OK();
 }
 
diff --git a/be/src/vec/exec/scan/vscanner.h b/be/src/vec/exec/scan/vscanner.h
index 8e8c8a837f..07ddf65298 100644
--- a/be/src/vec/exec/scan/vscanner.h
+++ b/be/src/vec/exec/scan/vscanner.h
@@ -164,6 +164,9 @@ protected:
     // num of rows read from scanner
     int64_t _num_rows_read = 0;
 
+    // num of rows return from scanner, after filter block
+    int64_t _num_rows_return = 0;
+
     // Set true after counter is updated finally
     bool _has_updated_counter = false;
 
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_1.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_1.out
new file mode 100644
index 0000000000..62df8526af
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_1.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_1 --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_2.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_2.out
new file mode 100644
index 0000000000..e68b917e3c
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_2.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_2 --
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+\N     \N
+
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_3.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_3.out
new file mode 100644
index 0000000000..2d7f944f98
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_3.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_3 --
+\N     \N      1
+\N     \N      1
+\N     \N      1
+\N     \N      1
+\N     \N      1
+\N     \N      1
+\N     \N      2
+\N     \N      3
+\N     \N      3
+\N     \N      3
+\N     \N      3
+\N     \N      4
+\N     \N      4
+\N     \N      5
+\N     \N      5
+\N     \N      6
+\N     \N      6
+\N     \N      7
+\N     \N      7
+\N     \N      7
+\N     \N      7
+\N     \N      8
+\N     \N      8
+\N     \N      8
+\N     \N      8
+\N     \N      8
+\N     \N      8
+\N     \N      8
+\N     \N      8
+\N     \N      9
+\N     \N      9
+\N     \N      9
+\N     \N      10
+\N     \N      10
+\N     \N      11
+\N     \N      11
+\N     \N      12
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      13
+\N     \N      14
+\N     \N      14
+\N     \N      14
+\N     \N      15
+\N     \N      15
+\N     \N      15
+\N     \N      16
+\N     \N      16
+\N     \N      17
+\N     \N      17
+\N     \N      18
+\N     \N      18
+\N     \N      19
+\N     \N      19
+\N     \N      19
+\N     \N      19
+\N     \N      19
+\N     \N      19
+\N     \N      19
+\N     \N      20
+\N     \N      21
+\N     \N      22
+\N     \N      22
+\N     \N      22
+\N     \N      23
+\N     \N      23
+\N     \N      24
+\N     \N      24
+\N     \N      25
+\N     \N      25
+\N     \N      25
+\N     \N      25
+\N     \N      25
+\N     \N      26
+\N     \N      26
+\N     \N      26
+\N     \N      26
+\N     \N      26
+\N     \N      26
+\N     \N      27
+\N     \N      27
+\N     \N      27
+\N     \N      27
+\N     \N      27
+\N     \N      27
+\N     \N      28
+\N     \N      28
+\N     \N      28
+\N     \N      28
+\N     \N      29
+\N     \N      29
+\N     \N      30
+\N     \N      31
+
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_4.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_4.out
new file mode 100644
index 0000000000..f0d63235b8
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_4.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_4 --
+\N     \N      1       \N
+\N     \N      1       \N
+\N     \N      1       18167
+\N     \N      1       21085
+\N     \N      1       75278
+\N     \N      1       84924
+\N     \N      2       \N
+\N     \N      3       \N
+\N     \N      3       \N
+\N     \N      3       48740
+\N     \N      3       75689
+\N     \N      4       \N
+\N     \N      4       47079
+\N     \N      5       \N
+\N     \N      5       21886
+\N     \N      6       \N
+\N     \N      6       \N
+\N     \N      7       \N
+\N     \N      7       \N
+\N     \N      7       \N
+\N     \N      7       46051
+\N     \N      8       \N
+\N     \N      8       \N
+\N     \N      8       \N
+\N     \N      8       \N
+\N     \N      8       \N
+\N     \N      8       \N
+\N     \N      8       \N
+\N     \N      8       49345
+\N     \N      9       \N
+\N     \N      9       \N
+\N     \N      9       31609
+\N     \N      10      \N
+\N     \N      10      8352
+\N     \N      11      \N
+\N     \N      11      \N
+\N     \N      12      \N
+\N     \N      13      \N
+\N     \N      13      \N
+\N     \N      13      \N
+\N     \N      13      \N
+\N     \N      13      \N
+\N     \N      13      \N
+\N     \N      13      \N
+\N     \N      13      30258
+\N     \N      13      76049
+\N     \N      13      97724
+\N     \N      14      \N
+\N     \N      14      \N
+\N     \N      14      40806
+\N     \N      15      \N
+\N     \N      15      49526
+\N     \N      15      70726
+\N     \N      16      \N
+\N     \N      16      11000
+\N     \N      17      8357
+\N     \N      17      14815
+\N     \N      18      \N
+\N     \N      18      \N
+\N     \N      19      \N
+\N     \N      19      \N
+\N     \N      19      \N
+\N     \N      19      \N
+\N     \N      19      \N
+\N     \N      19      86877
+\N     \N      19      90891
+\N     \N      20      \N
+\N     \N      21      \N
+\N     \N      22      \N
+\N     \N      22      42497
+\N     \N      22      77262
+\N     \N      23      \N
+\N     \N      23      47923
+\N     \N      24      \N
+\N     \N      24      62590
+\N     \N      25      \N
+\N     \N      25      \N
+\N     \N      25      \N
+\N     \N      25      14441
+\N     \N      25      90126
+\N     \N      26      \N
+\N     \N      26      \N
+\N     \N      26      \N
+\N     \N      26      3840
+\N     \N      26      14710
+\N     \N      26      86406
+\N     \N      27      \N
+\N     \N      27      \N
+\N     \N      27      \N
+\N     \N      27      \N
+\N     \N      27      553
+\N     \N      27      82679
+\N     \N      28      28212
+\N     \N      28      32302
+\N     \N      28      52218
+\N     \N      28      55604
+\N     \N      29      \N
+\N     \N      29      19869
+\N     \N      30      93938
+\N     \N      31      \N
+
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_5.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_5.out
new file mode 100644
index 0000000000..f533a7fb2d
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_5.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_5 --
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+2452642
+
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_6.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_6.out
new file mode 100644
index 0000000000..2047732d64
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_6.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_6 --
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        75582
+2452642        74917
+2452642        74917
+2452642        74917
+2452642        74917
+2452642        74917
+2452642        74917
+2452642        74917
+2452642        74917
+2452642        74917
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74739
+2452642        74732
+2452642        74732
+2452642        74732
+2452642        74732
+2452642        74732
+2452642        74732
+2452642        74732
+2452642        74732
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74632
+2452642        74365
+2452642        74365
+2452642        74365
+2452642        74365
+2452642        74365
+2452642        74365
+2452642        74365
+2452642        74365
+2452642        74360
+2452642        74360
+2452642        74360
+2452642        74360
+2452642        74360
+2452642        74360
+2452642        74360
+2452642        74360
+2452642        74360
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        74113
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73780
+2452642        73539
+2452642        73539
+2452642        73539
+2452642        73539
+
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_7.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_7.out
new file mode 100644
index 0000000000..82849d545c
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_7.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_7 --
+2452642        75582   17899   64251   1311910 1169    13228   1       192     
104393  76      7.47    9.63    5.20    0.00    395.20  567.72  731.88  35.56   
0.00    395.20  430.76  -172.52
+2452642        75582   16866   64251   1311910 1169    13228   1       250     
104393  85      28.33   33.42   18.04   0.00    1533.40 2408.05 2840.70 76.67   
0.00    1533.40 1610.07 -874.65
+2452642        75582   16236   64251   1311910 1169    13228   1       252     
104393  60      7.44    11.30   2.14    0.00    128.40  446.40  678.00  7.70    
0.00    128.40  136.10  -318.00
+2452642        75582   16161   64251   1311910 1169    13228   1       298     
104393  35      67.80   92.20   61.77   0.00    2161.95 2373.00 3227.00 194.57  
0.00    2161.95 2356.52 -211.05
+2452642        75582   15012   64251   1311910 1169    13228   1       109     
104393  26      24.95   24.95   17.46   0.00    453.96  648.70  648.70  27.23   
0.00    453.96  481.19  -194.74
+2452642        75582   11905   64251   1311910 1169    13228   1       145     
104393  22      90.68   130.57  101.84  0.00    2240.48 1994.96 2872.54 0.00    
0.00    2240.48 2240.48 245.52
+2452642        75582   9205    64251   1311910 1169    13228   1       108     
104393  27      47.56   56.59   22.63   580.45  611.01  1284.12 1527.93 2.13    
580.45  30.56   32.69   -1253.56
+2452642        75582   8280    64251   1311910 1169    13228   1       259     
104393  17      51.50   79.82   22.34   0.00    379.78  875.50  1356.94 18.98   
0.00    379.78  398.76  -495.72
+2452642        75582   6345    64251   1311910 1169    13228   1       119     
104393  22      3.01    3.31    2.05    0.00    45.10   66.22   72.82   0.00    
0.00    45.10   45.10   -21.12
+2452642        75582   5400    64251   1311910 1169    13228   1       108     
104393  9       62.26   113.93  71.77   0.00    645.93  560.34  1025.37 51.67   
0.00    645.93  697.60  85.59
+2452642        75582   5215    64251   1311910 1169    13228   1       90      
104393  53      68.98   73.11   19.00   0.00    1007.00 3655.94 3874.83 50.35   
0.00    1007.00 1057.35 -2648.94
+2452642        75582   2185    64251   1311910 1169    13228   1       19      
104393  5       59.37   103.30  19.62   0.00    98.10   296.85  516.50  5.88    
0.00    98.10   103.98  -198.75
+2452642        75582   1921    64251   1311910 1169    13228   1       274     
104393  25      84.61   134.52  43.04   0.00    1076.00 2115.25 3363.00 53.80   
0.00    1076.00 1129.80 -1039.25
+2452642        75582   1101    64251   1311910 1169    13228   1       4       
104393  1       10.40   12.79   4.22    0.00    4.22    10.40   12.79   0.12    
0.00    4.22    4.34    -6.18
+2452642        75582   930     64251   1311910 1169    13228   1       207     
104393  18      50.28   75.92   53.90   0.00    970.20  905.04  1366.56 58.21   
0.00    970.20  1028.41 65.16
+2452642        74917   15307   34569   1077240 2664    28935   8       275     
189488  5       37.63   57.95   44.62   0.00    223.10  188.15  289.75  6.69    
0.00    223.10  229.79  34.95
+2452642        74917   15252   34569   1077240 2664    28935   8       59      
189488  10      33.83   38.56   18.89   0.00    188.90  338.30  385.60  13.22   
0.00    188.90  202.12  -149.40
+2452642        74917   14976   34569   1077240 2664    28935   8       265     
189488  31      77.83   130.75  1.30    0.00    40.30   2412.73 4053.25 2.82    
0.00    40.30   43.12   -2372.43
+2452642        74917   13033   34569   1077240 2664    28935   8       248     
189488  62      52.31   95.72   19.14   0.00    1186.68 3243.22 5934.64 94.93   
0.00    1186.68 1281.61 -2056.54
+2452642        74917   8424    34569   1077240 2664    28935   8       196     
189488  39      92.13   150.17  37.54   0.00    1464.06 3593.07 5856.63 14.64   
0.00    1464.06 1478.70 -2129.01
+2452642        74917   7803    34569   1077240 2664    28935   8       207     
189488  56      44.73   81.40   24.42   0.00    1367.52 2504.88 4558.40 54.70   
0.00    1367.52 1422.22 -1137.36
+2452642        74917   6705    34569   1077240 2664    28935   8       14      
189488  64      83.43   137.65  41.29   0.00    2642.56 5339.52 8809.60 211.40  
0.00    2642.56 2853.96 -2696.96
+2452642        74917   6153    34569   1077240 2664    28935   8       244     
189488  18      1.52    2.79    2.37    0.00    42.66   27.36   50.22   3.83    
0.00    42.66   46.49   15.30
+2452642        74917   4806    34569   1077240 \N      \N      \N      120     
189488  \N      10.09   \N      \N      0.00    861.12  787.02  967.98  0.00    
0.00    861.12  861.12  \N
+2452642        74739   17412   36165   1118342 519     21496   4       222     
122414  47      51.39   78.62   33.02   0.00    1551.94 2415.33 3695.14 139.67  
0.00    1551.94 1691.61 -863.39
+2452642        74739   17265   36165   1118342 519     21496   4       19      
122414  18      35.05   43.46   20.42   158.05  367.56  630.90  782.28  4.19    
158.05  209.51  213.70  -421.39
+2452642        74739   16593   36165   1118342 519     21496   4       175     
122414  48      95.62   98.48   53.17   0.00    2552.16 4589.76 4727.04 51.04   
0.00    2552.16 2603.20 -2037.60
+2452642        74739   15882   36165   1118342 519     21496   4       248     
122414  22      83.67   93.71   1.87    0.00    41.14   1840.74 2061.62 2.87    
0.00    41.14   44.01   -1799.60
+2452642        74739   15817   36165   1118342 519     21496   4       107     
122414  53      73.91   107.90  73.37   0.00    3888.61 3917.23 5718.70 155.54  
0.00    3888.61 4044.15 -28.62
+2452642        74739   14995   36165   1118342 519     21496   4       262     
122414  29      20.97   27.89   26.49   314.96  768.21  608.13  808.81  36.26   
314.96  453.25  489.51  -154.88
+2452642        74739   11445   36165   1118342 519     21496   4       236     
122414  74      10.23   10.84   7.69    0.00    569.06  757.02  802.16  51.21   
0.00    569.06  620.27  -187.96
+2452642        74739   11035   36165   1118342 519     21496   4       25      
122414  2       2.59    4.06    3.08    0.00    6.16    5.18    8.12    0.43    
0.00    6.16    6.59    0.98
+2452642        74739   7195    36165   1118342 519     21496   4       287     
122414  26      49.47   82.12   64.05   0.00    1665.30 1286.22 2135.12 66.61   
0.00    1665.30 1731.91 379.08
+2452642        74739   5265    36165   1118342 519     21496   4       35      
122414  6       64.60   65.89   30.30   0.00    181.80  387.60  395.34  3.63    
0.00    181.80  185.43  -205.80
+2452642        74739   4893    36165   1118342 519     21496   4       269     
122414  61      34.85   58.89   4.12    70.36   251.32  2125.85 3592.29 5.42    
70.36   180.96  186.38  -1944.89
+2452642        74739   1401    36165   1118342 519     21496   4       8       
122414  17      71.93   72.64   19.61   243.36  333.37  1222.81 1234.88 6.30    
243.36  90.01   96.31   -1132.80
+2452642        74739   793     36165   1118342 519     21496   4       47      
122414  58      91.39   118.80  106.92  1364.29 6201.36 5300.62 6890.40 48.37   
1364.29 4837.07 4885.44 -463.55
+2452642        74732   17917   35935   598888  3441    28794   1       165     
90399   9       99.33   145.02  59.45   0.00    535.05  893.97  1305.18 10.70   
0.00    535.05  545.75  -358.92
+2452642        74732   16242   35935   \N      3441    28794   1       111     
90399   \N      18.25   19.34   0.38    0.00    33.82   \N      \N      1.01    
0.00    \N      34.83   -1590.43
+2452642        74732   13128   35935   598888  3441    28794   1       89      
90399   37      84.38   151.88  148.84  0.00    5507.08 3122.06 5619.56 165.21  
0.00    5507.08 5672.29 2385.02
+2452642        74732   12709   35935   598888  3441    28794   1       170     
90399   59      54.71   92.45   24.96   0.00    1472.64 3227.89 5454.55 132.53  
0.00    1472.64 1605.17 -1755.25
+2452642        74732   10416   35935   598888  3441    28794   1       45      
90399   48      2.87    5.36    4.87    0.00    233.76  137.76  257.28  0.00    
0.00    233.76  233.76  96.00
+2452642        74732   9607    35935   598888  3441    28794   1       39      
90399   6       5.49    8.83    6.35    0.00    38.10   32.94   52.98   0.76    
0.00    38.10   38.86   5.16
+2452642        74732   6295    35935   598888  3441    28794   1       40      
90399   62      86.00   116.96  83.04   0.00    5148.48 5332.00 7251.52 463.36  
0.00    5148.48 5611.84 -183.52
+2452642        74732   2925    35935   598888  3441    28794   1       171     
90399   62      86.77   142.30  29.88   0.00    1852.56 5379.74 8822.60 18.52   
0.00    1852.56 1871.08 -3527.18
+2452642        74632   17694   12929   1852276 5223    20123   7       241     
6701    18      41.04   48.01   12.48   0.00    224.64  738.72  864.18  6.73    
0.00    224.64  231.37  -514.08
+2452642        74632   15709   12929   1852276 5223    20123   7       52      
6701    70      60.01   92.41   74.85   0.00    5239.50 4200.70 6468.70 261.97  
0.00    5239.50 5501.47 1038.80
+2452642        74632   15600   12929   1852276 5223    20123   7       130     
6701    8       49.93   77.39   55.72   0.00    445.76  399.44  619.12  31.20   
0.00    445.76  476.96  46.32
+2452642        74632   13335   12929   1852276 5223    20123   7       44      
6701    25      66.81   127.60  76.56   0.00    1914.00 1670.25 3190.00 57.42   
0.00    1914.00 1971.42 243.75
+2452642        74632   12483   12929   1852276 5223    20123   7       286     
6701    49      3.20    3.96    1.66    0.00    81.34   156.80  194.04  0.00    
0.00    81.34   81.34   -75.46
+2452642        74632   12444   12929   1852276 5223    20123   7       103     
6701    78      87.12   132.42  60.91   0.00    4750.98 6795.36 10328.76        
142.52  0.00    4750.98 4893.50 -2044.38
+2452642        74632   9207    12929   1852276 5223    20123   7       129     
6701    39      66.20   127.76  99.65   0.00    3886.35 2581.80 4982.64 349.77  
0.00    3886.35 4236.12 1304.55
+2452642        74632   8706    12929   1852276 5223    20123   7       192     
6701    64      47.32   87.54   15.75   0.00    1008.00 3028.48 5602.56 70.56   
0.00    1008.00 1078.56 -2020.48
+2452642        74632   8235    12929   1852276 5223    20123   7       295     
6701    90      92.87   127.23  62.34   0.00    5610.60 8358.30 11450.70        
0.00    0.00    5610.60 5610.60 -2747.70
+2452642        74632   6241    12929   1852276 5223    20123   7       174     
6701    47      36.04   39.28   0.39    4.58    18.33   1693.88 1846.16 0.55    
4.58    13.75   14.30   -1680.13
+2452642        74632   5841    12929   1852276 5223    20123   7       168     
6701    41      33.73   51.94   30.64   0.00    1256.24 1382.93 2129.54 12.56   
0.00    1256.24 1268.80 -126.69
+2452642        74632   4527    12929   1852276 5223    20123   7       238     
6701    48      87.43   153.00  90.27   0.00    4332.96 4196.64 7344.00 86.65   
0.00    4332.96 4419.61 136.32
+2452642        74365   17197   19663   684197  3131    24112   10      274     
142743  79      81.12   117.62  14.11   256.37  1114.69 6408.48 9291.98 42.91   
256.37  858.32  901.23  -5550.16
+2452642        74365   16609   19663   684197  3131    24112   10      51      
142743  96      64.05   87.74   78.08   4347.49 7495.68 6148.80 8423.04 188.89  
4347.49 3148.19 3337.08 -3000.61
+2452642        74365   16578   19663   684197  3131    24112   10      71      
142743  52      19.76   24.70   3.45    0.00    179.40  1027.52 1284.40 14.35   
0.00    179.40  193.75  -848.12
+2452642        74365   12873   19663   684197  3131    24112   10      287     
142743  66      39.84   64.14   48.74   0.00    3216.84 2629.44 4233.24 225.17  
0.00    3216.84 3442.01 587.40
+2452642        74365   9379    19663   684197  3131    24112   10      15      
142743  99      13.97   23.46   21.81   0.00    2159.19 1383.03 2322.54 0.00    
0.00    2159.19 2159.19 776.16
+2452642        74365   8376    19663   684197  3131    24112   10      4       
142743  18      24.89   32.85   7.55    0.00    135.90  448.02  591.30  2.71    
0.00    135.90  138.61  -312.12
+2452642        74365   3721    19663   684197  3131    24112   10      153     
142743  4       91.59   137.38  35.71   0.00    142.84  366.36  549.52  1.42    
0.00    142.84  144.26  -223.52
+2452642        74365   867     19663   684197  3131    24112   10      110     
142743  44      72.74   125.11  58.80   776.16  2587.20 3200.56 5504.84 108.66  
776.16  1811.04 1919.70 -1389.52
+2452642        74360   17532   8740    243373  2006    43886   1       276     
27274   33      61.01   78.09   47.63   0.00    1571.79 2013.33 2576.97 110.02  
0.00    1571.79 1681.81 -441.54
+2452642        74360   17191   8740    243373  2006    43886   1       137     
27274   16      62.14   62.14   16.15   74.93   258.40  994.24  994.24  16.51   
74.93   183.47  199.98  -810.77
+2452642        74360   14067   8740    243373  2006    43886   1       52      
27274   61      54.85   63.07   35.94   0.00    2192.34 3345.85 3847.27 43.84   
0.00    2192.34 2236.18 -1153.51
+2452642        74360   13921   8740    243373  2006    43886   1       232     
27274   61      68.72   120.94  42.32   0.00    2581.52 4191.92 7377.34 129.07  
0.00    2581.52 2710.59 -1610.40
+2452642        74360   13617   8740    243373  2006    43886   1       299     
27274   9       45.49   82.79   27.32   0.00    245.88  409.41  745.11  14.75   
0.00    245.88  260.63  -163.53
+2452642        74360   11881   8740    243373  2006    43886   1       39      
27274   86      3.48    6.47    2.71    0.00    233.06  299.28  556.42  2.33    
0.00    233.06  235.39  -66.22
+2452642        74360   4359    8740    243373  2006    43886   1       19      
27274   88      41.88   68.68   16.48   0.00    1450.24 3685.44 6043.84 116.01  
0.00    1450.24 1566.25 -2235.20
+2452642        74360   3553    8740    243373  2006    43886   1       134     
27274   22      25.69   39.04   6.24    0.00    137.28  565.18  858.88  8.23    
0.00    137.28  145.51  -427.90
+2452642        74360   2113    8740    243373  2006    43886   1       122     
27274   23      23.75   23.98   0.00    0.00    0.00    546.25  551.54  0.00    
0.00    0.00    0.00    -546.25
+2452642        74113   16677   14659   1834843 6674    45258   10      217     
117167  75      71.24   123.24  114.61  3610.21 8595.75 5343.00 9243.00 348.98  
3610.21 4985.54 5334.52 -357.46
+2452642        74113   16489   14659   1834843 6674    45258   10      10      
117167  39      57.38   87.79   28.97   0.00    1129.83 2237.82 3423.81 11.29   
0.00    1129.83 1141.12 -1107.99
+2452642        74113   15516   14659   1834843 6674    45258   10      87      
117167  27      57.26   68.71   10.30   0.00    278.10  1546.02 1855.17 11.12   
0.00    278.10  289.22  -1267.92
+2452642        74113   10873   14659   1834843 6674    45258   10      90      
117167  48      44.56   49.46   36.60   790.56  1756.80 2138.88 2374.08 48.31   
790.56  966.24  1014.55 -1172.64
+2452642        74113   7573    14659   1834843 6674    45258   10      241     
117167  88      90.94   155.50  27.99   0.00    2463.12 8002.72 13684.00        
221.68  0.00    2463.12 2684.80 -5539.60
+2452642        74113   7521    14659   1834843 6674    45258   10      178     
117167  71      26.26   49.63   47.64   0.00    3382.44 1864.46 3523.73 101.47  
0.00    3382.44 3483.91 1517.98
+2452642        74113   4215    14659   1834843 6674    45258   10      173     
117167  95      61.85   113.18  6.79    0.00    645.05  5875.75 10752.10        
32.25   0.00    645.05  677.30  -5230.70
+2452642        74113   3031    14659   1834843 6674    45258   10      117     
117167  47      82.64   157.01  127.17  0.00    5976.99 3884.08 7379.47 298.84  
0.00    5976.99 6275.83 2092.91
+2452642        74113   1818    14659   1834843 6674    45258   10      174     
117167  31      28.80   45.79   31.13   0.00    965.03  892.80  1419.49 38.60   
0.00    965.03  1003.63 72.23
+2452642        74113   1543    14659   1834843 6674    45258   10      242     
117167  92      68.01   134.65  1.34    0.00    123.28  6256.92 12387.80        
4.93    0.00    123.28  128.21  -6133.64
+2452642        74113   991     14659   1834843 6674    45258   10      3       
117167  14      63.40   83.68   35.14   408.32  491.96  887.60  1171.52 3.34    
408.32  83.64   86.98   -803.96
+2452642        74113   834     \N      1834843 6674    \N      10      130     
117167  \N      9.43    \N      \N      \N      812.70  810.98  \N      \N      
\N      \N      \N      \N
+2452642        73780   14937   82793   1784992 791     45343   2       14      
95159   68      69.72   120.61  79.60   0.00    5412.80 4740.96 8201.48 0.00    
0.00    5412.80 5412.80 671.84
+2452642        73780   13860   82793   1784992 791     45343   2       231     
95159   70      36.38   58.57   14.05   0.00    983.50  2546.60 4099.90 29.50   
0.00    983.50  1013.00 -1563.10
+2452642        73780   13614   82793   1784992 791     45343   2       5       
95159   29      15.47   17.79   4.44    0.00    128.76  448.63  515.91  11.58   
0.00    128.76  140.34  -319.87
+2452642        73780   10542   82793   1784992 791     45343   2       172     
95159   19      89.66   161.38  93.60   106.70  1778.40 1703.54 3066.22 100.30  
106.70  1671.70 1772.00 -31.84
+2452642        73780   10128   82793   1784992 791     45343   2       248     
95159   1       75.00   114.75  73.44   0.00    73.44   75.00   114.75  3.67    
0.00    73.44   77.11   -1.56
+2452642        73780   9936    82793   1784992 791     45343   2       1       
95159   21      26.56   33.99   27.87   0.00    585.27  557.76  713.79  35.11   
0.00    585.27  620.38  27.51
+2452642        73780   9915    82793   1784992 791     45343   2       180     
95159   80      67.52   106.68  40.53   0.00    3242.40 5401.60 8534.40 162.12  
0.00    3242.40 3404.52 -2159.20
+2452642        73780   9387    82793   1784992 791     45343   2       80      
95159   78      44.03   81.45   45.61   1280.72 3557.58 3434.34 6353.10 22.76   
1280.72 2276.86 2299.62 -1157.48
+2452642        73780   5131    82793   1784992 791     45343   2       210     
95159   44      73.19   79.04   75.87   0.00    3338.28 3220.36 3477.76 0.00    
0.00    3338.28 3338.28 117.92
+2452642        73780   3330    82793   1784992 791     45343   2       231     
95159   81      89.37   169.80  161.31  0.00    13066.11        7238.97 
13753.80        653.30  0.00    13066.11        13719.41        5827.14
+2452642        73539   16917   90780   1117063 1299    21982   1       81      
59755   33      38.75   61.22   16.52   0.00    545.16  1278.75 2020.26 27.25   
0.00    545.16  572.41  -733.59
+2452642        73539   16669   90780   1117063 1299    21982   1       174     
59755   96      78.31   108.85  40.27   0.00    3865.92 7517.76 10449.60        
231.95  0.00    3865.92 4097.87 -3651.84
+2452642        73539   16176   90780   1117063 1299    21982   1       91      
59755   48      46.04   82.87   38.94   0.00    1869.12 2209.92 3977.76 168.22  
0.00    1869.12 2037.34 -340.80
+2452642        73539   15763   90780   1117063 1299    21982   1       46      
59755   38      86.21   162.07  68.06   0.00    2586.28 3275.98 6158.66 206.90  
0.00    2586.28 2793.18 -689.70
+
diff --git a/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_8.out 
b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_8.out
new file mode 100644
index 0000000000..b5a43fd762
--- /dev/null
+++ b/regression-test/data/tpcds_sf1_p1/sql/test_orderby_key_limit_8.out
@@ -0,0 +1,103 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !test_orderby_key_limit_8 --
+2452642        75582   17899   64251   1311910 1169    13228   1       192     
104393  76      7.47    9.63    5.20    0.00    395.20  567.72  731.88  35.56   
0.00    395.20  430.76  -172.52
+2452642        75582   16866   64251   1311910 1169    13228   1       250     
104393  85      28.33   33.42   18.04   0.00    1533.40 2408.05 2840.70 76.67   
0.00    1533.40 1610.07 -874.65
+2452642        75582   16236   64251   1311910 1169    13228   1       252     
104393  60      7.44    11.30   2.14    0.00    128.40  446.40  678.00  7.70    
0.00    128.40  136.10  -318.00
+2452642        75582   16161   64251   1311910 1169    13228   1       298     
104393  35      67.80   92.20   61.77   0.00    2161.95 2373.00 3227.00 194.57  
0.00    2161.95 2356.52 -211.05
+2452642        75582   15012   64251   1311910 1169    13228   1       109     
104393  26      24.95   24.95   17.46   0.00    453.96  648.70  648.70  27.23   
0.00    453.96  481.19  -194.74
+2452642        75582   11905   64251   1311910 1169    13228   1       145     
104393  22      90.68   130.57  101.84  0.00    2240.48 1994.96 2872.54 0.00    
0.00    2240.48 2240.48 245.52
+2452642        75582   9205    64251   1311910 1169    13228   1       108     
104393  27      47.56   56.59   22.63   580.45  611.01  1284.12 1527.93 2.13    
580.45  30.56   32.69   -1253.56
+2452642        75582   8280    64251   1311910 1169    13228   1       259     
104393  17      51.50   79.82   22.34   0.00    379.78  875.50  1356.94 18.98   
0.00    379.78  398.76  -495.72
+2452642        75582   6345    64251   1311910 1169    13228   1       119     
104393  22      3.01    3.31    2.05    0.00    45.10   66.22   72.82   0.00    
0.00    45.10   45.10   -21.12
+2452642        75582   5400    64251   1311910 1169    13228   1       108     
104393  9       62.26   113.93  71.77   0.00    645.93  560.34  1025.37 51.67   
0.00    645.93  697.60  85.59
+2452642        75582   5215    64251   1311910 1169    13228   1       90      
104393  53      68.98   73.11   19.00   0.00    1007.00 3655.94 3874.83 50.35   
0.00    1007.00 1057.35 -2648.94
+2452642        75582   2185    64251   1311910 1169    13228   1       19      
104393  5       59.37   103.30  19.62   0.00    98.10   296.85  516.50  5.88    
0.00    98.10   103.98  -198.75
+2452642        75582   1921    64251   1311910 1169    13228   1       274     
104393  25      84.61   134.52  43.04   0.00    1076.00 2115.25 3363.00 53.80   
0.00    1076.00 1129.80 -1039.25
+2452642        75582   1101    64251   1311910 1169    13228   1       4       
104393  1       10.40   12.79   4.22    0.00    4.22    10.40   12.79   0.12    
0.00    4.22    4.34    -6.18
+2452642        75582   930     64251   1311910 1169    13228   1       207     
104393  18      50.28   75.92   53.90   0.00    970.20  905.04  1366.56 58.21   
0.00    970.20  1028.41 65.16
+2452642        74917   15307   34569   1077240 2664    28935   8       275     
189488  5       37.63   57.95   44.62   0.00    223.10  188.15  289.75  6.69    
0.00    223.10  229.79  34.95
+2452642        74917   15252   34569   1077240 2664    28935   8       59      
189488  10      33.83   38.56   18.89   0.00    188.90  338.30  385.60  13.22   
0.00    188.90  202.12  -149.40
+2452642        74917   14976   34569   1077240 2664    28935   8       265     
189488  31      77.83   130.75  1.30    0.00    40.30   2412.73 4053.25 2.82    
0.00    40.30   43.12   -2372.43
+2452642        74917   13033   34569   1077240 2664    28935   8       248     
189488  62      52.31   95.72   19.14   0.00    1186.68 3243.22 5934.64 94.93   
0.00    1186.68 1281.61 -2056.54
+2452642        74917   8424    34569   1077240 2664    28935   8       196     
189488  39      92.13   150.17  37.54   0.00    1464.06 3593.07 5856.63 14.64   
0.00    1464.06 1478.70 -2129.01
+2452642        74917   7803    34569   1077240 2664    28935   8       207     
189488  56      44.73   81.40   24.42   0.00    1367.52 2504.88 4558.40 54.70   
0.00    1367.52 1422.22 -1137.36
+2452642        74917   6705    34569   1077240 2664    28935   8       14      
189488  64      83.43   137.65  41.29   0.00    2642.56 5339.52 8809.60 211.40  
0.00    2642.56 2853.96 -2696.96
+2452642        74917   6153    34569   1077240 2664    28935   8       244     
189488  18      1.52    2.79    2.37    0.00    42.66   27.36   50.22   3.83    
0.00    42.66   46.49   15.30
+2452642        74917   4806    34569   1077240 \N      \N      \N      120     
189488  \N      10.09   \N      \N      0.00    861.12  787.02  967.98  0.00    
0.00    861.12  861.12  \N
+2452642        74739   17412   36165   1118342 519     21496   4       222     
122414  47      51.39   78.62   33.02   0.00    1551.94 2415.33 3695.14 139.67  
0.00    1551.94 1691.61 -863.39
+2452642        74739   17265   36165   1118342 519     21496   4       19      
122414  18      35.05   43.46   20.42   158.05  367.56  630.90  782.28  4.19    
158.05  209.51  213.70  -421.39
+2452642        74739   16593   36165   1118342 519     21496   4       175     
122414  48      95.62   98.48   53.17   0.00    2552.16 4589.76 4727.04 51.04   
0.00    2552.16 2603.20 -2037.60
+2452642        74739   15882   36165   1118342 519     21496   4       248     
122414  22      83.67   93.71   1.87    0.00    41.14   1840.74 2061.62 2.87    
0.00    41.14   44.01   -1799.60
+2452642        74739   15817   36165   1118342 519     21496   4       107     
122414  53      73.91   107.90  73.37   0.00    3888.61 3917.23 5718.70 155.54  
0.00    3888.61 4044.15 -28.62
+2452642        74739   14995   36165   1118342 519     21496   4       262     
122414  29      20.97   27.89   26.49   314.96  768.21  608.13  808.81  36.26   
314.96  453.25  489.51  -154.88
+2452642        74739   11445   36165   1118342 519     21496   4       236     
122414  74      10.23   10.84   7.69    0.00    569.06  757.02  802.16  51.21   
0.00    569.06  620.27  -187.96
+2452642        74739   11035   36165   1118342 519     21496   4       25      
122414  2       2.59    4.06    3.08    0.00    6.16    5.18    8.12    0.43    
0.00    6.16    6.59    0.98
+2452642        74739   7195    36165   1118342 519     21496   4       287     
122414  26      49.47   82.12   64.05   0.00    1665.30 1286.22 2135.12 66.61   
0.00    1665.30 1731.91 379.08
+2452642        74739   5265    36165   1118342 519     21496   4       35      
122414  6       64.60   65.89   30.30   0.00    181.80  387.60  395.34  3.63    
0.00    181.80  185.43  -205.80
+2452642        74739   4893    36165   1118342 519     21496   4       269     
122414  61      34.85   58.89   4.12    70.36   251.32  2125.85 3592.29 5.42    
70.36   180.96  186.38  -1944.89
+2452642        74739   1401    36165   1118342 519     21496   4       8       
122414  17      71.93   72.64   19.61   243.36  333.37  1222.81 1234.88 6.30    
243.36  90.01   96.31   -1132.80
+2452642        74739   793     36165   1118342 519     21496   4       47      
122414  58      91.39   118.80  106.92  1364.29 6201.36 5300.62 6890.40 48.37   
1364.29 4837.07 4885.44 -463.55
+2452642        74732   17917   35935   598888  3441    28794   1       165     
90399   9       99.33   145.02  59.45   0.00    535.05  893.97  1305.18 10.70   
0.00    535.05  545.75  -358.92
+2452642        74732   16242   35935   \N      3441    28794   1       111     
90399   \N      18.25   19.34   0.38    0.00    33.82   \N      \N      1.01    
0.00    \N      34.83   -1590.43
+2452642        74732   13128   35935   598888  3441    28794   1       89      
90399   37      84.38   151.88  148.84  0.00    5507.08 3122.06 5619.56 165.21  
0.00    5507.08 5672.29 2385.02
+2452642        74732   12709   35935   598888  3441    28794   1       170     
90399   59      54.71   92.45   24.96   0.00    1472.64 3227.89 5454.55 132.53  
0.00    1472.64 1605.17 -1755.25
+2452642        74732   10416   35935   598888  3441    28794   1       45      
90399   48      2.87    5.36    4.87    0.00    233.76  137.76  257.28  0.00    
0.00    233.76  233.76  96.00
+2452642        74732   9607    35935   598888  3441    28794   1       39      
90399   6       5.49    8.83    6.35    0.00    38.10   32.94   52.98   0.76    
0.00    38.10   38.86   5.16
+2452642        74732   6295    35935   598888  3441    28794   1       40      
90399   62      86.00   116.96  83.04   0.00    5148.48 5332.00 7251.52 463.36  
0.00    5148.48 5611.84 -183.52
+2452642        74732   2925    35935   598888  3441    28794   1       171     
90399   62      86.77   142.30  29.88   0.00    1852.56 5379.74 8822.60 18.52   
0.00    1852.56 1871.08 -3527.18
+2452642        74632   17694   12929   1852276 5223    20123   7       241     
6701    18      41.04   48.01   12.48   0.00    224.64  738.72  864.18  6.73    
0.00    224.64  231.37  -514.08
+2452642        74632   15709   12929   1852276 5223    20123   7       52      
6701    70      60.01   92.41   74.85   0.00    5239.50 4200.70 6468.70 261.97  
0.00    5239.50 5501.47 1038.80
+2452642        74632   15600   12929   1852276 5223    20123   7       130     
6701    8       49.93   77.39   55.72   0.00    445.76  399.44  619.12  31.20   
0.00    445.76  476.96  46.32
+2452642        74632   13335   12929   1852276 5223    20123   7       44      
6701    25      66.81   127.60  76.56   0.00    1914.00 1670.25 3190.00 57.42   
0.00    1914.00 1971.42 243.75
+2452642        74632   12483   12929   1852276 5223    20123   7       286     
6701    49      3.20    3.96    1.66    0.00    81.34   156.80  194.04  0.00    
0.00    81.34   81.34   -75.46
+2452642        74632   12444   12929   1852276 5223    20123   7       103     
6701    78      87.12   132.42  60.91   0.00    4750.98 6795.36 10328.76        
142.52  0.00    4750.98 4893.50 -2044.38
+2452642        74632   9207    12929   1852276 5223    20123   7       129     
6701    39      66.20   127.76  99.65   0.00    3886.35 2581.80 4982.64 349.77  
0.00    3886.35 4236.12 1304.55
+2452642        74632   8706    12929   1852276 5223    20123   7       192     
6701    64      47.32   87.54   15.75   0.00    1008.00 3028.48 5602.56 70.56   
0.00    1008.00 1078.56 -2020.48
+2452642        74632   8235    12929   1852276 5223    20123   7       295     
6701    90      92.87   127.23  62.34   0.00    5610.60 8358.30 11450.70        
0.00    0.00    5610.60 5610.60 -2747.70
+2452642        74632   6241    12929   1852276 5223    20123   7       174     
6701    47      36.04   39.28   0.39    4.58    18.33   1693.88 1846.16 0.55    
4.58    13.75   14.30   -1680.13
+2452642        74632   5841    12929   1852276 5223    20123   7       168     
6701    41      33.73   51.94   30.64   0.00    1256.24 1382.93 2129.54 12.56   
0.00    1256.24 1268.80 -126.69
+2452642        74632   4527    12929   1852276 5223    20123   7       238     
6701    48      87.43   153.00  90.27   0.00    4332.96 4196.64 7344.00 86.65   
0.00    4332.96 4419.61 136.32
+2452642        74365   17197   19663   684197  3131    24112   10      274     
142743  79      81.12   117.62  14.11   256.37  1114.69 6408.48 9291.98 42.91   
256.37  858.32  901.23  -5550.16
+2452642        74365   16609   19663   684197  3131    24112   10      51      
142743  96      64.05   87.74   78.08   4347.49 7495.68 6148.80 8423.04 188.89  
4347.49 3148.19 3337.08 -3000.61
+2452642        74365   16578   19663   684197  3131    24112   10      71      
142743  52      19.76   24.70   3.45    0.00    179.40  1027.52 1284.40 14.35   
0.00    179.40  193.75  -848.12
+2452642        74365   12873   19663   684197  3131    24112   10      287     
142743  66      39.84   64.14   48.74   0.00    3216.84 2629.44 4233.24 225.17  
0.00    3216.84 3442.01 587.40
+2452642        74365   9379    19663   684197  3131    24112   10      15      
142743  99      13.97   23.46   21.81   0.00    2159.19 1383.03 2322.54 0.00    
0.00    2159.19 2159.19 776.16
+2452642        74365   8376    19663   684197  3131    24112   10      4       
142743  18      24.89   32.85   7.55    0.00    135.90  448.02  591.30  2.71    
0.00    135.90  138.61  -312.12
+2452642        74365   3721    19663   684197  3131    24112   10      153     
142743  4       91.59   137.38  35.71   0.00    142.84  366.36  549.52  1.42    
0.00    142.84  144.26  -223.52
+2452642        74365   867     19663   684197  3131    24112   10      110     
142743  44      72.74   125.11  58.80   776.16  2587.20 3200.56 5504.84 108.66  
776.16  1811.04 1919.70 -1389.52
+2452642        74360   17532   8740    243373  2006    43886   1       276     
27274   33      61.01   78.09   47.63   0.00    1571.79 2013.33 2576.97 110.02  
0.00    1571.79 1681.81 -441.54
+2452642        74360   17191   8740    243373  2006    43886   1       137     
27274   16      62.14   62.14   16.15   74.93   258.40  994.24  994.24  16.51   
74.93   183.47  199.98  -810.77
+2452642        74360   14067   8740    243373  2006    43886   1       52      
27274   61      54.85   63.07   35.94   0.00    2192.34 3345.85 3847.27 43.84   
0.00    2192.34 2236.18 -1153.51
+2452642        74360   13921   8740    243373  2006    43886   1       232     
27274   61      68.72   120.94  42.32   0.00    2581.52 4191.92 7377.34 129.07  
0.00    2581.52 2710.59 -1610.40
+2452642        74360   13617   8740    243373  2006    43886   1       299     
27274   9       45.49   82.79   27.32   0.00    245.88  409.41  745.11  14.75   
0.00    245.88  260.63  -163.53
+2452642        74360   11881   8740    243373  2006    43886   1       39      
27274   86      3.48    6.47    2.71    0.00    233.06  299.28  556.42  2.33    
0.00    233.06  235.39  -66.22
+2452642        74360   4359    8740    243373  2006    43886   1       19      
27274   88      41.88   68.68   16.48   0.00    1450.24 3685.44 6043.84 116.01  
0.00    1450.24 1566.25 -2235.20
+2452642        74360   3553    8740    243373  2006    43886   1       134     
27274   22      25.69   39.04   6.24    0.00    137.28  565.18  858.88  8.23    
0.00    137.28  145.51  -427.90
+2452642        74360   2113    8740    243373  2006    43886   1       122     
27274   23      23.75   23.98   0.00    0.00    0.00    546.25  551.54  0.00    
0.00    0.00    0.00    -546.25
+2452642        74113   16677   14659   1834843 6674    45258   10      217     
117167  75      71.24   123.24  114.61  3610.21 8595.75 5343.00 9243.00 348.98  
3610.21 4985.54 5334.52 -357.46
+2452642        74113   16489   14659   1834843 6674    45258   10      10      
117167  39      57.38   87.79   28.97   0.00    1129.83 2237.82 3423.81 11.29   
0.00    1129.83 1141.12 -1107.99
+2452642        74113   15516   14659   1834843 6674    45258   10      87      
117167  27      57.26   68.71   10.30   0.00    278.10  1546.02 1855.17 11.12   
0.00    278.10  289.22  -1267.92
+2452642        74113   10873   14659   1834843 6674    45258   10      90      
117167  48      44.56   49.46   36.60   790.56  1756.80 2138.88 2374.08 48.31   
790.56  966.24  1014.55 -1172.64
+2452642        74113   7573    14659   1834843 6674    45258   10      241     
117167  88      90.94   155.50  27.99   0.00    2463.12 8002.72 13684.00        
221.68  0.00    2463.12 2684.80 -5539.60
+2452642        74113   7521    14659   1834843 6674    45258   10      178     
117167  71      26.26   49.63   47.64   0.00    3382.44 1864.46 3523.73 101.47  
0.00    3382.44 3483.91 1517.98
+2452642        74113   4215    14659   1834843 6674    45258   10      173     
117167  95      61.85   113.18  6.79    0.00    645.05  5875.75 10752.10        
32.25   0.00    645.05  677.30  -5230.70
+2452642        74113   3031    14659   1834843 6674    45258   10      117     
117167  47      82.64   157.01  127.17  0.00    5976.99 3884.08 7379.47 298.84  
0.00    5976.99 6275.83 2092.91
+2452642        74113   1818    14659   1834843 6674    45258   10      174     
117167  31      28.80   45.79   31.13   0.00    965.03  892.80  1419.49 38.60   
0.00    965.03  1003.63 72.23
+2452642        74113   1543    14659   1834843 6674    45258   10      242     
117167  92      68.01   134.65  1.34    0.00    123.28  6256.92 12387.80        
4.93    0.00    123.28  128.21  -6133.64
+2452642        74113   991     14659   1834843 6674    45258   10      3       
117167  14      63.40   83.68   35.14   408.32  491.96  887.60  1171.52 3.34    
408.32  83.64   86.98   -803.96
+2452642        74113   834     \N      1834843 6674    \N      10      130     
117167  \N      9.43    \N      \N      \N      812.70  810.98  \N      \N      
\N      \N      \N      \N
+2452642        73780   14937   82793   1784992 791     45343   2       14      
95159   68      69.72   120.61  79.60   0.00    5412.80 4740.96 8201.48 0.00    
0.00    5412.80 5412.80 671.84
+2452642        73780   13860   82793   1784992 791     45343   2       231     
95159   70      36.38   58.57   14.05   0.00    983.50  2546.60 4099.90 29.50   
0.00    983.50  1013.00 -1563.10
+2452642        73780   13614   82793   1784992 791     45343   2       5       
95159   29      15.47   17.79   4.44    0.00    128.76  448.63  515.91  11.58   
0.00    128.76  140.34  -319.87
+2452642        73780   10542   82793   1784992 791     45343   2       172     
95159   19      89.66   161.38  93.60   106.70  1778.40 1703.54 3066.22 100.30  
106.70  1671.70 1772.00 -31.84
+2452642        73780   10128   82793   1784992 791     45343   2       248     
95159   1       75.00   114.75  73.44   0.00    73.44   75.00   114.75  3.67    
0.00    73.44   77.11   -1.56
+2452642        73780   9936    82793   1784992 791     45343   2       1       
95159   21      26.56   33.99   27.87   0.00    585.27  557.76  713.79  35.11   
0.00    585.27  620.38  27.51
+2452642        73780   9915    82793   1784992 791     45343   2       180     
95159   80      67.52   106.68  40.53   0.00    3242.40 5401.60 8534.40 162.12  
0.00    3242.40 3404.52 -2159.20
+2452642        73780   9387    82793   1784992 791     45343   2       80      
95159   78      44.03   81.45   45.61   1280.72 3557.58 3434.34 6353.10 22.76   
1280.72 2276.86 2299.62 -1157.48
+2452642        73780   5131    82793   1784992 791     45343   2       210     
95159   44      73.19   79.04   75.87   0.00    3338.28 3220.36 3477.76 0.00    
0.00    3338.28 3338.28 117.92
+2452642        73780   3330    82793   1784992 791     45343   2       231     
95159   81      89.37   169.80  161.31  0.00    13066.11        7238.97 
13753.80        653.30  0.00    13066.11        13719.41        5827.14
+2452642        73539   16917   90780   1117063 1299    21982   1       81      
59755   33      38.75   61.22   16.52   0.00    545.16  1278.75 2020.26 27.25   
0.00    545.16  572.41  -733.59
+2452642        73539   16669   90780   1117063 1299    21982   1       174     
59755   96      78.31   108.85  40.27   0.00    3865.92 7517.76 10449.60        
231.95  0.00    3865.92 4097.87 -3651.84
+2452642        73539   16176   90780   1117063 1299    21982   1       91      
59755   48      46.04   82.87   38.94   0.00    1869.12 2209.92 3977.76 168.22  
0.00    1869.12 2037.34 -340.80
+2452642        73539   15763   90780   1117063 1299    21982   1       46      
59755   38      86.21   162.07  68.06   0.00    2586.28 3275.98 6158.66 206.90  
0.00    2586.28 2793.18 -689.70
+
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_1.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_1.sql
new file mode 100644
index 0000000000..b59947bc6d
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_1.sql
@@ -0,0 +1,3 @@
+SELECT ss_sold_date_sk FROM store_sales
+ORDER BY ss_sold_date_sk
+LIMIT 100
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_2.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_2.sql
new file mode 100644
index 0000000000..21b7d106d6
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_2.sql
@@ -0,0 +1,3 @@
+SELECT ss_sold_date_sk, ss_sold_time_sk FROM store_sales
+ORDER BY ss_sold_date_sk, ss_sold_time_sk
+LIMIT 100
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_3.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_3.sql
new file mode 100644
index 0000000000..81c7e9baef
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_3.sql
@@ -0,0 +1,3 @@
+SELECT ss_sold_date_sk, ss_sold_time_sk, ss_item_sk FROM store_sales
+ORDER BY ss_sold_date_sk, ss_sold_time_sk, ss_item_sk
+LIMIT 100
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_4.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_4.sql
new file mode 100644
index 0000000000..2538be7618
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_4.sql
@@ -0,0 +1,3 @@
+SELECT ss_sold_date_sk, ss_sold_time_sk, ss_item_sk, ss_customer_sk FROM 
store_sales
+ORDER BY ss_sold_date_sk, ss_sold_time_sk, ss_item_sk, ss_customer_sk
+LIMIT 100
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_5.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_5.sql
new file mode 100644
index 0000000000..7b26c702ad
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_5.sql
@@ -0,0 +1,3 @@
+SELECT ss_sold_date_sk FROM store_sales
+ORDER BY ss_sold_date_sk DESC
+LIMIT 100
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_6.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_6.sql
new file mode 100644
index 0000000000..857e4d1a05
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_6.sql
@@ -0,0 +1,3 @@
+SELECT ss_sold_date_sk, ss_sold_time_sk FROM store_sales
+ORDER BY ss_sold_date_sk DESC, ss_sold_time_sk DESC
+LIMIT 100
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_7.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_7.sql
new file mode 100644
index 0000000000..e16fcea484
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_7.sql
@@ -0,0 +1,3 @@
+SELECT * FROM store_sales
+ORDER BY ss_sold_date_sk DESC, ss_sold_time_sk DESC, ss_item_sk DESC
+LIMIT 100
diff --git 
a/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_8.sql 
b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_8.sql
new file mode 100644
index 0000000000..efe9ba6d3f
--- /dev/null
+++ b/regression-test/suites/tpcds_sf1_p1/sql/test_orderby_key_limit_8.sql
@@ -0,0 +1,3 @@
+SELECT * FROM store_sales
+ORDER BY ss_sold_date_sk DESC, ss_sold_time_sk DESC, ss_item_sk DESC, 
ss_customer_sk DESC
+LIMIT 100


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org


Reply via email to