You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/01/16 08:50:06 UTC
[doris] branch master updated: [regression-test](topn)add test cases for nonkey topn query for each scalar type (#15790)
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 806cd9fb3c [regression-test](topn)add test cases for nonkey topn query for each scalar type (#15790)
806cd9fb3c is described below
commit 806cd9fb3caab9e1a9dd991351f5824236e53863
Author: Kang <kx...@gmail.com>
AuthorDate: Mon Jan 16 16:49:59 2023 +0800
[regression-test](topn)add test cases for nonkey topn query for each scalar type (#15790)
related to #15558 #15693
1. dup key table with 17 scalar datatypes
2. unique key table with mow enabled
3. unique key table with mow disabled
---
.../sql/dup_nonkey_topn_q01_bool_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q01_bool_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q02_tinyint_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q02_tinyint_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q03_smallint_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q03_smallint_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q04_int_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q04_int_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q05_bigint_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q05_bigint_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q06_largeint_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q06_largeint_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q07_float_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q07_float_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q08_double_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q08_double_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q09_decimal_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q09_decimal_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q10_decimalv3_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q10_decimalv3_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q11_date_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q11_date_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q12_datetime_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q12_datetime_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q13_datev2_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q13_datev2_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q14_datetimev2_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q14_datetimev2_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q15_char_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q15_char_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q16_varchar_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q16_varchar_desc.out | 23 ++++
.../sql/dup_nonkey_topn_q17_string_asc.out | 23 ++++
.../sql/dup_nonkey_topn_q17_string_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q01_bool_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q01_bool_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q02_tinyint_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q02_tinyint_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q03_smallint_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q03_smallint_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q04_int_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q04_int_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q05_bigint_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q05_bigint_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q06_largeint_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q06_largeint_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q07_float_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q07_float_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q08_double_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q08_double_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q09_decimal_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q09_decimal_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q10_decimalv3_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q10_decimalv3_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q11_date_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q11_date_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q12_datetime_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q12_datetime_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q13_datev2_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q13_datev2_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q14_datetimev2_asc.out | 23 ++++
.../unique1_nonkey_topn_q14_datetimev2_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q15_char_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q15_char_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q16_varchar_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q16_varchar_desc.out | 23 ++++
.../sql/unique1_nonkey_topn_q17_string_asc.out | 23 ++++
.../sql/unique1_nonkey_topn_q17_string_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q01_bool_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q01_bool_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q02_tinyint_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q02_tinyint_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q03_smallint_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q03_smallint_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q04_int_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q04_int_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q05_bigint_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q05_bigint_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q06_largeint_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q06_largeint_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q07_float_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q07_float_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q08_double_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q08_double_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q09_decimal_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q09_decimal_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q10_decimalv3_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q10_decimalv3_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q11_date_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q11_date_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q12_datetime_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q12_datetime_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q13_datev2_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q13_datev2_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q14_datetimev2_asc.out | 23 ++++
.../unique2_nonkey_topn_q14_datetimev2_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q15_char_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q15_char_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q16_varchar_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q16_varchar_desc.out | 23 ++++
.../sql/unique2_nonkey_topn_q17_string_asc.out | 23 ++++
.../sql/unique2_nonkey_topn_q17_string_desc.out | 23 ++++
.../suites/datatype_p0/scalar_types/load.groovy | 151 +++++++++++++++++++++
.../sql/dup_nonkey_topn_q01_bool_asc.sql | 1 +
.../sql/dup_nonkey_topn_q01_bool_desc.sql | 1 +
.../sql/dup_nonkey_topn_q02_tinyint_asc.sql | 1 +
.../sql/dup_nonkey_topn_q02_tinyint_desc.sql | 1 +
.../sql/dup_nonkey_topn_q03_smallint_asc.sql | 1 +
.../sql/dup_nonkey_topn_q03_smallint_desc.sql | 1 +
.../sql/dup_nonkey_topn_q04_int_asc.sql | 1 +
.../sql/dup_nonkey_topn_q04_int_desc.sql | 1 +
.../sql/dup_nonkey_topn_q05_bigint_asc.sql | 1 +
.../sql/dup_nonkey_topn_q05_bigint_desc.sql | 1 +
.../sql/dup_nonkey_topn_q06_largeint_asc.sql | 1 +
.../sql/dup_nonkey_topn_q06_largeint_desc.sql | 1 +
.../sql/dup_nonkey_topn_q07_float_asc.sql | 1 +
.../sql/dup_nonkey_topn_q07_float_desc.sql | 1 +
.../sql/dup_nonkey_topn_q08_double_asc.sql | 1 +
.../sql/dup_nonkey_topn_q08_double_desc.sql | 1 +
.../sql/dup_nonkey_topn_q09_decimal_asc.sql | 1 +
.../sql/dup_nonkey_topn_q09_decimal_desc.sql | 1 +
.../sql/dup_nonkey_topn_q10_decimalv3_asc.sql | 1 +
.../sql/dup_nonkey_topn_q10_decimalv3_desc.sql | 1 +
.../sql/dup_nonkey_topn_q11_date_asc.sql | 1 +
.../sql/dup_nonkey_topn_q11_date_desc.sql | 1 +
.../sql/dup_nonkey_topn_q12_datetime_asc.sql | 1 +
.../sql/dup_nonkey_topn_q12_datetime_desc.sql | 1 +
.../sql/dup_nonkey_topn_q13_datev2_asc.sql | 1 +
.../sql/dup_nonkey_topn_q13_datev2_desc.sql | 1 +
.../sql/dup_nonkey_topn_q14_datetimev2_asc.sql | 1 +
.../sql/dup_nonkey_topn_q14_datetimev2_desc.sql | 1 +
.../sql/dup_nonkey_topn_q15_char_asc.sql | 1 +
.../sql/dup_nonkey_topn_q15_char_desc.sql | 1 +
.../sql/dup_nonkey_topn_q16_varchar_asc.sql | 1 +
.../sql/dup_nonkey_topn_q16_varchar_desc.sql | 1 +
.../sql/dup_nonkey_topn_q17_string_asc.sql | 1 +
.../sql/dup_nonkey_topn_q17_string_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q01_bool_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q01_bool_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q02_tinyint_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q02_tinyint_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q03_smallint_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q03_smallint_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q04_int_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q04_int_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q05_bigint_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q05_bigint_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q06_largeint_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q06_largeint_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q07_float_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q07_float_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q08_double_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q08_double_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q09_decimal_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q09_decimal_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q10_decimalv3_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q10_decimalv3_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q11_date_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q11_date_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q12_datetime_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q12_datetime_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q13_datev2_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q13_datev2_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q14_datetimev2_asc.sql | 1 +
.../unique1_nonkey_topn_q14_datetimev2_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q15_char_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q15_char_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q16_varchar_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q16_varchar_desc.sql | 1 +
.../sql/unique1_nonkey_topn_q17_string_asc.sql | 1 +
.../sql/unique1_nonkey_topn_q17_string_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q01_bool_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q01_bool_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q02_tinyint_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q02_tinyint_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q03_smallint_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q03_smallint_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q04_int_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q04_int_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q05_bigint_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q05_bigint_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q06_largeint_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q06_largeint_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q07_float_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q07_float_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q08_double_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q08_double_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q09_decimal_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q09_decimal_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q10_decimalv3_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q10_decimalv3_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q11_date_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q11_date_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q12_datetime_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q12_datetime_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q13_datev2_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q13_datev2_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q14_datetimev2_asc.sql | 1 +
.../unique2_nonkey_topn_q14_datetimev2_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q15_char_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q15_char_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q16_varchar_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q16_varchar_desc.sql | 1 +
.../sql/unique2_nonkey_topn_q17_string_asc.sql | 1 +
.../sql/unique2_nonkey_topn_q17_string_desc.sql | 1 +
205 files changed, 2599 insertions(+)
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_asc.out
new file mode 100644
index 0000000000..baa2f2dc30
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q01_bool_asc --
+-1298782207 false 0 21661 27910 -2147483358 50137345 -31890.162 2.5182778747432E8 8892361240908133.332 16697470310045199.514 2022-03-29 2022-05-06T07:35:41 2022-02-20 2022-06-13T07:08:23 86.198.4.14 tHarrison@Yotz.edu Ohio Terrace 97
+-1438836446 false -106 25720 2137 -2147480317 -1044710620 19297.592 -4.6721094672452E7 74446297684183183.297 10126355674710455.926 2022-02-12 2022-02-10T22:47:34 2022-08-24 2022-07-16T17:14:43 176.57.174.210 2Jacobs@Oloo.edu Sunfield Pass 74
+-1931640422 false 81 -17173 20232 -2147474804 1094003829 -21709.188 -1.487469632520682E9 37494213942760235.318 5170475614524523.563 2022-03-29 2022-07-02T11:19:41 2022-07-14 2022-03-12T18:09:32 222.252.244.150 at_non@Feedbug.biz Division Parkway 27
+-1438874983 false -39 -17552 22077 -2147474201 819770754 3815.9624 -3.07788874880729E8 22473676566411893.142 49303092715634273.638 2022-02-17 2022-07-22T02:13:31 2022-07-02 2022-02-07T15:19:07 176.107.188.43 ipsa@Photobug.org Algoma Center 6
+-211415263 false 82 28127 -16794 -2147468104 953496574 -2973.964 1.538181391859708E9 55664064661456781.100 27727896561928356.763 2022-07-30 2022-04-25T14:47:28 2022-12-25 2022-11-04T19:40:54 93.64.145.202 SarahOliver@Topicblab.net Shopko Alley 97
+2011554557 false 114 -15050 4397 -2147464684 1467965089 24381.705 -6.7825676777073E7 89275295308566490.932 52641288250964188.795 2022-11-01 2022-06-23T04:06:05 2022-09-30 2022-09-02T05:05:13 30.43.252.68 lDiaz@Kwideo.info Quincy Road 30
+-984991914 false -85 -5897 -29349 -2147452176 1525786458 13439.43 1.580339430307399E9 4315552136410587.989 42963905746019101.945 2022-01-19 2022-01-30T20:58:15 2023-01-02 2022-06-20T17:19:49 204.35.13.187 DonaldOwens@Gabvine.com Continental Crossing 89
+-435544076 false 100 5626 10817 -2147449203 -1071291634 -32229.045 -3.63129015178875E8 12284411005290507.833 26373576153379339.703 2022-11-01 2022-05-13T23:57:47 2022-06-29 2022-05-02T20:24:54 142.56.17.46 9Price@Fliptune.net Monument Hill 80
+-1977872093 false -128 -12502 18730 -2147447412 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 11774006348685852.217 2022-06-13 2022-06-08T00:10:42 2022-01-19 2022-12-12T15:38:03 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+-1810469346 false -106 -18847 28383 -2147445583 -249047381 -25610.389 -1.172353483917956E9 29809461999773154.513 48715652698659874.382 2022-10-04 2022-03-22T06:00:02 2022-11-08 2022-09-09T18:14:23 86.232.2.134 odio_distinctio@Einti.com Mallory Place 2
+1768235949 false -98 3388 -7469 -2147440231 -520983933 10625.003 2.03995201402268E9 3462857055462597.650 34028908311454481.592 2022-01-26 2022-11-01T00:41:21 2022-08-16 2022-09-11T03:05:51 129.54.117.50 amet_ea@Quimba.name Butternut Alley 71
+-16187558 false 126 26815 -11284 -2147429509 -688010171 27046.46 -5.27072353971484E8 66247237013637477.644 89258793731621871.659 2022-10-01 2022-09-08T08:07:23 2022-07-21 2022-03-04T17:56:58 8.115.159.161 AnthonyGriffin@Katz.edu Fordem Plaza 6
+-1519721169 false 110 23694 10888 -2147429313 2044460430 15311.488 1.375307496401204E9 53151235042978489.270 61886285781136168.806 2022-08-11 2022-10-20T13:09:41 2022-05-13 2022-12-02T03:44:10 193.174.176.52 JoyceChavez@Eayo.com Bay Place 92
+1606397914 false 14 -1228 32445 -2147426673 -1925449184 32501.54 -2.39912871351486E8 55348475727816727.866 89764720990212770.220 2022-12-10 2022-01-16T21:35:19 2022-04-12 2022-01-24T23:50:40 18.231.153.73 8Clark@Kare.info Manley Place 39
+-1940445675 false 26 -30748 7400 -2147394395 1258683172 -27487.441 4.33082826182803E8 45348180393347858.264 14678495134516321.939 2022-04-09 2022-10-04T18:07:27 2022-04-13 2022-02-27T06:18:59 144.218.112.167 BrandonHart@Gigabox.gov Lakewood Hill 77
+-997382692 false 52 2101 27388 -2147383849 -511873914 13334.803 1.406773860292186E9 93516878967509776.434 57756485700967354.947 2022-06-04 2022-05-10T05:58:30 2022-04-10 2022-10-15T02:27:14 151.25.124.55 bGutierrez@Realcube.gov Bultman Pass 95
+391236510 false -67 -11231 -2125 -2147383439 -1738258888 28451.842 -4.49988538175004E8 28398963940839059.717 29228393040815920.274 2022-12-01 2022-06-16T08:26:30 2022-03-19 2022-09-12T03:34:38 140.243.38.93 rBell@Youbridge.info Dovetail Terrace 51
+-973612483 false -24 -21797 -23643 -2147369442 -789601264 -29951.023 -1.094422939727163E9 83680832437281060.324 95280790050572342.278 2022-12-30 2022-10-09T06:30:35 2022-06-23 2022-06-16T12:08:56 65.65.41.22 NicoleBlack@Vitz.com Marcy Avenue 83
+-45643441 false -70 -29980 14978 -2147360972 -1782596577 22961.69 -1.458730846514128E9 71947137678798367.780 34160135921220642.561 2022-05-02 2022-12-28T23:38:41 2022-12-10 2022-09-14T05:20:55 192.115.131.183 quaerat_rem@Voolia.gov Sachtjen Road 56
+-118804714 false -99 -31982 15642 -2147356155 2037570311 -28052.602 -1.251616108720754E9 56934260571029675.510 10694832387001448.166 2022-12-23 2022-09-02T08:08:49 2022-05-30 2022-08-07T09:34:26 156.238.169.183 animi_quidem@Eidel.net Springview Plaza 31
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_desc.out
new file mode 100644
index 0000000000..fd8075cd6f
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q01_bool_desc --
+557179323 true -23 -15598 -10213 2147473376 -794130865 25225.979 -1.060667482169878E9 19712527510160101.667 45825484466840064.118 2022-08-23 2022-09-07T09:37:41 2022-06-06 2022-01-28T07:05:42 199.195.172.243 BenjaminGreene@Devify.org Hoffman Road 93
+1824844955 true -5 28431 -17708 2147467668 -947082776 26115.467 -1.064859020746046E9 12851908920109725.570 17196762472988513.310 2022-12-17 2022-11-09T06:13:10 2022-05-22 2022-10-26T15:14:11 14.249.104.252 qMarshall@Yamia.mil Schurz Junction 33
+1057517775 true 28 16452 -30571 2147447138 -2075189185 22385.588 -3.55214861990496E8 11932816216934343.652 50480005137427111.177 2022-08-23 2022-10-21T03:38:58 2022-10-21 2022-05-18T22:01:25 234.3.203.12 CarlMurphy@Wikivu.biz Northport Way 26
+-1786553019 true -65 -22474 14929 2147446227 1989464327 9511.273 5.86654785560309E8 79596075449045726.816 39942552524190612.962 2022-11-07 2022-06-21T12:58:35 2022-11-24 2022-07-11T06:10:41 19.107.68.34 tSanders@Jaxnation.biz Farragut Point 44
+-57438535 true 91 -17156 8627 2147444078 1521831153 11225.079 2.09693779861494E8 8183865884308683.425 80627252554457775.754 2022-11-08 2022-04-03T00:29:22 2022-03-20 2022-06-13T04:42:29 233.68.240.228 3Martinez@Browsedrive.info Donald Crossing 7
+-1642822773 true 28 22783 -31955 2147434485 -940172357 12963.05 -1.015348724865612E9 21415159800393256.390 1432088841386171.665 2022-09-01 2022-09-17T21:00:35 2022-04-11 2022-07-10T04:17:41 234.6.225.52 MelissaHenry@Realpoint.biz Bultman Court 97
+666196227 true -111 24610 -30943 2147432357 -1776521623 -7130.226 -5.00592536993921E8 16271114464316416.681 56924709102413625.675 2022-03-24 2022-01-23T12:31:45 2022-05-28 2022-03-26T23:37:01 58.48.43.183 ChrisJacobs@Buzzster.name Leroy Pass 32
+1747398517 true -17 -3026 29468 2147425822 -1873981318 25636.371 6.43280347073812E8 90354184407027392.172 33378418596041889.584 2022-06-28 2022-02-24T12:47:51 2022-10-15 2022-08-24T06:52:46 97.226.248.251 qRussell@Cogilith.name Kings Place 83
+515665109 true -1 -17372 20231 2147425482 635029396 -19429.021 6.56125881323546E8 7165704130056347.115 6517881695345385.105 2022-06-13 2022-12-05T18:10:15 2022-12-05 2022-05-04T22:35:17 243.50.186.81 ErnestFlores@Thoughtbridge.com Dixon Court 53
+1728198625 true 26 16950 8811 2147419311 1233278399 -103.00702 1.520246238447387E9 88652736846204706.947 28290293258808439.134 2022-03-10 2022-08-07T15:58:44 2022-05-23 2022-07-05T21:37:51 133.108.194.1 DeniseRamos@Shufflebeat.net Mifflin Junction 55
+-2021504137 true 15 -29566 3184 2147375954 1446182442 27525.846 -1.443946518312972E9 17957789229933477.747 28228200342554508.463 2022-10-04 2022-01-26T03:41:36 2022-11-04 2022-08-09T07:43:48 119.180.253.71 beatae@Gigazoom.mil Warbler Center 96
+-1637210814 true -96 10681 20459 2147373423 1339500570 -11608.654 -3.93375885580383E8 36042489765482544.378 1637907410895731.258 2022-03-13 2022-03-12T22:06:49 2022-02-06 2022-05-28T17:02:01 44.122.107.86 JaneMorgan@Meembee.gov Washington Plaza 39
+-229329332 true 27 -13477 11315 2147368042 231988388 18722.197 7.36279137148427E8 9745163628451074.185 29068106840796910.714 2022-11-23 2022-08-02T08:01:28 2022-06-14 2022-07-06T16:00:59 135.125.99.160 vLittle@Lajo.com Weeping Birch Plaza 51
+-1478707179 true -51 15176 -9717 2147361419 281926529 -28998.344 1.014652450168952E9 64008372108259969.509 66235090663479853.137 2022-01-14 2022-01-16T14:56:11 2022-03-01 2022-01-28T17:36:34 25.158.126.209 LauraCrawford@Rooxo.mil Muir Circle 73
+-1486382067 true -66 3884 -6259 2147361117 942799387 -31530.1 9.7573614242114E7 79407496412683634.664 1344175823772476.813 2022-01-20 2022-10-12T06:08:47 2022-07-14 2022-01-18T01:55:01 9.97.60.8 0Brooks@Avamba.info Golden Leaf Pass 69
+-1928038040 true 36 11194 12156 2147356019 -436138908 -28744.945 4.20634527634209E8 4496968200996145.117 92590184406014430.471 2022-12-16 2022-08-12T22:39:19 2022-04-03 2022-10-27T20:30:25 7.109.111.0 non_et@Vitz.info Gerald Alley 31
+1194019633 true -19 27852 21157 2147355776 -1872018283 26782.947 1.38643630286072E8 29573321742106989.137 7961742472373102.406 2022-06-08 2022-06-12T19:28:07 2022-10-19 2022-07-30T21:15:19 246.25.242.131 3Gardner@Flashspan.edu International Terrace 11
+1296226618 true 2 -29308 29440 2147352335 921017929 11988.182 8.24736685451722E8 9835279556807483.866 80764280990878997.426 2022-04-25 2022-06-27T00:38:47 2022-07-19 2022-11-26T19:49:17 125.250.128.104 gCarter@Vimbo.mil Butternut Pass 36
+229643304 true 31 5348 12735 2147349942 1083196085 -11532.327 -5.88257975589088E8 16614091336559109.461 84133377525592228.154 2022-02-18 2022-01-22T00:13:52 2022-12-22 2023-01-03T05:22:23 150.74.85.3 ChrisGibson@Plajo.biz Brentwood Road 76
+545177272 true 65 -13772 14606 2147325698 -1653013708 10253.94 -1.966317816086957E9 53022579230034648.990 9725750329249688.208 2022-12-04 2022-11-01T04:09:20 2022-02-23 2022-11-28T17:14:43 241.217.119.108 dolore_dolore_minima@Babblestorm.info Division Junction 1
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_asc.out
new file mode 100644
index 0000000000..fb38931bc5
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q02_tinyint_asc --
+-1977872093 false -128 -12502 18730 -2147447412 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 11774006348685852.217 2022-06-13 2022-06-08T00:10:42 2022-01-19 2022-12-12T15:38:03 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+-1544918542 true -128 -22452 -14112 -2146517454 2016812833 24896.398 4.06916902991652E8 42981217181930845.261 36311076627234901.358 2022-08-29 2022-04-25T13:41:59 2022-08-06 2022-04-24T22:05:46 140.151.153.118 eum_et@Voolith.name Nelson Court 46
+-1755328563 true -128 -11548 -29603 -2146383485 -634395390 -7073.377 -7.68698044932161E8 4477021624885860.622 68235552816386779.452 2022-02-07 2022-04-14T02:32:34 2022-04-01 2022-12-07T02:49:40 68.237.107.196 FrancesMurphy@Devpulse.net Sunbrook Place 35
+889640933 false -128 149 31577 -2146302732 -1844257832 -3185.0405 2.96757621404148E8 87013852077324124.120 79346435402101036.467 2022-06-08 2022-03-27T07:02:24 2022-10-27 2022-12-24T14:42:35 138.41.52.222 HeatherHughes@Fiveclub.mil Canary Hill 71
+-913961406 false -128 -772 28354 -2146230291 -851990365 -3025.3677 8.914648206465E8 88767996189732717.439 517350648331859.492 2022-12-03 2022-02-03T11:15:21 2022-09-24 2022-10-14T00:03:27 204.159.146.7 3Castillo@Voomm.name Butterfield Crossing 58
+-1461803234 true -128 20305 7765 -2145242920 -1406700789 28185.135 1.011412369524311E9 70890772755517481.741 36121188588273373.792 2022-05-26 2022-08-28T00:15 2022-09-09 2022-02-27T01:18:43 170.118.120.118 error_quod@Omba.net Acker Crossing 89
+-666522709 true -128 -20704 13443 -2145042412 -1612284457 11655.705 -6.74023449159679E8 93066083013275096.593 40720927210509700.191 2022-07-24 2022-11-03T12:43:02 2022-11-20 2022-11-13T04:26:03 122.205.223.77 necessitatibus_dolores_occaecati@Buzzdog.biz Oxford Junction 82
+-237138763 true -128 18771 -13026 -2143600625 -1470090009 25352.48 7.7020202702841E8 89861418696597024.483 77711255526118300.368 2022-10-06 2022-08-14T04:40:05 2022-12-21 2022-07-02T07:37:49 119.129.178.24 RalphBurns@Gabcube.name Chinook Court 92
+-1033332203 true -128 -1261 19837 -2142870012 537699650 821.9667 1.746494221685806E9 70002709673606159.105 62010864745188472.197 2022-08-07 2022-10-21T21:02:25 2022-05-20 2022-09-20T14:03:04 179.5.49.90 GaryGray@Jetpulse.edu Prairieview Avenue 47
+1513934679 false -128 19118 19844 -2141311933 921662575 -30874.328 -1.224064709848546E9 4675428570248306.858 77413615069452766.268 2022-03-09 2022-09-13T07:44:14 2022-04-12 2022-01-24T13:44:04 156.137.202.188 fRyan@Meembee.info Manley Hill 20
+-1787706570 false -128 -4462 25348 -2141063827 729060759 -31897.695 1.316675872124587E9 20498623232495251.952 39689077505421124.774 2022-09-04 2022-05-31T04:25:17 2022-03-29 2022-02-23T09:24:34 56.20.87.143 bSchmidt@Bubblemix.name Florence Alley 28
+965736124 false -128 -2686 14641 -2140912431 -694682404 -31831.951 1.62533515482917E9 31642914907686595.842 24445083223357943.966 2022-04-06 2022-02-12T04:03:02 2022-12-15 2022-08-23T09:13:13 179.84.233.58 AaronHernandez@Edgeblab.biz Sugar Way 75
+634387583 true -128 3009 20609 -2139719603 -435886806 -21041.531 -1.41310418994296E8 35427782671909779.468 34020993937610437.535 2022-02-28 2022-04-21T15:47:53 2022-12-24 2022-02-25T06:06:04 139.122.157.188 VictorJacobs@Meezzy.com Oneill Junction 43
+-9755124 false -128 -18390 23767 -2138931467 -262837238 -22577.486 -1.490521422086689E9 97704075077274232.100 52391890161369595.151 2022-07-07 2022-10-14T09:57:51 2022-06-05 2022-03-26T15:48:26 176.70.158.217 cTucker@Avaveo.biz Park Meadow Park 68
+1840766998 false -128 -11578 -7374 -2137048270 -909723995 2713.552 9.34755336010703E8 32227498333012689.836 18645616274997858.913 2022-07-10 2022-07-18T16:03:06 2022-07-11 2022-02-06T04:17:35 249.62.70.159 dSanchez@Innojam.info Sauthoff Plaza 86
+-1975038675 true -128 -30898 -18992 -2133385864 -1384734562 26367.035 -1.7441791444587E7 1620225450243695.193 77263944859469027.463 2022-03-17 2022-05-13T21:30:33 2022-07-07 2022-03-07T07:50:29 43.4.221.31 excepturi_quisquam@Babbleopia.biz Melby Drive 18
+1051134782 false -128 11302 -17011 -2131124298 -1520545869 28195.58 -1.267177164917066E9 9268277470355006.598 58016775974959372.644 2022-06-08 2022-12-02T04:01:27 2022-07-27 2022-12-02T11:09:29 245.220.83.56 voluptas_eos_quia@Livetube.net Mifflin Plaza 23
+1812084616 false -128 -16295 28847 -2130128972 -1477634 27222.605 -2.50371264958583E8 34751068014238389.637 71953147938406859.267 2022-09-15 2022-11-19T18:38:25 2022-06-20 2022-12-14T09:48:35 113.163.2.198 EugeneBrooks@Browsedrive.edu Dapin Street 87
+1823935737 true -128 9305 27545 -2130037027 -2031448951 -17447.258 -1.183373898413665E9 23881983327618442.587 88593476121695838.846 2022-12-24 2022-09-04T00:12:15 2022-12-31 2022-06-29T16:54:51 204.83.18.163 AnnieTorres@Centimia.mil Fremont Pass 1
+672328635 false -128 30476 7571 -2129826379 -678483885 22552.55 2.085865685457981E9 6544553689920437.248 24176223511074859.400 2022-01-31 2022-04-17T08:58:46 2022-03-14 2022-04-01T23:24:17 126.137.222.175 facere_possimus@Eidel.edu Service Circle 91
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_desc.out
new file mode 100644
index 0000000000..1c7cd2cb60
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q02_tinyint_desc --
+1113939361 true 127 4967 11609 2147067132 -1399650990 -29449.205 -1.62998021558943E8 12940444810371045.566 52955030802767286.752 2022-10-07 2022-06-17T14:22:24 2022-10-11 2022-09-12T11:47:54 102.164.240.244 HaroldGriffin@Thoughtstorm.com Memorial Terrace 67
+845368483 false 127 -8310 -9628 2146616991 -1045940332 -9868.593 1.570376206014117E9 29862310132486517.984 7881710570035405.645 2022-04-27 2022-01-26T15:22:21 2022-11-06 2022-10-13T01:07:24 252.44.56.210 dolore_ipsam@Cogibox.name Kenwood Court 17
+-1056181460 true 127 -23802 -15504 2146539105 1920811802 23855.672 -6.7041068215823E7 25606948646015411.717 48546657665862541.114 2022-03-27 2023-01-09T10:38:45 2022-02-25 2022-10-09T12:50:32 164.8.208.66 EugeneGeorge@Yadel.info Russell Junction 49
+1228160136 true 127 -23754 20466 2146288022 -1565751463 14044.293 -2.045105873679679E9 41258855366086887.670 94206548442916014.435 2022-08-24 2022-02-05T17:22:14 2022-09-24 2022-09-05T12:35:15 101.221.40.1 GaryFields@Oyoba.mil Pawling Road 71
+1068792637 false 127 12125 13339 2146282810 2144421638 17975.88 -1.912929853100911E9 56863526261225533.488 16587476823913378.895 2022-06-10 2022-07-03T14:45:55 2023-01-04 2022-10-27T05:42:51 180.188.87.76 HowardHernandez@Rooxo.biz Southridge Center 12
+-246937641 true 127 24781 -9222 2146034217 -1212067295 26735.014 7.5911512329467E7 17070022842490123.148 36405916908128864.366 2022-06-23 2022-03-13T19:32:04 2022-01-11 2022-07-18T11:27:11 80.112.172.234 5Willis@Trudeo.gov Pawling Alley 70
+1878297943 true 127 -23152 1281 2144971954 74566817 2629.9456 9.11553052098868E8 32978858990532311.500 81541079225570430.860 2022-02-19 2022-12-21T07:52:55 2022-12-31 2022-11-12T04:03:03 199.239.239.245 ShawnCunningham@Edgeify.biz Pond Parkway 14
+-1866348623 true 127 25971 -32041 2142982526 -1473310209 -31937.684 -2.066106047153405E9 28025089093469027.810 96528647242192769.710 2022-09-16 2022-04-12T16:38:54 2022-08-18 2022-09-24T08:14:42 46.151.35.20 illum_autem@Photospace.mil Pennsylvania Alley 4
+42641300 false 127 13993 1464 2141608036 420468240 -6237.7544 -1.3893797190184E8 94298643645110404.749 52618762564347867.369 2022-12-05 2023-01-08T12:28:46 2022-04-12 2022-06-23T05:40:32 223.96.180.107 rMorales@Realpoint.info Maple Parkway 70
+-2109946552 false 127 -27414 28878 2141468385 2017251881 -25077.691 1.59341412858189E9 62561054747145086.239 83403386069815682.239 2022-09-26 2022-09-21T08:30:32 2022-12-29 2022-09-07T22:29:59 15.225.104.165 KathleenDixon@Thoughtworks.biz Truax Way 37
+-1552321159 true 127 3426 -17915 2139414696 -7938806 22177.371 1.957310526612257E9 61811486828069184.807 55270957107015844.569 2022-08-14 2022-06-03T03:12:25 2022-07-02 2022-03-09T21:11:15 146.212.91.113 minima@Fadeo.name Graedel Trail 17
+-341905136 false 127 25889 -18628 2139269475 -900521062 17133.07 -2.128282228949938E9 18133239196112731.325 32941261583844339.834 2022-11-21 2022-11-20T20:12:42 2022-10-20 2022-09-24T13:46:08 14.108.137.209 6Harrison@Eire.name Bluejay Trail 46
+1051908286 true 127 -11553 18672 2138414995 371595905 -21799.115 7.41315579318121E8 3981673451938226.659 80121675104398429.440 2022-09-05 2022-06-19T20:09:40 2022-04-25 2022-07-18T23:51:34 131.231.149.73 et_ut_quo@Eidel.org Starling Court 32
+1855559319 false 127 15802 -8735 2138277710 550097059 7686.7285 6.26661332666768E8 95797220270167390.846 56389933193020366.845 2022-11-20 2022-12-07T17:46:43 2022-04-07 2022-09-04T14:19:02 155.146.230.211 CarlosCarpenter@Ozu.biz Barby Court 11
+-950403144 false 127 -9580 12555 2138245427 -489666078 -9201.424 -9.33785719496523E8 41716831478894306.408 66405514090062978.699 2022-09-05 2022-06-20T09:36:33 2022-10-24 2022-02-02T12:50:51 193.103.46.78 1Henry@Edgepulse.net Schlimgen Avenue 24
+476042524 false 127 -32046 25676 2137510590 119627160 -4462.3394 1.497579302954467E9 98344974016851549.825 80342039923187416.806 2022-03-15 2022-09-19T00:34:47 2022-06-25 2022-03-01T13:23:21 26.56.35.92 tBoyd@Rhybox.net Dwight Street 96
+-336527848 false 127 -14814 11699 2137094268 -304553362 21947.398 -1.39028562355098E9 47028155576424101.208 31182921503667828.398 2022-05-24 2022-11-28T13:51:06 2022-01-11 2022-02-07T22:45:39 92.179.166.80 MargaretCooper@Meemm.gov Oak Point 56
+359348227 false 127 -9703 -19183 2136672917 -1216951175 -20778.127 6.81057487643244E8 76001639232703921.350 3926011027229543.660 2022-11-02 2022-12-05T22:08:49 2022-03-02 2022-05-19T03:03:26 20.142.229.220 eligendi@Twiyo.com Southridge Court 85
+1697881845 true 127 3775 17404 2136647169 358534230 19361.938 1.140613254765717E9 10234364020739859.302 90405154064863253.406 2022-12-18 2022-05-03T14:28:15 2022-12-08 2022-03-16T23:42 116.97.128.59 zCole@Trilia.name Continental Terrace 23
+-487691284 false 127 25724 -9662 2135014707 1824856223 31940.584 9.24879496113318E8 42669376082239422.968 75730450425528137.800 2022-10-27 2022-06-24T13:56:05 2022-11-07 2022-10-21T07:22:35 21.253.217.6 VirginiaJames@Oba.edu Moland Court 56
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_asc.out
new file mode 100644
index 0000000000..cd757f70fd
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q03_smallint_asc --
+-956714337 false 9 -32768 -21447 -2119181910 -397700359 8544.816 8.42565878027755E8 4094297227123464.119 94635764902337719.587 2022-10-30 2022-03-03T18:49:12 2022-07-28 2022-11-11T18:36:07 89.85.158.113 expedita@Dabvine.org Schurz Point 86
+-1559512940 false 90 -32768 -18778 -1772659910 -1538078533 32518.29 1.839297758005148E9 8025233121771129.982 21736833643914977.474 2022-07-26 2022-05-09T08:39:41 2022-08-01 2022-05-29T08:39:24 121.249.9.41 yHanson@LiveZ.gov Arizona Road 39
+-705301045 false 71 -32768 4632 -1666166714 1883461151 -30630.502 -8.5079006807073E8 53571183342198399.700 3962173432088222.445 2022-05-05 2022-12-14T16:47:29 2022-10-28 2022-05-04T20:07:58 232.16.80.219 est@Skyble.biz Oak Valley Point 2
+191753928 true -3 -32768 28801 -894847791 1255173066 202.17188 -1.474409948411377E9 3158312006873245.853 79816115052757123.810 2022-04-16 2022-04-03T22:46:48 2022-11-25 2022-08-05T18:03:44 126.55.0.220 8Kennedy@Fanoodle.name Southridge Hill 60
+-1199355223 true -61 -32768 -22666 -612930133 -1178658838 -28884.086 1.11103948397087E8 80042788253782204.498 47014660443866476.232 2022-04-20 2022-03-01T22:23:27 2022-09-19 2022-07-23T19:06:36 22.192.94.124 MildredRobinson@Devshare.edu Westport Pass 49
+665936099 false -115 -32768 11929 -573443804 -2016424421 29634.79 -2.18478165703325E8 12703696687710822.643 88074988987401774.411 2022-08-15 2022-09-04T12:01:35 2022-10-01 2022-02-27T11:08:01 84.50.196.143 autem_tempora_est@Browsetype.name Saint Paul Way 89
+-1275348437 false -69 -32768 -16693 -561278478 -759611463 21118.123 1.667026581303165E9 2956123704992284.781 74730986624403222.314 2023-01-05 2022-02-27T11:59:07 2022-10-14 2022-09-22T13:11:04 167.22.70.149 sJohnson@Bubbletube.name Summit Center 21
+848002171 true 66 -32768 20928 -375081698 -745557940 -18539.678 -1.40295670471318E9 97736016154408847.117 47131568808788018.212 2022-08-19 2022-11-19T22:31:35 2022-12-19 2022-03-19T23:50:29 223.197.134.245 MarilynMitchell@Gevee.info North Park 58
+2099538552 false -101 -32768 -13729 145301727 778326569 -21269.486 1.604892898933131E9 20775250579937603.453 68906855503494742.331 2022-01-18 2022-08-26T02:15:34 2022-07-12 2022-03-17T02:46:27 15.126.62.157 8Ryan@Buzzshare.org Southridge Crossing 57
+-1342989590 true -51 -32768 -21837 379694752 953289513 1709.1425 9.43268787230081E8 15994775827042591.220 21184279894375388.370 2022-08-08 2022-02-22T12:42:20 2022-03-19 2022-12-04T12:03:05 166.24.100.153 xPrice@Eire.mil Scott Avenue 24
+-2099390938 false 63 -32768 -32408 393425067 -1635483986 -28936.332 -1.085881992618776E9 36803042446327799.658 64456854851162701.200 2022-09-07 2022-03-25T23:19:36 2022-02-22 2022-05-24T00:51:56 58.107.119.127 RebeccaEdwards@Browsecat.com Northwestern Alley 6
+-957791912 true 126 -32768 -10729 830069116 2103092395 29968.945 1.639990989663357E9 59005793503222374.208 57613139135938777.187 2022-05-10 2022-09-09T07:30:25 2022-02-07 2022-03-27T16:04:51 112.14.223.193 tDaniels@Kazio.mil American Alley 35
+1979606990 true -121 -32768 14986 1140193466 -1219445196 -29587.404 -5.32522576898622E8 76851400354416509.617 82831592007803346.142 2022-10-21 2022-07-28T19:01:49 2022-03-30 2022-11-10T21:43:27 187.21.28.160 1Green@Thoughtsphere.info Manitowish Parkway 21
+1540859354 true -110 -32768 -29595 1193667351 -1191722621 -28450.025 1.807240652717508E9 89756525150809703.472 70550050881757088.893 2022-05-08 2022-05-10T18:22:23 2022-01-28 2022-04-08T23:28:30 238.187.41.156 sWheeler@Brainlounge.net Chive Park 49
+-1515216940 true -93 -32768 23276 1278185126 819897081 -27640.775 -1.343836015081554E9 1325037666391987.251 59887577210052257.857 2022-09-12 2022-04-14T01:33:59 2022-03-28 2022-06-05T02:25:39 60.161.98.109 RaymondLewis@Skibox.mil Pankratz Drive 84
+1186197915 false -6 -32768 9477 1504265399 -205821866 -5769.2314 -8.26175747976332E8 6993548111617615.667 79531626414884406.312 2022-08-10 2022-09-09T18:30:35 2022-04-30 2022-07-06T12:06:05 68.51.54.193 wHenry@Aimbo.edu Veith Center 45
+-2004931736 false -13 -32768 21957 1544459161 -1773993625 18035.14 -1.030924547303447E9 92724336835089908.357 75707175342781346.106 2022-04-10 2022-06-07T18:20:13 2022-05-27 2022-08-29T19:24:26 208.148.214.190 maxime_quidem@Shuffletag.info Express Trail 61
+-273961001 false 53 -32768 1239 1663741632 -1893520603 14750.256 1.411475653420637E9 4567372818900016.238 70464541385762238.753 2022-08-06 2022-06-06T09:28:37 2023-01-05 2022-03-29T02:05:08 36.64.144.72 AaronWest@Dynazzy.edu Jenna Hill 75
+1125907468 false 92 -32768 27889 1858358065 -1689270915 17365.418 -2.035031502327624E9 68912075638025607.120 22960893441577020.907 2022-08-11 2022-01-20T21:32:33 2023-01-08 2022-05-11T20:00:03 169.187.30.86 PhyllisHoward@Oyoba.com Cherokee Alley 50
+425808175 false 106 -32768 -6025 1884553032 -200563489 30379.486 1.336059195210369E9 32158999009020847.504 23729748825156743.750 2022-07-25 2022-07-12T05:55:10 2022-07-31 2022-07-08T09:53:55 118.64.20.102 zCarr@Skalith.com Caliangt Way 64
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_desc.out
new file mode 100644
index 0000000000..2984bc525d
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q03_smallint_desc --
+-1420812804 false 87 32767 21441 1678560897 1556232486 9959.018 1.560810265595625E9 53367707717244888.172 78263512868717237.334 2022-10-14 2022-05-30T15:56:43 2022-09-13 2022-12-03T04:12:36 61.118.67.174 fHernandez@Gigazoom.net Harbort Plaza 74
+1080100542 false -103 32767 -32345 1516239965 -1959086052 -9526.442 1.368417829727535E9 59529746584863408.273 54004301963415238.688 2022-03-18 2022-03-17T21:04:28 2022-11-27 2022-09-01T10:32:27 112.9.110.220 sapiente_et@Wordtune.com Del Mar Alley 14
+1790712840 false -60 32767 -13200 1444824980 1953979294 -13759.598 4.36756893815203E8 74289852103116884.548 23715281033213564.754 2022-11-30 2022-12-08T16:19:44 2022-04-08 2022-10-04T15:45:06 177.5.37.239 JoanWard@Jaloo.org Hudson Drive 72
+-1652566467 false -39 32767 26516 1215121536 -1500040018 18335.352 1.316773570462298E9 23999652729376863.467 78115061843119221.123 2022-04-28 2022-03-20T09:23:07 2023-01-05 2022-04-25T13:05:07 69.61.76.149 yHoward@Bluezoom.org Dunning Junction 81
+-2064440522 true -75 32767 -17558 849037708 587123427 -4247.6797 2.14502216256895E9 64375063060958299.247 31486374249394627.990 2022-02-14 2022-07-27T20:09:32 2022-05-26 2022-08-14T13:26:56 4.135.73.142 ut_dicta_reiciendis@Kaymbo.org Tony Terrace 18
+-1465023296 true -120 32767 13260 676346698 410411161 -5488.7783 2.142165802160835E9 15442903026737808.173 64406411256628519.146 2022-12-09 2022-06-10T13:10:41 2022-11-20 2022-06-16T06:04:54 3.240.90.12 sint@Topicstorm.mil Ryan Crossing 40
+-1783248955 true -46 32767 24735 270262401 -906217398 12946.995 5.41332101656695E8 97295895998092890.998 73421324604106832.546 2022-04-22 2022-05-15T14:03:58 2022-09-11 2022-01-29T12:08:27 153.23.200.191 ut_quod_at@Cogilith.info Macpherson Street 42
+-630654072 true 29 32767 20152 -453799527 -944621837 -10862.854 2.1202667278816E7 38553894693583118.368 1609414000539010.600 2022-09-09 2022-12-20T21:20:42 2022-04-11 2022-12-20T08:33:10 153.12.224.226 CarolynMitchell@Ailane.edu Fordem Terrace 17
+1610173524 true -36 32767 110 -485021625 1326710722 -15452.647 1.712244760219285E9 54985116338987826.693 65215899088499149.343 2022-07-20 2022-04-01T23:42:43 2022-05-19 2022-06-06T13:59:23 72.62.79.250 bFrazier@Blogtag.info Raven Place 15
+201724350 false 53 32767 -29442 -764873455 1072161671 28272.633 -1.984372369420127E9 36404274389736129.849 12937614675175936.291 2022-11-25 2022-02-08T07:54:49 2022-09-18 2022-07-17T06:31:17 161.155.111.69 facilis_voluptates@Youtags.name Almo Crossing 53
+360590696 true 38 32767 22638 -1541436852 244031682 31381.406 -1.24899826345357E8 80101741223666579.290 47783666261750053.846 2022-01-27 2022-05-31T14:28:14 2022-06-18 2022-03-09T17:02:55 245.151.64.68 5Duncan@Riffwire.info Loomis Park 59
+961524656 false 92 32767 16634 -1843658789 -1709129926 -29226.172 2.54394965271565E8 13439705918528964.604 21382968659216707.283 2022-06-17 2022-05-13T21:20:39 2022-10-05 2022-09-24T13:30:50 81.233.60.195 CherylBrooks@Kwideo.gov Manitowish Court 27
+-1129509967 false 40 32767 -8714 -1922279700 -1068042024 -31981.738 1.872934727916913E9 42784764695752210.645 79171403893470668.461 2023-01-07 2022-06-02T23:27:58 2022-06-06 2022-10-21T10:42:13 121.88.192.83 qui_aut_enim@Meejo.gov Logan Center 7
+2097414288 false -92 32766 20312 2047945442 -973812323 -15728.488 -5.8402730971289E8 36805974594534434.619 35392804656997541.850 2022-04-17 2022-04-16T07:09:32 2022-03-02 2022-04-07T17:10:59 209.36.134.255 mBrown@Minyx.info Debra Terrace 19
+-799275007 false 64 32766 20369 1801338708 -438205059 23985.758 -1.145449603692417E9 8285652611887586.485 85359521530662573.619 2022-07-25 2022-07-16T22:58:45 2022-06-21 2022-02-08T21:03:59 203.254.103.210 ArthurGonzalez@Realpoint.biz Oak Pass 68
+-880226949 true 78 32766 12887 1756277047 190327578 22342.154 -5.98004048152577E8 7306868138616339.579 22565414784695921.250 2022-02-13 2022-09-21T12:25:19 2022-10-05 2022-04-01T02:26:38 188.143.228.103 exercitationem@Blogpad.edu Onsgard Junction 89
+-874585964 false 47 32766 -10929 1519769949 1601858125 14056.325 1.532909781459057E9 74738228295173840.308 61531324239017326.290 2022-12-02 2022-09-12T05:04:34 2022-06-05 2022-11-17T12:08:38 43.114.219.1 StevenMitchell@Oozz.gov Miller Place 22
+-1686176773 true 79 32766 9212 1115035313 450171396 -1866.4689 7.77563839932363E8 90992477662136679.337 666861267107.644 2022-12-13 2022-03-19T09:35:44 2023-01-02 2022-05-09T22:05:07 218.227.189.124 suscipit@Trunyx.biz Sauthoff Hill 54
+1580248923 true -53 32766 24600 835121496 1799461459 -7978.5894 1.61916308072381E9 49740940016941499.836 16261714214835321.379 2022-05-29 2022-12-19T05:26:22 2022-05-05 2022-09-21T17:39:24 192.12.165.182 JohnnyCole@Babbleblab.com Bunker Hill Avenue 47
+284611282 true 115 32766 -29000 693350452 1804011300 27503.322 1.541716030386427E9 38398874365459315.998 58547572369398935.574 2022-08-12 2022-03-06T12:02:41 2022-07-29 2022-04-24T14:01:52 29.234.237.236 TheresaThomas@Flipbug.biz Sachs Center 98
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_asc.out
new file mode 100644
index 0000000000..8b380f585e
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q04_int_asc --
+-724706108 true -58 21277 -32768 -2120733118 -1316677093 28088.38 1.115136612586051E9 2364850569062051.836 99987866980043755.800 2022-04-18 2022-06-07T08:10:38 2022-05-11 2022-07-07T21:54:18 84.210.182.140 laudantium_dolorem@DabZ.edu Sauthoff Road 1
+-1784728537 false 78 29 -32768 -1903035708 -517391953 -21292.13 1.336659715432206E9 82639136682635162.808 79838626915225705.915 2022-11-26 2023-01-01T23:45:07 2022-03-18 2022-07-07T21:05:36 23.39.113.132 ut@Brainlounge.net Brown Lane 73
+-880674769 true -30 -13315 -32768 -1502344793 1035625019 -9074.537 -1.375730749351314E9 4509729191622434.232 7739319881715713.769 2022-07-04 2022-02-21T23:54:51 2022-06-18 2022-12-01T13:00:03 51.85.36.73 voluptas_et@Gigashots.info Village Place 54
+2036228671 true -37 -18567 -32768 -1249563481 -209145436 20378.133 1.928345967460078E9 41432280276950618.638 25793286891144450.357 2022-10-27 2022-01-30T04:30:56 2022-06-26 2022-04-02T13:59:42 13.180.193.75 BenjaminSullivan@Yakidoo.com Anzinger Parkway 73
+-624661583 true 27 -25069 -32768 -1047509451 -458727865 12787.854 1.023346475883571E9 35609833305491315.248 93870904411793291.772 2022-05-27 2022-10-24T12:18:54 2022-08-22 2022-08-10T06:54:08 100.74.206.16 dGreen@Zoozzy.org Upham Terrace 12
+-24940453 true -94 -10973 -32768 -1009584686 -1247987750 -6420.7715 -1.154210842239973E9 427012722987017.972 82997961698597105.800 2023-01-02 2022-05-24T06:40:37 2022-08-31 2022-08-24T21:26:51 46.113.95.140 dolor_et@Dabtype.org Talmadge Terrace 93
+1440768501 true -9 6876 -32768 -681728365 -1435371922 13394.644 7.34503660987504E8 52834354694219144.950 69518569749382164.510 2022-03-12 2022-05-22T08:08:32 2022-07-08 2022-06-27T08:58 133.88.101.209 hWatkins@Yodel.net Village Road 61
+1464502997 true 99 -6977 -32768 -407869610 374288810 19392.492 1.3126169728449E8 71408716144006001.764 44421550103074848.341 2022-01-24 2022-12-29T01:53:56 2022-11-06 2022-07-04T09:21:34 238.188.218.213 nDay@Voonix.edu Norway Maple Lane 36
+1783740725 false -4 -20635 -32768 -129132199 1033655858 21715.297 -7.54058346736829E8 95161363430606469.721 29458096786879531.580 2022-02-04 2022-06-21T16:33:53 2022-10-24 2022-02-24T13:07:31 248.169.15.230 lHall@Flashspan.gov Florence Trail 22
+-1969609197 false 28 28325 -32768 857697236 -47389999 -23293.6 1.275376606739085E9 3134649734681167.894 68028597663670515.123 2022-09-01 2022-08-25T18:38:59 2022-09-17 2022-05-09T04:26:15 171.107.129.4 TheresaGutierrez@Devify.biz Blaine Trail 90
+-819610085 false -5 20973 -32768 1024239356 -954961445 10491.175 1.341381155702512E9 35911990125854291.712 77200808830411345.553 2022-09-23 2022-12-23T22:00:22 2022-03-12 2022-10-18T20:45:15 98.201.72.10 fDunn@Fivespan.org Coleman Crossing 67
+-322822234 false -10 12370 -32768 1104090010 755194185 -16738.787 1.307386947167164E9 24312160338609669.522 58796999828858368.722 2022-07-02 2022-11-01T03:38:28 2022-02-15 2022-06-05T10:30:30 159.69.88.128 iure_nesciunt_voluptates@Dynabox.edu Larry Alley 39
+-1195158469 false -60 -8694 -32768 1267495803 -358529373 -6907.075 1.47274930258069E9 66847365669609031.157 76819740367836335.444 2022-07-21 2022-05-20T01:41:24 2022-05-19 2022-03-09T02:48:28 70.110.202.114 7Hernandez@Babbleblab.edu Twin Pines Place 55
+82257074 false 23 12019 -32768 1768680570 1037057674 -28341.41 -1.387592834682792E9 61999802022591109.158 86304150812719249.660 2022-03-02 2022-02-24T07:00:46 2022-02-24 2022-06-12T19:01:56 1.34.159.115 IrenePierce@Dablist.org Crescent Oaks Pass 99
+963628377 false -41 8509 -32768 2039358007 -1456067092 25266.559 2.030338532394684E9 78742588047728422.952 72249645328554877.980 2022-05-16 2022-06-28T11:34:18 2022-01-12 2022-02-14T20:41:46 59.81.108.106 consequuntur_inventore@Edgetag.name Glacier Hill Road 13
+1504337409 true 35 23857 -32767 -1491663265 -1872209135 -23958.512 1.557031147242115E9 36680505639263456.400 92341119506055736.630 2022-07-11 2022-02-05T00:08:30 2022-12-19 2022-06-16T17:25:25 157.229.39.177 voluptas_earum_aut@Eayo.gov Waxwing Drive 31
+1452757723 true 86 -10131 -32767 -1207015343 49692912 -28471.277 7.63516943282041E8 98104061235416014.815 1151857603920162.560 2022-09-13 2022-08-31T09:00:17 2022-06-28 2022-08-21T05:56:17 126.180.238.9 zJames@InnoZ.edu Cardinal Hill 16
+1144535934 true -115 8257 -32767 -1145194166 1312281596 -27755.525 3.86726461334295E8 44099774217953217.896 52422077162919646.913 2022-04-20 2022-11-18T17:04:17 2022-03-07 2022-02-16T16:05:29 189.103.26.171 BrianRobinson@Quimm.net Lukken Park 58
+174116747 false -70 27672 -32767 -1129343965 438109108 5640.3486 -2.094277754194657E9 79632329522874968.103 12435233240700717.533 2022-09-01 2022-08-31T14:08:30 2022-07-20 2022-12-05T13:53:27 116.151.106.28 hDean@Twitterwire.name Northview Avenue 78
+-593148423 true -5 -21700 -32767 -1056246287 682848989 -8755.646 3.8361190595868E7 73635997870057025.649 32792455115584086.957 2022-03-12 2022-06-21T02:56:39 2022-07-12 2022-01-29T00:50:31 150.75.99.137 LoriHernandez@Skipfire.org South Junction 91
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_desc.out
new file mode 100644
index 0000000000..f65b7a4d9d
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q04_int_desc --
+1898661785 false 89 20914 32767 1888116922 1029418657 -17939.033 -1.903101775754356E9 99369207633318231.438 8768513323897507.592 2022-12-27 2022-07-19T02:25:13 2022-10-17 2022-08-10T12:50:03 118.14.237.254 architecto_consequatur_ratione@Plajo.com 6th Plaza 21
+-600030474 true -80 -27354 32767 1753279192 1647985131 -6298.85 -1.0099842728928E8 73151402356517623.689 26345129549082063.665 2022-07-06 2022-04-11T13:29:26 2022-10-14 2022-10-28T16:20:35 17.135.232.84 LouisHill@Jabbersphere.edu 5th Crossing 77
+-1323852515 false 28 -810 32767 696741380 -503228152 -2033.0967 1.283612783887132E9 23560155062530607.449 88816479023759266.396 2022-07-04 2022-01-16T01:51:12 2022-04-25 2022-07-09T08:42:19 242.21.240.41 qui_molestias_sit@Twimm.edu School Way 39
+-793533439 true 41 2824 32767 538602653 623318514 -90.34033 1.652544048058129E9 6278079706749755.145 80209164909064212.965 2022-11-20 2022-04-28T16:31:42 2022-07-07 2022-04-29T14:52:37 26.120.45.167 EdwardGilbert@Realpoint.edu Chinook Point 18
+-517303502 true -93 -22754 32767 -43570738 228365884 -12285.596 1.072148305961583E9 40385648446590087.908 33950598159842941.991 2022-10-17 2022-05-21T00:05:59 2022-12-02 2022-10-10T11:30:38 180.210.2.61 vel_porro@Devcast.com Ridgeview Lane 29
+-1005758606 false -46 15505 32767 -685985077 1069243549 22190.662 1.465829004826134E9 94315647872734731.908 34867175910609485.940 2022-07-05 2022-11-07T22:34:03 2022-03-17 2022-12-15T08:25:51 164.89.83.128 3Peterson@Ozu.edu Sutteridge Hill 29
+-386626479 true 90 -27833 32767 -693959934 402481406 -12022.679 3.20633431835798E8 13878558879578976.858 3532747518626402.670 2022-01-31 2022-05-11T00:08:57 2022-04-20 2022-07-23T15:42:08 105.178.67.122 adipisci@Meembee.edu Maple Junction 57
+791053689 false -95 -23968 32767 -1103551683 573511873 -4560.8164 -1.612783058153555E9 75476565259401372.959 20765387673237390.730 2022-01-25 2022-12-07T07:56 2022-12-29 2022-03-04T01:38:22 234.188.87.33 bRoss@Wikibox.name Forest Place 70
+-1688811197 true -33 23628 32767 -1422824838 1377740827 6697.8125 -3.20776843199587E8 87270405671531592.941 10273762521063911.978 2022-03-01 2022-06-17T23:50:57 2022-07-11 2022-10-19T22:21:20 87.210.226.137 AndrewRichards@Quatz.mil Magdeline Hill 2
+-1706363956 false 5 29573 32767 -1800188877 1250889188 3222.5032 7.59123194761978E8 38132941604652656.707 56797235723096309.823 2022-11-30 2022-02-20T20:31:38 2022-03-06 2022-12-25T19:18:30 81.3.160.15 CarolynMoreno@Twitterbeat.org Walton Park 0
+-1198201373 true -68 11611 32767 -1881570490 -832750635 15422.077 -1.008890733534576E9 61740717634381831.350 90040616641745625.691 2022-09-11 2022-12-02T05:15:13 2022-02-26 2022-04-03T00:16:30 37.77.240.236 ut@Realfire.info Southridge Crossing 2
+-440705770 false 79 -32572 32767 -1961333255 -564816125 -19275.254 -8.56043163982228E8 31317454682606080.715 82565493020808350.827 2022-03-01 2022-10-01T09:47:08 2022-08-20 2022-11-04T23:13:59 128.227.27.151 ThomasPalmer@Skynoodle.mil Sunnyside Court 22
+-672399278 true 37 -16507 32767 -1983542492 -2079663849 3108.9314 -7.02990221574151E8 95289208283784171.498 79069368837730231.108 2022-09-04 2022-06-09T09:02:11 2022-03-24 2022-04-21T05:42:34 199.138.101.12 magnam_odit@Mybuzz.org Lake View Park 87
+1637793616 true 59 1764 32767 -2052264650 -1578947731 11197.878 1.40143850979203E8 56495401490046518.286 78424390200285140.477 2022-11-11 2022-01-15T07:58:06 2022-04-02 2022-10-05T19:18:01 71.247.208.219 oBanks@Kwideo.biz Heffernan Circle 14
+1829254658 true 13 -14685 32767 -2112183148 -992170175 -8207.334 -1.667568460711954E9 39868154097191057.561 27284911861750304.908 2022-09-03 2023-01-06T07:18:34 2022-09-26 2022-05-13T00:48:07 68.254.153.214 wSanchez@Mydo.net Shasta Plaza 37
+-1837256831 true 23 -21333 32766 1733753204 -872139105 10232.654 7084307.228661 55581520919805163.310 46175547965371997.896 2022-03-11 2022-03-25T15:33:56 2022-03-04 2022-08-23T01:47:29 163.25.37.85 JaniceMendoza@Tagpad.biz Atwood Parkway 95
+203391346 true 46 17496 32766 1453791862 1556963309 -1303.7205 1.96424427370409E8 98209234373345503.606 77641367384062160.957 2022-05-29 2022-12-06T12:21:05 2022-06-03 2022-08-04T17:14:23 102.132.7.251 qui@Browsezoom.org Arrowood Lane 18
+476103407 true 50 -31477 32766 1246797667 -1808899886 -20132.887 -2.17433200722871E8 94532041589761841.578 71996802156521651.643 2022-12-30 2022-08-16T00:43:25 2022-10-26 2022-08-10T03:05:16 46.162.166.232 MartinCampbell@Realbuzz.org Blue Bill Park Drive 18
+1935152913 true -36 17554 32766 1092104347 -1768138005 3526.0737 -1.092995250003986E9 19695739333265998.991 22457349947009384.351 2022-10-25 2022-03-23T04:18:20 2022-05-26 2022-01-22T21:51:12 181.78.226.237 2Barnes@Yakitri.name Claremont Drive 27
+-1784325254 false -50 8592 32766 641788466 1350609753 -18208.885 -6.40295431186389E8 33177060653065518.611 7328522000342647.719 2022-07-08 2022-01-25T03:02:51 2022-09-14 2022-08-03T13:55:56 199.182.62.95 nesciunt_ipsum@Skyble.info Maryland Parkway 8
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_asc.out
new file mode 100644
index 0000000000..cbf796ded2
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q05_bigint_asc --
+-1298782207 false 0 21661 27910 -2147483358 50137345 -31890.162 2.5182778747432E8 8892361240908133.332 16697470310045199.514 2022-03-29 2022-05-06T07:35:41 2022-02-20 2022-06-13T07:08:23 86.198.4.14 tHarrison@Yotz.edu Ohio Terrace 97
+-1438836446 false -106 25720 2137 -2147480317 -1044710620 19297.592 -4.6721094672452E7 74446297684183183.297 10126355674710455.926 2022-02-12 2022-02-10T22:47:34 2022-08-24 2022-07-16T17:14:43 176.57.174.210 2Jacobs@Oloo.edu Sunfield Pass 74
+-1690803538 true -64 -5005 21145 -2147477545 -429303067 12734.948 -4.6851297091213E8 53125989849165374.107 41444040735473920.151 2022-02-02 2022-03-05T11:14:22 2022-10-18 2022-05-02T04:24:15 147.133.227.47 rem_explicabo@Yozio.org Brown Road 85
+-1931640422 false 81 -17173 20232 -2147474804 1094003829 -21709.188 -1.487469632520682E9 37494213942760235.318 5170475614524523.563 2022-03-29 2022-07-02T11:19:41 2022-07-14 2022-03-12T18:09:32 222.252.244.150 at_non@Feedbug.biz Division Parkway 27
+-1438874983 false -39 -17552 22077 -2147474201 819770754 3815.9624 -3.07788874880729E8 22473676566411893.142 49303092715634273.638 2022-02-17 2022-07-22T02:13:31 2022-07-02 2022-02-07T15:19:07 176.107.188.43 ipsa@Photobug.org Algoma Center 6
+-211415263 false 82 28127 -16794 -2147468104 953496574 -2973.964 1.538181391859708E9 55664064661456781.100 27727896561928356.763 2022-07-30 2022-04-25T14:47:28 2022-12-25 2022-11-04T19:40:54 93.64.145.202 SarahOliver@Topicblab.net Shopko Alley 97
+2011554557 false 114 -15050 4397 -2147464684 1467965089 24381.705 -6.7825676777073E7 89275295308566490.932 52641288250964188.795 2022-11-01 2022-06-23T04:06:05 2022-09-30 2022-09-02T05:05:13 30.43.252.68 lDiaz@Kwideo.info Quincy Road 30
+1715283587 true 69 5585 4327 -2147455527 -285779226 -21540.486 1.835808603850457E9 54187873992172620.878 29099557100349011.625 2022-11-15 2022-06-04T18:07:03 2022-03-06 2022-01-12T10:31:19 251.57.239.161 KathrynGrant@Jatri.com Talmadge Terrace 31
+-984991914 false -85 -5897 -29349 -2147452176 1525786458 13439.43 1.580339430307399E9 4315552136410587.989 42963905746019101.945 2022-01-19 2022-01-30T20:58:15 2023-01-02 2022-06-20T17:19:49 204.35.13.187 DonaldOwens@Gabvine.com Continental Crossing 89
+-568373301 true -12 30216 -6175 -2147449255 -612488037 4770.788 3.41784111819403E8 66010364586901704.721 78090412186437460.598 2022-05-05 2022-06-17T21:16:21 2022-07-30 2022-07-28T16:57:11 116.207.187.0 zMartinez@Jabberstorm.net Pawling Terrace 74
+-435544076 false 100 5626 10817 -2147449203 -1071291634 -32229.045 -3.63129015178875E8 12284411005290507.833 26373576153379339.703 2022-11-01 2022-05-13T23:57:47 2022-06-29 2022-05-02T20:24:54 142.56.17.46 9Price@Fliptune.net Monument Hill 80
+2023680862 true -61 7766 22532 -2147448019 -609849098 -27249.846 9.29542497341581E8 39481914812189670.121 67591684441602394.918 2022-08-16 2022-09-20T13:43:17 2022-12-10 2022-01-28T08:36:26 108.177.1.120 maiores_possimus_dolores@Tagopia.name Mitchell Terrace 22
+-1977872093 false -128 -12502 18730 -2147447412 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 11774006348685852.217 2022-06-13 2022-06-08T00:10:42 2022-01-19 2022-12-12T15:38:03 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+-1810469346 false -106 -18847 28383 -2147445583 -249047381 -25610.389 -1.172353483917956E9 29809461999773154.513 48715652698659874.382 2022-10-04 2022-03-22T06:00:02 2022-11-08 2022-09-09T18:14:23 86.232.2.134 odio_distinctio@Einti.com Mallory Place 2
+1768235949 false -98 3388 -7469 -2147440231 -520983933 10625.003 2.03995201402268E9 3462857055462597.650 34028908311454481.592 2022-01-26 2022-11-01T00:41:21 2022-08-16 2022-09-11T03:05:51 129.54.117.50 amet_ea@Quimba.name Butternut Alley 71
+107344314 true 38 29989 -15212 -2147436000 -2059345979 -15143.42 1.652582093181943E9 59619727495487524.575 30763183670763392.566 2022-04-07 2022-12-26T02:46:25 2022-05-15 2022-03-12T15:32:48 188.148.220.97 tenetur_cupiditate@Meemm.name Doe Crossing Avenue 8
+-16187558 false 126 26815 -11284 -2147429509 -688010171 27046.46 -5.27072353971484E8 66247237013637477.644 89258793731621871.659 2022-10-01 2022-09-08T08:07:23 2022-07-21 2022-03-04T17:56:58 8.115.159.161 AnthonyGriffin@Katz.edu Fordem Plaza 6
+-1519721169 false 110 23694 10888 -2147429313 2044460430 15311.488 1.375307496401204E9 53151235042978489.270 61886285781136168.806 2022-08-11 2022-10-20T13:09:41 2022-05-13 2022-12-02T03:44:10 193.174.176.52 JoyceChavez@Eayo.com Bay Place 92
+1606397914 false 14 -1228 32445 -2147426673 -1925449184 32501.54 -2.39912871351486E8 55348475727816727.866 89764720990212770.220 2022-12-10 2022-01-16T21:35:19 2022-04-12 2022-01-24T23:50:40 18.231.153.73 8Clark@Kare.info Manley Place 39
+2120756493 true 105 6251 -6812 -2147421318 1436392860 11044.398 5.72113383114619E8 72488255457463303.173 24287700579137232.797 2022-01-22 2022-07-02T17:44:40 2022-02-01 2022-07-25T03:06:25 215.68.120.190 AmyKnight@Jatri.gov Morning Alley 47
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_desc.out
new file mode 100644
index 0000000000..70cf527da6
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q05_bigint_desc --
+-385774802 false -107 5853 32354 2147476415 1813108632 -31056.639 -1.124844835680021E9 40135874837185031.606 79015094907713747.951 2022-02-21 2022-02-26T03:23:29 2022-02-17 2022-11-06T20:45:23 97.85.179.247 BarbaraGonzales@Talane.net Logan Junction 65
+557179323 true -23 -15598 -10213 2147473376 -794130865 25225.979 -1.060667482169878E9 19712527510160101.667 45825484466840064.118 2022-08-23 2022-09-07T09:37:41 2022-06-06 2022-01-28T07:05:42 199.195.172.243 BenjaminGreene@Devify.org Hoffman Road 93
+856375504 false 91 21995 -28829 2147472006 1921853977 -9326.696 -1.865361821014336E9 40145011496472182.350 26658958117089694.950 2022-03-15 2022-07-07T10:12:05 2022-01-25 2022-09-09T11:15:36 24.129.28.35 uGreen@Avavee.edu School Drive 93
+1824844955 true -5 28431 -17708 2147467668 -947082776 26115.467 -1.064859020746046E9 12851908920109725.570 17196762472988513.310 2022-12-17 2022-11-09T06:13:10 2022-05-22 2022-10-26T15:14:11 14.249.104.252 qMarshall@Yamia.mil Schurz Junction 33
+-379440258 false -35 5963 26203 2147466395 1370349994 -10364.076 4.63808372886602E8 89497971198029168.922 14160522214564153.767 2023-01-06 2022-06-16T16:39:52 2022-03-02 2022-08-02T13:11:26 3.186.137.109 ScottPerkins@Edgewire.org Tennessee Terrace 33
+1057517775 true 28 16452 -30571 2147447138 -2075189185 22385.588 -3.55214861990496E8 11932816216934343.652 50480005137427111.177 2022-08-23 2022-10-21T03:38:58 2022-10-21 2022-05-18T22:01:25 234.3.203.12 CarlMurphy@Wikivu.biz Northport Way 26
+-1786553019 true -65 -22474 14929 2147446227 1989464327 9511.273 5.86654785560309E8 79596075449045726.816 39942552524190612.962 2022-11-07 2022-06-21T12:58:35 2022-11-24 2022-07-11T06:10:41 19.107.68.34 tSanders@Jaxnation.biz Farragut Point 44
+-57438535 true 91 -17156 8627 2147444078 1521831153 11225.079 2.09693779861494E8 8183865884308683.425 80627252554457775.754 2022-11-08 2022-04-03T00:29:22 2022-03-20 2022-06-13T04:42:29 233.68.240.228 3Martinez@Browsedrive.info Donald Crossing 7
+1048271778 false -9 -13506 -28486 2147438346 -32114689 -3217.3818 1.872555303307973E9 73436580521307978.373 21307779971435471.232 2022-03-18 2022-08-16T14:54:57 2022-10-01 2022-07-12T23:46:35 204.85.217.82 et_modi_ut@Feedfire.gov Portage Junction 14
+-1642822773 true 28 22783 -31955 2147434485 -940172357 12963.05 -1.015348724865612E9 21415159800393256.390 1432088841386171.665 2022-09-01 2022-09-17T21:00:35 2022-04-11 2022-07-10T04:17:41 234.6.225.52 MelissaHenry@Realpoint.biz Bultman Court 97
+666196227 true -111 24610 -30943 2147432357 -1776521623 -7130.226 -5.00592536993921E8 16271114464316416.681 56924709102413625.675 2022-03-24 2022-01-23T12:31:45 2022-05-28 2022-03-26T23:37:01 58.48.43.183 ChrisJacobs@Buzzster.name Leroy Pass 32
+1747398517 true -17 -3026 29468 2147425822 -1873981318 25636.371 6.43280347073812E8 90354184407027392.172 33378418596041889.584 2022-06-28 2022-02-24T12:47:51 2022-10-15 2022-08-24T06:52:46 97.226.248.251 qRussell@Cogilith.name Kings Place 83
+515665109 true -1 -17372 20231 2147425482 635029396 -19429.021 6.56125881323546E8 7165704130056347.115 6517881695345385.105 2022-06-13 2022-12-05T18:10:15 2022-12-05 2022-05-04T22:35:17 243.50.186.81 ErnestFlores@Thoughtbridge.com Dixon Court 53
+-2085440894 false 40 -26116 -3291 2147424135 306086353 26600.498 -9.60218756607374E8 40720938996818932.750 28644420545888776.933 2022-02-13 2022-06-12T16:28:59 2022-10-15 2022-06-03T22:53:31 168.234.102.40 GloriaAustin@Geba.biz Towne Pass 41
+1728198625 true 26 16950 8811 2147419311 1233278399 -103.00702 1.520246238447387E9 88652736846204706.947 28290293258808439.134 2022-03-10 2022-08-07T15:58:44 2022-05-23 2022-07-05T21:37:51 133.108.194.1 DeniseRamos@Shufflebeat.net Mifflin Junction 55
+2121680377 false 29 -289 26743 2147398708 -1393968680 11646.462 1.957852164380779E9 85909529735007926.735 51773242262469907.285 2022-02-22 2022-08-12T18:11:59 2022-07-08 2022-08-27T13:18:38 234.138.112.197 qui_sed_illum@Meedoo.org Muir Street 54
+-1444836974 false -127 -23408 25721 2147392850 -1101220500 2316.0918 -6.35043706494339E8 35840155922867023.289 57804265792541730.362 2022-07-10 2022-06-26T10:41:26 2022-09-19 2022-02-11T11:21:58 144.119.210.60 quia_ut@Gabcube.info Gateway Center 79
+80365830 false -60 -8721 -22051 2147386878 1711980281 -29701.404 1.849181274536084E9 83609670760129800.710 30764594265766461.896 2022-09-16 2022-11-15T00:38:24 2022-06-14 2022-07-21T23:53:47 246.45.68.181 fHunt@Eire.edu Scoville Road 95
+-1425293393 false 22 -22449 1772 2147383369 170772797 27267.404 2.83215517915306E8 66999108327070808.155 72879775219031581.449 2022-12-17 2022-10-21T08:42:32 2022-04-01 2022-08-16T10:03:56 121.224.155.131 molestiae@Eadel.info Mayfield Avenue 56
+-2021504137 true 15 -29566 3184 2147375954 1446182442 27525.846 -1.443946518312972E9 17957789229933477.747 28228200342554508.463 2022-10-04 2022-01-26T03:41:36 2022-11-04 2022-08-09T07:43:48 119.180.253.71 beatae@Gigazoom.mil Warbler Center 96
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_asc.out
new file mode 100644
index 0000000000..2b4c94a07b
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q06_largeint_asc --
+-360936234 false -103 -18113 19389 -246711478 -2147482973 14880.098 -1.523112342164441E9 21878190873933476.500 84654501521416796.390 2022-09-25 2022-04-07T18:05:54 2022-05-30 2022-12-04T06:22:57 20.199.205.220 aLynch@Skipfire.mil Di Loreto Road 30
+468212053 true -100 12686 9445 1303195728 -2147477373 -272.6262 -1.337520506414394E9 99863726797306412.976 96061793274819565.143 2022-07-29 2022-05-10T11:59:21 2022-06-05 2022-11-30T20:02:35 116.199.111.187 oLynch@Skipstorm.biz La Follette Plaza 69
+-151903097 false -34 11103 24685 1766740169 -2147470250 -21601.188 1.276817809965177E9 44606525392375639.351 58314620472932457.796 2022-06-03 2022-12-07T09:41:05 2022-06-20 2022-03-21T12:40:58 89.87.243.146 5Mcdonald@Edgeblab.biz Messerschmidt Park 66
+117030171 false 64 18423 15956 269572186 -2147468067 3118.419 1.14080614906741E9 97285517234959003.152 75567480714706601.281 2022-04-25 2022-03-06T00:36:03 2022-10-25 2022-05-28T16:26:13 67.67.254.248 quibusdam@Thoughtstorm.edu Banding Place 66
+-1518026733 false 55 -8418 23923 368664399 -2147463607 31785.799 -1.504358530434769E9 27357840533120346.393 3856321685307290.500 2022-02-08 2022-05-30T02:56:16 2022-04-22 2022-12-19T03:11:53 133.61.35.110 placeat@Realcube.com Hagan Junction 54
+1253625867 false -2 26698 -29551 505158832 -2147460661 31994.326 -4.74098431981176E8 3099285301222708.927 89258531165302642.352 2022-07-16 2022-03-15T12:56:56 2023-01-01 2022-09-04T10:29:29 195.12.29.188 eFerguson@Devbug.gov Hovde Drive 86
+-1081011377 false 61 -2478 28518 -1274411366 -2147460092 5253.492 1.017796579773484E9 18578574573465258.900 36273428103740588.470 2022-12-27 2022-06-20T02:17:02 2022-12-24 2022-11-24T15:17:28 227.83.220.48 soluta_excepturi_voluptatem@Kwinu.com Autumn Leaf Parkway 8
+1230650249 true 5 3415 -10554 1490273478 -2147456557 26398.396 -1.225803954377621E9 14411424230518932.655 28860967798783963.919 2022-04-16 2022-07-19T17:48:55 2022-02-21 2022-02-25T13:09:10 233.151.111.62 bFranklin@Dazzlesphere.info La Follette Parkway 9
+1913589967 true -21 -15927 -26670 1730057638 -2147455128 -6386.3496 -1.241704346224951E9 37568557666081895.982 50526728974898764.444 2022-06-17 2022-08-29T17:34:03 2022-04-06 2022-11-25T03:24:41 75.238.221.73 AmandaJenkins@Zoonder.edu Ridge Oak Drive 89
+-1223275289 false -7 9373 9553 2021945645 -2147444846 -30542.957 -1.872565612753137E9 67600428727997910.476 17740170857018755.373 2022-02-01 2022-05-07T11:25:46 2022-10-22 2022-09-15T01:11:08 158.88.108.223 rWard@Eayo.com School Point 37
+954698511 true 122 26618 -2154 226924829 -2147436212 -25458.258 -2.084037938361169E9 73840033676088294.277 3593445574299269.961 2022-10-03 2022-11-03T06:21:14 2022-02-23 2022-10-10T06:44:51 37.232.120.223 necessitatibus@Tanoodle.name Dayton Terrace 36
+-1042580512 false 124 -16334 -18785 -1213650127 -2147434245 -28859.63 -4.26520567613069E8 51651176782949307.366 19845163495939085.178 2022-10-07 2022-06-07T14:03:31 2022-09-16 2022-05-04T14:48:45 177.86.31.32 JeffreyAlvarez@Eire.mil Springview Alley 12
+-1379710158 false 120 -28127 -11779 2006293223 -2147430826 16500.771 1.944697050616735E9 32098443507824497.353 80010595377329795.785 2022-12-11 2022-04-02T10:03:31 2022-07-11 2022-12-05T23:31:47 143.39.158.253 nulla_culpa@Edgeblab.gov Lakewood Point 85
+-519679092 false 113 -22035 -25464 1874606984 -2147430552 -28138.596 -1.228214561951064E9 83072574392637665.579 16920471508203112.408 2022-12-29 2022-06-02T05:20 2022-11-20 2022-11-27T07:30:34 96.95.209.35 LoriAlexander@Jaxnation.mil Butternut Street 30
+1796352784 true 98 26068 32563 -356943580 -2147429517 -27552.44 -1.682020011894294E9 22119933110158544.773 37063782312262520.329 2022-01-31 2022-02-21T00:09:01 2022-08-22 2022-09-04T11:30:07 155.217.45.197 PhillipRichards@Devbug.biz Warner Court 62
+300387588 true -71 7717 32637 142063602 -2147428986 -29604.64 -1.358212623780673E9 44149938348576967.404 39444397208179062.259 2022-06-14 2022-12-13T17:57:07 2022-10-26 2022-01-16T02:22:46 27.237.247.100 5Cox@Thoughtblab.biz Green Parkway 52
+-431936112 false -27 -27878 12495 100350310 -2147423561 -7305.504 1.666994499841093E9 72834442231694344.686 2429621132701832.504 2022-04-11 2022-06-07T09:36:46 2022-05-14 2022-03-27T01:06:41 88.177.123.59 MaryColeman@Jaxworks.info Dunning Court 47
+-2102830075 true -96 -13298 18670 1142814905 -2147420684 7109.774 -1.469514153557711E9 9700567439687183.354 37567364131794579.150 2022-10-17 2022-06-10T04:55:02 2022-08-01 2022-03-18T11:33:26 229.78.241.213 kOwens@Skalith.edu Milwaukee Hill 99
+1475943079 true 27 19583 4124 1240124884 -2147418398 4085.9597 2.124100330596222E9 29941035414366039.852 57484486337212427.249 2022-03-27 2022-08-12T18:06:12 2022-07-22 2022-09-05T08:20:12 225.255.60.232 tRomero@Jamia.gov Bashford Hill 14
+1039374017 true -79 -23899 8551 -869403442 -2147416198 11694.44 2.060779514945475E9 21456006682378061.440 46336475426741737.925 2022-12-15 2022-08-02T21:07:51 2022-07-10 2022-07-15T07:14:59 150.253.89.219 EricCunningham@Chatterpoint.info Cambridge Avenue 42
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_desc.out
new file mode 100644
index 0000000000..a9ddf9f207
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q06_largeint_desc --
+1947524459 true 20 -12236 -22730 -254043651 2147477970 32652.574 1.81252995854517E9 45443105341951463.379 92989254691730246.428 2022-01-26 2022-09-27T09:14:03 2022-05-10 2022-05-05T14:11:29 203.241.115.245 ToddWilliamson@Mita.net Independence Court 1
+683826634 true -54 -7307 -13351 -1817842795 2147475104 22036.732 1.49289066483237E9 91576671268310880.960 47268237300520155.430 2022-09-22 2022-04-01T09:40:47 2022-03-08 2022-12-06T15:36 12.208.19.233 wSimmons@Wikizz.info Oakridge Road 57
+-119905464 true 44 20850 31485 2110351806 2147467308 14726.297 -2.116799679040196E9 50421976480155985.787 18096615419125373.807 2022-12-17 2022-08-08T17:58:18 2022-11-12 2022-02-03T04:23:27 202.103.10.99 officiis_et_omnis@Vimbo.gov Hoepker Alley 16
+-2042402253 false -48 -13750 14822 -463532063 2147462906 29250.246 -9.53329295044577E8 74125400250152591.764 65141640514860949.237 2022-06-12 2022-11-04T16:42:21 2022-11-11 2022-11-24T15:54:28 80.218.178.26 adipisci_beatae@Rhyloo.name Elka Terrace 59
+-1570622241 false 94 1429 -19545 -578378367 2147461759 15314.816 1.269180209779099E9 83514287335752076.410 9720688031613570.665 2022-11-15 2022-08-23T18:34:37 2022-07-21 2022-12-15T04:57:02 107.8.55.199 et_maiores_quod@Wikibox.mil Ryan Alley 1
+-907837592 true -74 31309 -28430 176699102 2147453103 20794.389 1.676245213092824E9 30594542911506047.728 97998705376490694.780 2022-05-06 2022-11-17T08:21:06 2022-01-11 2022-06-06T13:08:23 57.76.60.111 6James@Skajo.com Burrows Crossing 79
+-952103582 false 79 -6825 -18855 -494447345 2147452974 -16348.068 7.98768657350112E8 75472366136429688.190 323181627092381.347 2023-01-02 2022-08-18T21:48:34 2022-02-15 2022-11-11T16:14:36 165.10.182.59 dolorum@Devpulse.com Artisan Drive 2
+331205063 false 39 -3895 -26200 -1478316915 2147450430 9825.488 -1.41916821735485E9 77032754816718293.492 60063426612015703.618 2022-03-30 2023-01-10T03:23:18 2022-01-30 2022-04-08T21:30:16 37.118.147.31 non_veniam_iste@Innojam.info Fremont Circle 28
+628008411 true -20 1408 29473 764874444 2147448236 -32209.44 9.48479975322217E8 25919373179366574.603 60109810009473038.185 2022-04-12 2022-09-10T02:45:29 2022-04-05 2022-09-28T21:25:05 166.120.223.31 ErnestStevens@Skynoodle.org Old Shore Point 26
+1527655526 false 9 -21127 22822 1595935241 2147441159 -17789.01 1.50715349820349E9 10022854468513820.850 27902839053795843.897 2022-02-02 2022-08-21T12:07:07 2022-07-25 2022-10-14T05:20:52 61.42.208.133 eos_accusamus_quasi@Fivespan.edu Ryan Avenue 35
+398836485 true -79 -16021 -20610 1640272994 2147434231 343.96222 1.36827702016383E8 93580208061798478.635 52127613480719973.480 2022-08-03 2022-09-22T11:54:33 2022-06-12 2022-11-28T07:01:50 50.238.208.223 2Johnson@Jetpulse.org Sherman Crossing 22
+-1768452915 true 102 30657 -27866 1219569626 2147430546 -30624.21 -1.57475059644786E8 98252031839665903.857 47463517184600068.589 2022-12-22 2022-06-01T22:23:01 2022-03-29 2022-06-07T22:06:39 13.185.213.79 vGonzales@Demimbu.com Delladonna Court 45
+-1905257328 true 17 -9679 -4552 1703854096 2147430153 20638.639 -8.49761147089966E8 62923240861759445.150 37888586206164868.780 2022-09-14 2022-07-13T10:43:50 2022-07-30 2022-03-31T14:14:09 51.117.123.126 sPeterson@Tagopia.info Goodland Plaza 70
+236355728 false -32 -12615 3567 692279612 2147429935 2580.702 -7.9936447504658E8 58662040384094405.250 15843459443851354.245 2022-10-31 2022-09-30T09:15:34 2022-11-25 2022-02-27T10:05:57 45.202.7.82 2Woods@Twimbo.net Kenwood Way 84
+-982320162 true -59 3154 3597 -267286656 2147422236 -32265.494 -1.17224805061347E9 11810409337999823.603 13195275906866189.194 2022-08-27 2022-12-01T07:30:24 2022-04-07 2022-12-18T13:06:53 55.111.10.106 bCarpenter@Nlounge.name Barnett Terrace 3
+2081279927 false 121 -2722 -29211 1932199506 2147420268 25321.805 -8.8706405191796E8 79625987451182569.849 11843733083881423.758 2022-06-22 2022-04-01T04:02:20 2022-03-30 2022-04-18T19:06:02 74.191.151.221 6Watkins@Fatz.com 3rd Plaza 10
+1583391155 false -73 -23617 -618 223905557 2147418766 -23098.146 3.75672820015594E8 79759186335411663.445 85929696615604319.578 2022-05-11 2022-07-23T13:40:35 2022-12-08 2022-12-15T05:20:03 58.193.16.232 nWhite@Meejo.com Ludington Street 21
+-1125250393 true 9 -32697 -18977 629183294 2147415722 -14578.275 1.140790249811087E9 54442471810989683.166 21260739465078612.550 2022-04-18 2022-01-17T05:05:50 2022-11-17 2022-04-12T18:54:42 190.92.79.131 nostrum_necessitatibus_perferendis@Brainbox.biz Dunning Lane 50
+-1202071084 true -27 933 -16029 -912865425 2147415689 18758.906 1.477874145025536E9 50513806382172699.667 76030009831914932.956 2022-08-01 2022-04-13T22:52:56 2022-03-22 2022-07-22T01:56:01 198.123.234.245 beatae_porro_earum@Fadeo.mil Miller Avenue 63
+-1619819254 false 118 26620 16970 935786761 2147412302 -19167.205 -1.04699334862877E8 99005295897018148.356 13241289963707582.793 2022-01-19 2022-04-29T16:15:57 2022-12-10 2023-01-03T18:46 174.28.24.125 dicta@Topicblab.edu Acker Avenue 52
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_asc.out
new file mode 100644
index 0000000000..378bebc1b3
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q07_float_asc --
+163743389 true 52 19155 -17843 904239531 -870063950 -32767.988 -8.48448360999358E8 66639118858001777.565 33565969037066895.718 2022-03-01 2022-01-28T19:07:42 2022-05-31 2022-07-24T00:47:48 187.21.149.194 JesseVasquez@Oyoyo.org Cherokee Alley 22
+527287762 true -75 -22704 -19474 2108790490 613611806 -32767.787 1.644913013099952E9 31375202450831669.536 86676668827760441.915 2022-12-15 2022-11-29T17:28:16 2022-02-09 2022-02-12T22:26:31 2.164.27.215 ut_voluptate_nostrum@Realfire.mil Sutteridge Court 77
+-1997414489 true -12 29739 -3935 -175996605 -1932953359 -32767.746 -2.074393977727773E9 64318533569881963.437 43041167243007063.975 2022-09-27 2022-08-02T16:47:36 2022-05-08 2022-02-16T00:16:30 31.199.136.214 RalphGraham@Voolith.mil Lighthouse Bay Center 8
+-1372209413 false 7 4996 -16429 -1729238049 1936002549 -32767.72 -1.972391364003938E9 29191167190453912.182 14902567026287623.608 2022-05-21 2022-11-14T15:52:20 2022-10-25 2022-06-28T16:18:39 103.139.73.137 JustinCarpenter@Einti.biz Twin Pines Parkway 83
+1444205621 true 101 10659 24047 322457889 1340057814 -32767.707 -9.08730451038922E8 20006513970590562.630 83017026184485620.890 2022-01-11 2022-12-02T22:17:10 2022-09-30 2022-07-10T03:32:07 151.249.119.32 eum@Skivee.mil Hanson Park 43
+894879503 true 122 14088 20384 19840994 -343237821 -32767.684 -5.77925471856236E8 64616761541007404.300 47712155853010152.649 2022-10-18 2022-09-22T12:16:47 2022-07-12 2022-07-13T00:55:01 146.145.128.31 7Kim@Kwinu.mil Dryden Plaza 18
+2138563210 true 111 -27347 21390 1348539021 1803141201 -32767.668 -7.92723412691912E8 18940294349435889.299 64429861037880761.570 2022-08-31 2022-10-24T00:10:45 2022-11-12 2022-03-30T03:28:42 5.92.88.123 quas@Kimia.name Northport Circle 28
+1541115159 false -56 26332 16149 -2087749504 -1918451952 -32767.629 1.505657067710979E9 14125801984329646.132 35974515412216284.768 2022-12-29 2022-12-23T09:43:14 2022-08-27 2022-09-30T07:57:09 178.38.96.116 sed_velit_velit@Skaboo.name Di Loreto Point 60
+1118268946 true 31 3670 16698 -412116091 -1176087665 -32767.58 9.96148449354842E8 2331543756766195.399 14704466008982914.593 2022-03-05 2022-11-12T19:54:38 2022-02-18 2022-06-13T04:20:21 253.140.247.58 RubyOrtiz@Yotz.net Kingsford Crossing 31
+-1183919667 false -54 19220 5741 -1885965822 40929511 -32767.557 1.897494615946867E9 60705295259854870.426 18809384744155126.992 2022-10-11 2022-04-07T05:42:40 2022-11-02 2022-07-03T02:38:25 135.82.1.27 6Frazier@Agimba.com Dapin Hill 10
+1391814994 true -113 15003 -16225 2144982721 1537538725 -32767.49 -1.036707525400561E9 62094645821469413.892 34151648280765961.556 2022-09-16 2022-07-27T06:59:26 2022-10-09 2022-12-28T12:27:58 219.3.222.122 aliquam_optio@Linkbuzz.name Delaware Park 68
+-292120529 true -109 20072 -13887 855210976 572793058 -32767.479 -9.95966842673598E8 10518058910752436.100 40439533526429101.994 2022-10-21 2022-08-06T03:23:51 2022-05-21 2022-05-20T01:20:46 64.172.124.211 quasi_sed@Linkbridge.biz Russell Park 40
+1912768977 false 53 2404 23197 415683678 1824160959 -32767.453 -2.039937903393366E9 67542038172891692.347 49547346495865901.946 2022-07-29 2022-05-31T18:16 2022-01-11 2022-02-02T01:21:18 232.113.214.41 7Kelly@Kanoodle.mil Ludington Park 17
+-663883696 false -77 7967 17077 -1790026203 -290248005 -32767.354 -9.28722235122386E8 24631351662980061.994 3006589949410236.238 2022-06-12 2022-03-03T03:10:23 2022-04-04 2022-12-13T19:11:50 131.226.158.250 NancyReed@Tagchat.mil Moulton Place 40
+-2141049079 true 28 21242 29443 -1096721480 -1278081844 -32767.334 6.35216208676209E8 70115031022976032.272 38168021051635209.280 2022-06-29 2022-04-20T19:27 2022-03-11 2022-10-03T23:47:27 5.1.22.237 oThomas@Devpulse.com Hoard Terrace 92
+348541137 true 48 -2077 24889 -1856473613 -552848396 -32767.33 1.084642554354116E9 67110277205429974.534 58977472424341523.150 2022-05-12 2022-02-11T18:55:06 2022-04-08 2022-02-13T04:02:10 219.197.188.140 quis_distinctio_ut@Realbuzz.com Utah Street 22
+-1498682406 true -71 -15126 14471 -49252508 -1729837304 -32767.291 1.420844360079393E9 33440706532871170.910 13217520985568169.130 2022-09-09 2022-10-30T01:15:15 2022-05-20 2022-04-15T16:27:31 1.200.56.211 LillianLawson@Vinder.org Bluejay Lane 62
+1529540128 false -67 30913 14670 180234905 1441689123 -32767.148 1.486941962798543E9 28309713375130051.380 66788060212625427.800 2022-07-17 2022-12-07T06:20:09 2022-07-27 2022-12-20T00:56:18 91.214.19.50 7Elliott@BlogXS.info Nova Alley 59
+1657305847 true -69 -24133 -30961 1295918703 -582139753 -32767.148 9.25359500606945E8 60393934721443505.647 60804256677594169.934 2023-01-06 2022-02-26T05:59:38 2022-07-12 2022-09-15T23:02:14 120.166.54.251 PhyllisHansen@BlogXS.name Butterfield Junction 82
+-1621732482 false -79 -1558 -25539 -499854500 851517119 -32766.943 1.413894336107252E9 58594526725832285.190 38741293912690690.322 2022-07-01 2022-01-29T20:31:19 2022-04-30 2022-10-27T17:15:41 120.118.142.155 DianeHicks@Eabox.biz Redwing Street 99
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_desc.out
new file mode 100644
index 0000000000..9236fa9521
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q07_float_desc --
+910543754 false -29 -30329 1822 -1823175604 -1358168511 32767.928 2.009688291575429E9 17771168838097809.431 26844134249385819.791 2022-07-16 2022-09-27T15:50:52 2022-05-11 2022-05-01T22:47:40 238.180.194.241 illo_odio_doloribus@Edgeify.com Anhalt Park 64
+1433211184 true -104 8926 15485 191948397 -498481413 32767.89 5.6676607501201E7 21068783695616905.925 54405155782334714.669 2022-12-29 2022-10-10T18:16:59 2022-10-30 2022-12-22T02:25:34 232.100.143.255 lStone@Agimba.gov Hovde Junction 64
+-1953417084 false -90 15635 -15276 1283692793 233117712 32767.844 9.99261833045144E8 15327922014220167.461 74203772188095329.182 2022-08-23 2022-07-20T02:08:55 2022-02-01 2022-12-26T10:05:45 111.58.77.158 voluptate_sed_sint@Skajo.com Kinsman Avenue 61
+1042872800 true 84 -7438 -4479 -349690738 -1342593648 32767.53 -1.017541295853379E9 53464723428371155.899 32476403216500129.837 2022-03-12 2022-02-02T13:44:46 2022-02-08 2022-06-14T10:00:45 178.224.29.55 MargaretStanley@Twinder.edu Saint Paul Hill 86
+817559585 true 50 32753 -6817 -1183035245 1129687357 32767.525 6.83977389495487E8 90865788207515996.658 45175105158261917.900 2022-12-02 2022-04-06T03:01:25 2022-06-25 2022-07-17T12:06:46 36.121.121.59 est_qui_corporis@Brainbox.info Comanche Street 98
+-1567775804 false -68 13626 13999 -2006471494 2064760274 32767.498 8.67897806228493E8 5676096559725262.986 4142119437709967.790 2022-12-16 2022-06-28T18:00:15 2022-03-23 2022-04-17T10:25:42 29.50.242.117 MarilynRomero@Meemm.com Dunning Alley 53
+-424027171 true 28 29392 28017 2059621459 495895095 32767.463 -6.31667614588921E8 13000911596646026.488 65571725069055468.712 2022-10-09 2022-11-16T18:12:51 2022-10-16 2022-03-11T19:39:11 177.125.29.161 kSanchez@Thoughtbeat.name Elmside Point 30
+1202492448 false 29 19107 -2808 1220184058 389440903 32767.441 -8.69481459751087E8 82307710315546489.595 9019805071295258.504 2022-02-10 2022-03-04T13:39:07 2022-03-12 2022-09-14T00:12:35 6.78.18.222 6Robertson@Skynoodle.edu Jenna Court 8
+-2002003999 true 34 10190 13004 -1856335607 -377606691 32767.35 1.618143559024504E9 24314642946067219.289 36797980679486173.500 2022-09-10 2022-06-10T06:52:54 2022-10-22 2022-07-23T01:42:47 150.62.5.109 jRomero@Rhybox.info Sachtjen Drive 84
+469288433 false -110 -19442 6042 1658024718 -447004279 32767.307 -1.558000125151187E9 21675360843130030.892 51540230440208955.468 2022-11-14 2022-06-26T14:02:51 2022-05-08 2022-12-31T20:00:01 18.110.198.57 5Rose@Devbug.org Cherokee Parkway 48
+-1954795290 true -45 2589 -2609 1897557978 50007734 32767.264 8.0396261208888E7 33064805090486846.974 52787049966600263.166 2022-12-26 2022-06-13T08:51:42 2022-03-29 2022-11-06T18:35:01 65.174.60.242 et@Skinder.gov Loeprich Pass 52
+-1753605916 false -28 -12781 -26606 -1497909968 722420626 32767.158 -4.75277368579731E8 19593895174108654.977 27012952279549600.521 2022-07-15 2022-07-07T07:51:43 2022-08-13 2022-10-15T13:11:53 36.79.152.158 iDean@Jabberbean.info Goodland Circle 26
+2005962291 true -36 -15877 8202 1248745923 -1451993096 32767.125 1.557614928545075E9 36745461578276620.586 24848911496818958.569 2022-12-21 2022-03-30T16:29:29 2022-04-17 2022-07-01T20:53:09 27.217.220.253 qFox@Fliptune.com Macpherson Road 35
+-597580272 true 4 -29579 -10518 -764816941 -1618315528 32766.848 2.46997485521595E8 3596523905488433.465 23696968649873.157 2022-01-27 2022-07-11T10:38:39 2022-09-14 2022-08-20T18:58:39 255.5.162.121 ArthurDean@Skaboo.net Londonderry Place 98
+-672954044 true 59 -1042 -12995 -303249502 328851185 32766.832 1.460692812883648E9 40337792162187.664 41222404113028818.193 2022-10-18 2022-06-30T10:13:20 2022-09-21 2022-08-18T23:31:02 145.15.191.95 4King@Fanoodle.org Derek Park 69
+2003639773 true -104 21971 9106 -1638231600 -480668649 32766.648 -1.274022605370237E9 11266174902460852.644 40273337117344981.355 2022-11-21 2022-09-06T07:19:29 2022-05-05 2022-02-03T03:14:10 153.249.100.179 accusantium_et_voluptates@Aibox.mil Luster Circle 39
+-1369192144 false -4 12436 -29145 -178771063 406979373 32766.59 2.9066412262873E7 24458404583836435.310 66737064997984085.407 2023-01-06 2022-02-04T00:40:21 2022-11-13 2022-05-26T19:50:30 174.213.103.117 voluptatum@Devcast.com Dahle Pass 15
+-280203044 false 40 -9290 -19846 1046717849 -1967897496 32766.408 -4.45127586899636E8 68745674857304603.848 72627986434926943.767 2022-04-28 2023-01-04T00:48:51 2022-08-29 2022-04-30T12:06:27 156.17.115.230 pariatur@Lazzy.com Glendale Park 56
+2103033654 true 46 -28411 19644 -308190496 -1006156944 32766.365 1.798419471510469E9 71539937481829950.261 35899895852191727.300 2022-07-09 2022-12-09T12:21:37 2022-10-30 2022-03-10T12:56:28 150.74.242.207 cumque@Reallinks.mil Esch Junction 16
+1942481155 false -26 -17735 12387 1271224400 135439250 32766.299 7.74548148382679E8 39865411029260070.183 37717294824782877.120 2022-01-28 2022-06-11T04:27:44 2023-01-06 2022-09-20T09:38:26 161.28.174.115 nesciunt_necessitatibus_ut@Skidoo.biz Messerschmidt Court 93
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_asc.out
new file mode 100644
index 0000000000..5aa15a6067
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q08_double_asc --
+-764499270 true 26 24437 4297 -405123470 354795119 -25761.59 -2.147482437676639E9 50575378749456234.868 30524842082085362.905 2022-03-10 2022-05-18T01:05:45 2022-09-13 2022-03-10T18:42:24 47.119.254.67 EmilyOrtiz@Innojam.net Stoughton Trail 78
+1618972173 true -122 25912 -1856 -2012289867 -1742024386 -19357.436 -2.14748217408611E9 68319443496875372.242 45617452929508063.366 2022-02-04 2022-09-03T23:05:27 2022-09-23 2022-08-08T06:35:44 167.91.84.230 tenetur@Topicware.info Ronald Regan Parkway 48
+-799030059 false -125 213 15786 -2040869063 984234332 -24888.938 -2.14747852680751E9 61624435405251776.949 61735959420070173.869 2022-09-17 2022-04-30T12:11:50 2022-11-27 2022-11-01T02:03:25 46.8.13.249 PatrickSpencer@Gabtype.edu School Park 50
+-1899197623 false -26 24825 -8689 1208235307 653919993 -9123.589 -2.14747585583476E9 99499821157588901.634 96766443104061067.216 2022-08-27 2022-05-26T11:23:38 2022-09-09 2022-03-22T14:21:15 213.118.149.191 RussellLittle@Skilith.mil North Lane 69
+1337158396 false -18 -640 -9108 1543030331 -533892269 -9892.433 -2.147470382276245E9 79205585363517823.524 21060798832666421.875 2022-05-23 2022-11-29T10:17:27 2022-05-24 2022-08-31T01:03:43 21.2.251.252 SarahWeaver@Kwimbee.net Eliot Parkway 60
+255696102 true 121 -10884 -2623 1728404501 -520433238 -2531.246 -2.147469149301041E9 16927494567415021.299 61238282568646523.204 2022-07-23 2022-04-24T22:56:47 2022-12-10 2022-10-24T01:20:17 166.54.119.20 oKing@Jabbercube.com Knutson Crossing 24
+360619046 false -123 23752 -13890 1767976805 735050569 14621.793 -2.147462989813695E9 72927487236500898.421 42604827030624254.664 2022-10-17 2022-10-14T20:30:48 2022-05-02 2022-08-24T09:56:25 198.56.155.197 TimothyRobinson@Kwimbee.name East Point 3
+-1979527959 false -121 6012 -1965 -1995889486 2005454932 -3898.677 -2.147460972447545E9 57374890084831617.256 96481041268303342.302 2022-08-08 2022-11-30T20:42:59 2022-08-12 2022-10-23T23:07:39 145.178.228.193 suscipit_aliquam@Miboo.net Division Park 9
+1490780528 true 121 -10808 -21127 881631226 -640203604 2886.5693 -2.147459826391465E9 30866240195387124.250 94602930294624568.738 2022-07-23 2022-07-26T04:53:27 2022-03-11 2022-02-23T04:22:49 183.164.104.224 aFord@Muxo.name Gina Trail 75
+2030521986 false -17 -8492 31858 -375749426 -1875503799 -30491.041 -2.147454316996151E9 20036407418065005.612 35505781736306985.300 2022-02-11 2022-05-08T22:26:37 2022-07-09 2022-07-05T09:07:16 87.36.135.225 fLarson@Gigaclub.name Artisan Place 64
+51975815 false 100 3446 13719 744168247 1742463622 10450.202 -2.147450080574351E9 1777397163243433.240 91736531098704944.738 2022-09-09 2022-01-20T06:02:31 2023-01-02 2022-05-09T11:21:56 142.252.236.123 tFrazier@Geba.net Derek Place 7
+1614048198 true 45 21251 20284 880607708 684694333 13335.993 -2.147447600027668E9 56704909797333381.900 56051979616913558.930 2022-06-07 2022-09-24T08:22:58 2022-11-29 2022-06-13T09:37:54 251.89.212.99 aSpencer@Skyble.edu Amoth Terrace 74
+-1740580465 false 47 -4202 -2877 -1658533753 454202975 -5924.0073 -2.147443564400919E9 13909108580868795.867 81393249943026065.254 2022-09-15 2022-11-21T00:47:47 2022-11-08 2022-09-11T07:06:33 146.190.118.89 NicoleWatson@Livetube.org Ryan Pass 36
+1086220178 false 119 1120 4099 -743216727 -1037219689 17388.986 -2.147443170041909E9 40462312893491746.636 62655508944115419.579 2022-05-03 2022-05-01T22:00:31 2022-07-31 2022-06-15T08:48:01 65.23.172.93 StephanieHansen@Thoughtworks.info Red Cloud Alley 1
+-834703134 false -83 -5021 -26145 -490124641 -203241250 -3014.7898 -2.147435767935103E9 24883142112718518.660 83215815942254282.599 2022-05-09 2022-06-14T20:14:32 2022-03-14 2022-09-19T23:52:38 137.6.5.34 JuliaDaniels@Izio.biz Lerdahl Point 49
+-1644562084 false -81 -17630 -10269 -1476674200 -268792458 13778.415 -2.147435208942339E9 93226194917360130.580 76077621753438032.418 2022-07-02 2022-08-07T20:32:33 2022-02-06 2022-04-15T18:12:20 195.140.76.121 qWhite@Ooba.org Maywood Junction 85
+-329599617 true 78 -20341 -3857 -373161437 -965487650 3162.9028 -2.147426668518247E9 87660212947422082.248 10185796628713839.151 2022-08-08 2022-07-26T22:40:14 2022-07-01 2022-04-22T15:18:10 227.174.162.56 xFox@Centidel.net Kings Point 27
+-2118924335 false 18 -1110 -2915 887338146 -1973362361 12884.521 -2.147414306997674E9 58177080984258084.521 5852994288487202.801 2022-04-12 2022-06-14T16:11:06 2022-06-14 2022-02-02T02:55:25 194.10.208.88 asperiores_aut_nam@Eimbee.info Scofield Road 30
+-449588364 false -128 24594 -1774 260022507 1280236247 25504.85 -2.14741145881511E9 50419753384455671.508 743933466293884.547 2022-08-21 2022-02-20T08:53:48 2022-08-08 2022-06-27T01:36:01 47.55.246.239 voluptatem@Flipstorm.info Burning Wood Terrace 31
+-1777671182 false 10 6759 14677 1767178007 1442964429 814.3629 -2.147407577546572E9 88192023490142365.694 6136230207395435.673 2022-03-06 2022-03-22T20:48:47 2022-10-30 2022-05-08T04:59:26 93.78.153.54 JoanDuncan@Quinu.info Helena Center 83
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_desc.out
new file mode 100644
index 0000000000..fc68d07830
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q08_double_desc --
+-1998663321 true -41 30904 -24569 -1901453444 775713590 9847.924 2.147477153306775E9 18887933329250990.563 6972130491285679.714 2022-01-13 2022-02-22T18:46:35 2022-02-19 2022-12-29T21:44:26 210.166.146.182 voluptatum@Zava.com Esch Parkway 0
+1946176142 false -17 24299 -5828 603774063 -476157404 17167.95 2.147476799175778E9 61087522469466821.603 10031075483039884.550 2022-05-09 2022-11-01T11:02:13 2022-08-04 2022-02-20T13:20:26 119.189.18.178 StephanieHart@Browsecat.gov Lunder Center 51
+1395389157 false -5 8267 31786 -714596317 -1226086125 -21627.693 2.147468982588477E9 54918077517454206.357 59040238131172211.256 2022-11-27 2022-06-02T10:50:01 2022-05-27 2022-04-01T02:13:12 181.233.37.54 nTucker@Realbridge.com Anderson Park 30
+842495905 true 18 14246 23967 318494459 -1292820840 12325.499 2.14746497311557E9 43745863329775500.490 53122206704355399.609 2022-12-25 2022-10-02T21:28:33 2022-05-23 2022-10-30T19:57:07 138.39.3.221 assumenda_aut_sed@Kazio.com Lakeland Parkway 26
+1854244294 false 72 27006 -23952 -1017580911 1526696207 30609.816 2.147460658319948E9 78955888319979537.554 73134490765858113.307 2022-04-29 2022-10-10T06:01:34 2022-06-04 2022-08-26T04:30:04 136.152.216.121 hDean@Skynoodle.name Arkansas Terrace 20
+-2057011457 false 115 283 -16515 -414860945 121510438 -15174.003 2.147450667851302E9 82161872297771737.741 61168599630920854.600 2022-12-19 2022-05-20T08:41:28 2022-12-20 2022-12-26T20:59:12 180.254.29.2 odio_quia@Zoonder.biz Golf View Center 59
+-2078089156 true -68 25258 16043 -727722977 -1054357441 7078.5977 2.14743292335321E9 12249955471390332.374 89956947221100614.123 2022-07-11 2022-08-04T22:33:31 2022-10-08 2022-11-18T22:52:22 47.235.187.120 JoshuaPerry@Wordpedia.com Utah Avenue 54
+723005626 false 76 11843 2419 953563840 1413362882 32233.459 2.147432562021997E9 63085092039170869.321 69892845086489081.642 2022-10-26 2022-05-08T10:23:32 2022-04-04 2022-03-11T20:17:23 240.88.225.211 nemo@Rhycero.com Nova Court 10
+1332530347 false -121 24247 -24187 1376216092 675804821 -20800.373 2.14743177926813E9 54374081283430912.995 83819753605409270.940 2022-03-08 2022-05-16T23:30:23 2022-04-10 2022-09-07T07:35:38 161.243.186.40 delectus_voluptas_aperiam@Tagtune.org Forest Run Plaza 25
+-54275022 false 37 6603 14897 -785451379 408672726 -25067.922 2.147426985925759E9 94979755077430855.427 38108027258674830.609 2022-12-27 2022-04-23T03:02 2022-02-07 2022-09-04T03:43:28 203.203.153.47 iste_est@Thoughtstorm.org Superior Hill 0
+1159460881 true 91 1792 -10013 -1834847947 -1481262619 136.31235 2.147421724471276E9 78587339836232130.857 94408615957889922.260 2022-11-13 2022-10-10T09:11:53 2022-05-17 2022-11-13T18:40:31 243.176.29.130 laboriosam_quasi_quos@Devshare.mil Schmedeman Road 28
+1265245348 true -64 -28281 -14560 -371885987 905661693 -13961.722 2.147417387496636E9 92469965794419874.219 49650554866602497.370 2022-10-29 2022-06-09T04:57:20 2022-10-26 2022-12-16T09:20:02 206.2.225.250 mParker@Oyondu.com Dapin Avenue 28
+331679199 false -128 -20686 -8126 318786654 -1552841847 11839.364 2.147413172813562E9 41648836477421064.713 19312280480540543.880 2022-07-14 2022-08-21T08:59:58 2022-09-23 2022-06-15T16:56:51 5.195.160.79 uBarnes@Topdrive.edu Coolidge Way 33
+1780480893 false -106 8200 16814 -878937379 -1880737224 -31797.973 2.147412744844992E9 75564725097441111.249 53857411133700231.500 2022-01-19 2022-01-25T12:55:42 2022-03-17 2022-08-09T07:40:01 107.150.26.3 eVasquez@Jabbercube.info Shoshone Circle 50
+1266974024 false 8 18536 -2976 -1506689957 -183877855 11343.571 2.147399311893309E9 71012217344071727.370 68351529092632845.532 2023-01-10 2022-10-09T08:21:53 2022-01-28 2022-09-08T16:18:16 200.126.93.129 StevenGonzales@Skilith.net Eastwood Lane 56
+1850530450 false 28 -13958 -25865 -365827392 690921161 -1557.4167 2.147391585487465E9 11894844023068530.736 28417565408603064.442 2022-11-26 2022-07-21T16:17:14 2022-11-19 2022-12-24T07:43:42 174.50.207.114 voluptas_ex_quibusdam@JumpXS.gov Tennessee Parkway 38
+-223099881 false -107 -32128 29734 840320864 1693609531 -15432.139 2.147374650680583E9 74009074929680668.123 8454955674736884.949 2022-09-07 2022-09-10T09:28:50 2022-08-06 2022-07-04T11:42:30 237.78.243.35 BonnieMurray@Quinu.net Golf Course Terrace 1
+-701705828 false 54 14504 -18689 1065362379 1723072084 -20047.71 2.147374402750129E9 32781601533828468.477 3956641329612931.282 2022-12-26 2023-01-04T07:29:52 2022-10-21 2022-01-20T14:09:12 64.182.181.153 7Richardson@Devpoint.biz Westridge Terrace 47
+-1067181369 true 48 18524 31536 -411624765 -1501617938 1917.4728 2.147374277357E9 46226364337403049.211 39890706948753974.422 2022-04-08 2022-02-28T23:14:02 2022-04-19 2022-10-24T12:19:09 231.224.150.46 PatriciaWebb@Tagchat.gov Golf Hill 78
+1635136378 true -105 18780 21173 -416214628 -202772752 3968.7388 2.147372430138913E9 40350761596541333.603 12066789381999898.187 2022-06-01 2022-06-20T20:45:14 2022-09-09 2022-10-01T14:17:44 194.138.106.58 DianaAllen@Fivespan.biz Everett Pass 59
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_asc.out
new file mode 100644
index 0000000000..61d2727d57
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q09_decimal_asc --
+-1654381390 true -126 -287 -6431 -2094463843 -990277862 8351.304 9.52050585850082E8 104274718933.432 82013240745568720.901 2022-10-10 2022-05-07T07:44:30 2022-06-26 2022-11-21T02:13:11 151.59.35.29 saepe_perferendis_ab@Yotz.edu Porter Plaza 40
+-1279291239 false -124 -27634 11605 63620993 -1570634768 18759.242 -8.53030323635455E8 238388965769.804 18877219711981123.246 2022-02-09 2022-10-18T01:16:37 2022-09-22 2022-03-23T21:01:42 166.200.198.197 qKelly@Einti.com Green Ridge Lane 56
+1415238354 false 17 25509 -712 772939954 -54139136 17758.87 1.78211739312035E9 241226087670.720 79625029259661832.927 2022-08-20 2022-03-17T23:05:52 2022-08-21 2022-01-23T17:20:35 33.167.110.221 AndrewSims@Aimbo.net Stephen Park 32
+388581749 true -89 13926 10398 269519612 -546659434 26608.496 9.70142659013418E8 378676839453.902 33235860598493411.504 2022-09-30 2022-10-24T14:04:16 2022-06-17 2022-09-27T19:14:53 220.92.0.99 vChapman@Abata.com Dorton Hill 77
+851869283 false 11 -13716 -23084 1004223908 -385171186 27309.123 1.716578506914097E9 434372319510.908 86999570572123405.400 2022-09-25 2022-09-02T06:06:56 2022-12-08 2022-02-15T03:19:24 125.240.174.59 et_molestiae_non@Pixoboo.org Coleman Pass 49
+413849321 true 64 -5015 -29331 -1620632531 -807690206 15233.427 1.359906008175727E9 474043731872.732 3296721712805713.971 2022-01-24 2022-06-27T02:26:22 2022-11-24 2022-10-13T19:00:54 7.161.103.24 CarolCrawford@Fivebridge.edu Colorado Park 15
+-314465705 true 11 1205 -20248 -109280563 -189384810 15941.971 1.155589209973932E9 658402189460.136 40924992124640391.216 2022-06-14 2022-09-26T13:26:56 2022-02-03 2022-09-05T10:19:11 156.11.79.235 2Ross@Jetpulse.mil Glendale Lane 58
+1148971892 true -90 -6042 26893 -78343958 1689911978 -5118.9185 -6.43478737364875E8 885035886287.540 80953826781875982.688 2022-09-27 2022-09-17T09:14:05 2022-02-17 2022-10-18T19:22:21 76.215.214.71 nostrum_dicta_excepturi@Zoombox.name International Center 6
+2012090241 true 46 -29000 17658 -1163677228 -2126469198 -11242.861 -1.380599417257768E9 1102989768080.759 63984933812840887.410 2022-11-30 2022-09-22T14:46:47 2022-03-15 2022-09-03T23:14:13 102.25.80.204 qui@Edgeify.org Bonner Crossing 40
+-1285196598 false -54 24192 16174 1470915099 1695169698 856.2539 -1.179340611439944E9 1192584436496.690 15993738623443003.311 2022-08-14 2022-09-29T22:43:24 2022-04-14 2022-06-27T11:28:34 144.180.163.119 ipsam@Wordify.net Randy Court 90
+679530362 true 33 -3474 10616 1009547889 1476451250 9865.36 -1.057024605749733E9 1307922323512.678 22192081719878907.454 2022-02-06 2022-10-23T18:15:14 2022-04-25 2022-10-14T04:54:56 25.8.135.230 ab_sint@Kare.info Brown Circle 90
+-967987423 false -112 -27283 2207 696034893 -1099640075 -6205.9883 8.73004570867467E8 1364712051686.780 60176335006203914.181 2022-08-05 2022-02-16T23:03:06 2022-09-29 2022-09-20T09:13:40 8.73.82.32 qui_amet_sed@Demimbu.net Surrey Crossing 65
+-1392892943 true 123 -15988 -30951 -1881690009 -484056798 -6971.7705 -1.450082975919906E9 1546077432131.302 82692433157462219.355 2022-06-13 2022-10-03T20:25:07 2022-07-02 2023-01-05T05:02:29 0.247.223.33 CarolynBradley@Jabberbean.edu Grasskamp Road 39
+470778815 true 107 -17315 16251 -1869314153 1083714597 -522.2943 -1.344632809022432E9 1650345856597.424 91471053441982863.900 2022-10-07 2022-12-02T15:02:22 2022-09-11 2022-12-03T00:39:22 107.87.16.12 ArthurOlson@Browsezoom.net Merchant Plaza 68
+-1092075920 false 73 27396 -21583 76648457 -580821534 -11190.054 -1.643367278440527E9 1680327468670.480 19353454235864461.644 2022-08-27 2022-05-30T07:30:49 2022-12-15 2022-12-11T02:53:55 130.24.210.219 PamelaGordon@Cogidoo.edu Utah Park 40
+-588151703 true -43 -19482 21813 -2030067917 -1298426450 18488.309 1.154939669212595E9 2128119976896.118 73821097923517915.774 2022-05-03 2022-04-26T23:06:46 2022-03-18 2022-09-03T16:18:03 226.235.187.38 laboriosam_accusamus_iste@Devify.biz Grayhawk Center 68
+1184003545 false 91 5750 -26891 -110467611 1287314168 -30644.705 1.747664269464388E9 2189861255277.600 97568616219333432.353 2022-05-05 2022-04-26T04:38:55 2022-10-01 2022-09-10T10:51:55 21.110.66.170 omnis_ut_inventore@Meetz.org Pawling Street 52
+-2070260485 false -31 23732 -1370 67641154 1438330869 -11211.295 -1.217490499883765E9 2573316059081.415 91779882057472742.208 2022-06-13 2022-06-04T19:47:14 2022-09-14 2022-08-07T10:31:28 228.39.218.73 voluptatem_ab_quidem@Skimia.com Mayfield Trail 92
+-674059843 true -34 9417 5985 1246194234 -737940949 15110.503 2.079840062685427E9 2701365024477.353 22790783297462329.277 2022-12-11 2022-08-23T08:42:16 2022-07-17 2022-09-01T18:30:38 30.50.249.229 rReyes@Feedbug.org Washington Circle 51
+1010144344 false 108 -11471 -7937 1069327136 -1266148182 25716.775 1.179133008519111E9 2704806075959.329 40438284601243562.653 2022-10-16 2022-12-28T20:15:22 2022-10-31 2022-06-25T16:17:26 101.8.185.15 5Barnes@Yodoo.net Northridge Terrace 49
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_desc.out
new file mode 100644
index 0000000000..109a030c88
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q09_decimal_desc --
+-760703264 false -104 -21630 20223 -48778739 1753753753 11044.746 2.0486295517382E9 99999907302815431.463 80013672506374964.175 2022-10-03 2022-03-03T02:57:55 2022-02-11 2022-02-08T17:09:22 77.69.100.114 doloribus_labore_possimus@Topicstorm.org Paget Trail 37
+-1013517165 false 3 19740 27573 1902847973 1013255347 14831.712 1.407728698006076E9 99999825142998731.887 11854731116764143.883 2022-06-20 2022-11-11T12:21:25 2022-07-29 2023-01-10T07:23:51 210.105.147.152 JoycePowell@Ozu.edu Waubesa Court 18
+-631063059 false 42 19491 23518 1213684540 -1344262688 -24247.63 1.198089740108392E9 99999691649048205.378 47131855708359167.528 2022-12-28 2022-09-26T13:27:26 2022-02-23 2022-06-02T06:09:09 109.77.118.88 JudyLittle@Dynazzy.net Green Ridge Center 66
+1771098820 false -2 -22018 -17776 -856766628 -224328857 2318.4412 1.668053802644466E9 99999690569344852.757 4699441330808714.534 2022-06-25 2022-06-05T09:48:15 2022-05-25 2022-08-16T23:08:20 114.246.69.219 JenniferRay@Dynabox.biz Cascade Plaza 53
+-1544701155 true 27 -21510 -1701 -771189588 944304750 -23516.396 1.282086787685226E9 99999527862620834.260 73326124982233438.548 2022-05-17 2022-02-28T19:27:18 2022-09-25 2022-02-01T12:57:15 231.243.121.69 DanielCox@Agimba.com Havey Pass 12
+1445243678 false 16 29340 7115 1299358565 1414075728 1121.1704 2.5768813823955E7 99999480488551022.370 25906682705073769.881 2023-01-04 2022-08-07T00:14:20 2022-12-28 2022-01-31T02:48:49 157.70.26.221 eCampbell@Demizz.info Mendota Trail 94
+-1735152012 false 108 21050 -24102 -1829957619 898524354 2950.0564 5.2627884713044E7 99999427697608819.875 85764936027920089.444 2022-01-18 2022-12-28T02:19:52 2022-09-08 2022-08-29T18:38:23 18.149.12.111 LillianWatson@Flashset.biz Bonner Crossing 10
+-1475922156 true -52 29201 -31216 -1269636186 -2008441711 -15075.176 1.991885690891815E9 99999353009708383.460 86632186864138858.274 2022-04-28 2022-01-16T11:41:36 2022-07-04 2022-03-06T04:28:17 79.170.36.184 JoyceCrawford@Demivee.name 1st Pass 35
+-1968390049 false -42 30950 18627 -1233125274 -1245545292 -23570.18 1.167376285421624E9 99999171140586231.458 41826205585929464.702 2022-05-15 2022-02-03T10:45:35 2022-05-17 2022-01-24T12:21:24 79.221.191.181 RobertHenry@Youspan.edu Namekagon Avenue 56
+2090648306 true -120 -1603 -21307 -2146282454 -322123500 12998.556 -3.21255428700764E8 99999040341261239.986 15708754671771196.309 2022-04-27 2022-06-14T10:46:04 2022-06-28 2022-07-13T00:07:51 12.247.87.160 jSmith@Avaveo.edu Loftsgordon Park 13
+338555849 false 100 -12535 27960 -891068687 -351386551 31962.186 -1.117344705452739E9 99998894052756341.691 94201901147831645.849 2022-10-15 2022-01-23T15:47:59 2022-12-27 2022-02-24T05:51:55 214.103.101.167 fugit@Blogtag.info Londonderry Avenue 34
+284645694 false 5 -14392 8963 -3065303 21170466 31113.385 -9.51652551293124E8 99998881983973310.520 82458962889574301.734 2022-09-06 2022-07-20T20:40:23 2022-04-30 2022-10-09T01:23:56 204.208.183.176 GeraldMcdonald@JumpXS.gov Forest Place 30
+1016713106 true 116 28655 19783 515729994 -11683504 23774.346 1.656190033684653E9 99998855004419177.993 20089459116854946.510 2022-11-24 2022-10-25T13:26:48 2022-06-07 2022-05-06T08:15:30 138.8.107.3 repellat@Wordtune.edu Carpenter Junction 31
+-21656627 true 115 -3371 -9369 -700924173 -1781241348 -15935.006 -9.67698551989422E8 99998768537510278.178 43597087835894757.488 2022-07-21 2023-01-07T01:56:26 2022-02-22 2022-03-16T21:47:01 173.251.108.10 BillyPatterson@Youbridge.name Sugar Alley 77
+-1927543079 true -40 -31072 -25490 405529197 1292850334 -32196.783 -6.14483966690681E8 99998748853209208.254 61167166838010741.959 2022-12-02 2022-03-19T12:53:35 2022-11-26 2022-01-21T01:53:56 1.41.65.135 JimmyRichards@Skyble.name Clemons Court 95
+190194171 false -20 10877 5574 -1458420761 -1083190436 -29883.58 -6.0318331732583E8 99998717054111542.440 44969884991550372.471 2022-09-21 2022-04-30T20:43:19 2022-07-31 2022-10-16T23:15:34 159.31.214.125 2Williamson@Realbridge.com Birchwood Circle 86
+1500811628 true -88 -21207 -17949 1069420461 -358989795 -23976.33 1.204454319052688E9 99998602099384240.852 48641501549913926.379 2022-03-11 2022-07-29T16:08:44 2022-05-15 2022-01-19T08:12:26 12.196.143.0 qui@Twitterbridge.com Dryden Park 91
+1994343058 false -43 31026 31662 -1712946627 223964349 31242.354 -7.45960341584651E8 99998455443281923.303 88486850141625387.602 2022-12-20 2022-04-02T13:51:17 2022-06-06 2022-01-22T15:02:50 115.56.41.137 JaneFowler@Eimbee.com Stoughton Place 93
+-1250962157 false 58 7055 -26702 351046507 -802851458 -4760.95 -3.9827864019842E7 99998314621099249.720 65769339050839139.461 2022-12-12 2022-10-13T15:05:51 2022-04-04 2022-08-02T06:01:31 180.220.39.66 soluta@Flashpoint.biz Graceland Place 45
+1320504381 true -105 -19148 -18398 -565676017 -936458606 2016.3842 9.437143901522E7 99998289681366107.356 85524665042635216.550 2022-06-27 2022-03-01T09:12:42 2022-04-24 2022-08-17T22:48:27 4.114.35.116 aut_hic@Flipopia.edu Crescent Oaks Center 46
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_asc.out
new file mode 100644
index 0000000000..ea329b61f0
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q10_decimalv3_asc --
+-500322702 false -2 -20724 8844 -789106469 -1245074969 -6347.4688 -1.215439687058768E9 28913011806406311.945 224953913168.281 2022-12-10 2022-11-02T22:26:53 2022-09-28 2022-05-29T04:07:47 148.14.110.116 KimberlyThomas@Tanoodle.info Fulton Plaza 22
+2049729692 true 39 23629 -32754 715001192 -1823668862 -18180.234 -1.813637574700689E9 6456346804537335.538 295451347869.709 2022-12-31 2022-12-27T20:24:33 2022-07-31 2022-05-21T08:37:29 201.60.224.145 JohnnyFlores@Wordtune.info Loftsgordon Parkway 82
+-1937581679 false 80 7436 -8846 -160429213 687387519 24064.27 -2.132744818000418E9 83505318895222282.424 545942280027.415 2022-08-19 2022-10-26T06:47:58 2022-05-18 2022-12-05T21:37:35 81.13.195.129 BarbaraPierce@Tagcat.org West Park 22
+-1060778676 false -9 3850 29335 -366369852 464530994 13906.77 -1.994977344890222E9 2175505787912007.691 656084436389.326 2022-07-22 2022-02-21T11:17:16 2022-10-23 2022-09-18T07:21:01 155.170.179.115 animi_rerum@Trilia.com American Circle 20
+-940080588 false -48 27172 -26231 -658208211 1983716950 1054.4502 9.54529071331357E8 59614133728718616.981 656428206744.592 2022-09-17 2022-07-28T20:56:57 2022-12-28 2022-06-18T17:34:02 110.249.164.90 xAlexander@Ainyx.gov Mandrake Pass 26
+-1686176773 true 79 32766 9212 1115035313 450171396 -1866.4689 7.77563839932363E8 90992477662136679.337 666861267107.644 2022-12-13 2022-03-19T09:35:44 2023-01-02 2022-05-09T22:05:07 218.227.189.124 suscipit@Trunyx.biz Sauthoff Hill 54
+-136251701 true -26 -17233 23381 71063199 1325780104 -7717.424 1.84952175633689E9 91654833374919592.894 804031754534.881 2022-02-08 2022-06-01T10:18:18 2023-01-07 2022-03-30T14:54:45 207.134.2.218 StephanieHayes@Zoomlounge.net 7th Lane 31
+225330564 true 8 -20890 7535 1492965080 -73825703 9222.409 -1.444812642568396E9 41957274954652166.262 828460225722.464 2022-05-21 2022-07-06T05:32:09 2022-11-05 2022-08-22T14:09:55 27.246.116.114 4Harvey@Quatz.biz Kipling Park 43
+1217178007 false 119 12521 -1493 -712876242 341763481 22953.76 6.03741368661214E8 38926544549455190.948 835143560344.531 2022-01-12 2022-08-13T06:07:16 2022-01-13 2022-12-21T20:40:42 140.156.80.20 DeborahRamirez@Jetwire.org Forest Pass 2
+2010082263 true 56 22180 -7637 1377250237 -1747439805 21856.328 1.477063082563715E9 42594042587766210.946 861636208375.810 2022-08-23 2022-06-14T23:50:21 2022-11-19 2022-12-14T16:11:27 39.242.210.218 EricJohnson@Buzzster.com Golf Course Court 77
+158225117 true -8 1831 -20566 -1973752124 78273074 -30708.668 8.08196311683926E8 9289472022583529.807 900270045103.661 2022-12-09 2022-04-02T05:11:10 2022-09-02 2022-11-14T13:15:25 20.150.111.99 hRomero@Oyondu.net Moose Circle 64
+-1116173065 true 4 19011 -10345 800676046 486535128 7727.1616 8.66323042068133E8 90517464330331470.348 952066991241.367 2022-11-29 2022-12-31T05:44:37 2022-07-22 2022-04-08T13:35:18 105.23.253.228 pFernandez@Oyonder.name Magdeline Crossing 10
+-637510349 false -53 -26987 -9039 1952267990 -355033895 -21641.64 -8.23738655422749E8 19814816503611626.392 1051051893998.771 2022-06-01 2022-05-06T20:00:39 2022-06-16 2022-08-09T18:35:16 22.199.142.108 JoyceCarroll@Jamia.com Anniversary Alley 79
+-574740435 true -82 5337 -23707 -366788314 1707369917 -1361.867 1.708340177834741E9 21377893310656745.228 1284601191000.995 2022-12-30 2022-06-27T16:04:45 2022-07-07 2022-12-31T20:52:26 237.32.110.81 cum@Feedfire.info Main Junction 23
+-996480981 true 60 3174 10131 1789084898 2079254538 -19499.953 -1.045203028440303E9 7972412282094692.838 1362561229786.168 2022-08-14 2022-01-24T01:46:34 2022-07-29 2022-07-13T02:14:12 75.194.81.39 KathyJohnson@Divape.com Reinke Alley 18
+-365890009 true -85 -5774 28735 1608145109 191621007 10726.853 -1.732467449211401E9 90327418585674894.350 1414473603522.946 2022-11-30 2022-03-23T22:18:15 2022-12-16 2022-05-29T15:54:36 249.38.147.73 5Vasquez@Brainbox.edu Towne Alley 65
+-1345345789 true 10 -346 1694 1415857152 -333578251 13900.476 -1.112134277678726E9 52007129676995076.853 1419028141544.445 2022-06-18 2022-11-06T09:37:38 2022-07-30 2022-08-22T03:21:23 126.211.82.252 jSanders@Roomm.net Nelson Junction 84
+1686375736 true -43 -15944 -18320 335272384 1248150534 -484.68964 -7.84732813528091E8 51785776656453601.162 1457107238489.783 2022-11-20 2022-05-22T01:30:39 2022-10-05 2022-07-21T23:46:31 113.237.137.137 aGordon@Gabtype.gov Kingsford Park 6
+246562803 false 66 -2716 -4346 1110213845 1464096993 1479.1958 -3.79576519283935E8 42813791657086925.329 1589727276392.832 2022-07-25 2022-11-10T16:23:33 2022-06-07 2022-04-03T01:58:27 82.229.218.235 doloremque_ullam@Mydo.net Mockingbird Trail 11
+-1195972760 true -33 3949 3308 1784415930 -1497191255 21905.285 1.106241012693313E9 47579901407103912.628 1647996775734.968 2022-09-20 2023-01-02T23:46:26 2022-04-02 2022-03-14T13:44:37 78.149.140.10 KimberlyGeorge@Flashset.net Forest Street 54
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_desc.out
new file mode 100644
index 0000000000..99ad66b307
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q10_decimalv3_desc --
+-423074200 false 52 8375 28995 -1010214952 1328062044 -5155.519 1.247576590267535E9 1095923614063639.584 99999747825367559.824 2023-01-02 2022-02-03T03:36:12 2022-12-01 2022-04-16T18:40:21 127.81.56.105 dRobinson@Bubblemix.com Sherman Road 0
+-1612276867 true 47 -27745 13671 -916474103 -945279221 12600.383 -1.641240639347924E9 81062820059332745.878 99999732640045963.240 2022-05-24 2022-07-16T06:34:33 2022-05-29 2022-09-23T11:43:36 176.97.43.237 tYoung@Skimia.com Charing Cross Park 77
+223965301 false -37 29751 -32025 1430545038 -1924214800 -17488.03 -1.906916102532119E9 1518199245825383.703 99999668905903753.800 2022-05-26 2022-10-05T10:32:41 2022-06-03 2022-01-14T06:11:43 41.34.214.184 tempore_ipsum@Kaymbo.net Porter Park 0
+-594116750 false 70 1562 -15950 -1344408641 114167053 -21606.701 -1.278566458297833E9 57179008381468335.649 99999640320859162.916 2022-02-27 2022-01-19T10:12:12 2022-08-13 2022-09-13T20:43:08 43.137.12.5 JuliaStevens@Skalith.com Scoville Center 33
+1827012616 false -72 22590 18587 404652057 1203355781 -17286.275 -3.36294130382289E8 52582933810361935.535 99999634230240441.246 2022-07-15 2022-03-22T23:07:59 2022-10-29 2022-10-01T18:36:11 226.204.6.102 ToddPalmer@Quimm.edu Colorado Drive 61
+354414919 true -56 -2049 25348 1534958901 -1467923070 22919.861 1.075822569370258E9 89288386125599355.178 99999425434743386.320 2022-07-09 2022-05-07T16:43:16 2022-12-09 2022-01-22T01:00:14 105.69.100.111 SharonHughes@Linkbridge.edu Macpherson Junction 44
+-1263301615 false -103 -13772 -16674 -1774129340 1914414398 4393.039 3.07730150126997E8 97847995016045403.360 99999239001172237.417 2022-04-17 2022-12-17T10:49:30 2022-01-28 2022-12-18T02:18:01 149.56.180.142 qui@Browsetype.name Dahle Place 35
+557817277 true 90 6622 -22730 744522189 -1085894753 22869.305 -2.04906230579109E9 3271938319169910.892 99999173920040702.700 2022-10-18 2022-07-06T22:41:25 2022-05-27 2022-11-05T06:58:13 107.161.10.23 amet_facere@Skidoo.net Ludington Road 93
+2125584348 true 21 6888 -21489 950224824 626221868 13896.374 -8.39726839172374E8 4350218835152252.627 99999072440532391.285 2022-01-13 2022-05-12T16:29:03 2022-04-02 2022-11-23T16:56:58 43.21.14.100 sequi_molestiae@Zazio.com Bultman Alley 21
+739569036 true -69 29414 10058 -489035542 -1993314704 -31865.492 6.64789455492839E8 3544688816701520.657 99999041991592107.612 2022-01-13 2022-06-29T07:54:47 2022-07-19 2022-10-21T03:47:04 176.43.134.251 NicholasJordan@Trilia.gov Monterey Circle 42
+1258905364 true -25 2545 830 1666278716 1934706209 20796.746 -1.225709884225744E9 95560165404082727.447 99999037068648323.555 2022-10-09 2022-11-15T02:07:45 2022-03-25 2022-06-27T18:25:29 120.254.105.82 praesentium_dignissimos@Fadeo.org Heffernan Park 78
+441865655 false 50 27647 17350 2070967367 1336110107 -6784.9307 -2.127600570389967E9 90368901623776618.789 99999002507124942.581 2022-08-20 2022-02-06T08:26:17 2022-01-31 2022-01-22T16:03:13 94.199.87.44 JohnnyOrtiz@Roomm.com Lukken Street 59
+-1562039235 true -89 -15411 -31625 -334403295 -573722982 -6336.6694 -1.183579017709985E9 5870087526645738.360 99998844514984453.994 2022-06-15 2022-07-09T01:09:52 2022-11-29 2022-07-03T00:28:45 22.104.128.110 dolorum@Meeveo.name Ramsey Terrace 82
+1709246350 false -125 24463 -18640 -1679145705 2122053485 32360.127 -9.24309285036904E8 14377693673005046.550 99998811574612033.430 2022-05-21 2022-12-27T05:06:39 2022-12-14 2022-02-21T16:38:33 116.53.6.137 sapiente@Eimbee.name 4th Hill 73
+-1577355854 true 113 15993 31947 -1535092205 1237162395 26000.998 -1.541666114735052E9 83656441106578636.443 99998803472203687.302 2022-04-12 2022-11-29T15:00:13 2022-12-03 2022-06-25T18:59:37 235.182.155.40 in_fugiat_perferendis@Photobean.info Buell Plaza 78
+1631197438 true -76 17823 16276 -1185372022 502635722 8045.3154 -1.383947363140137E9 63988461392414815.618 99998723123158129.612 2022-06-25 2022-07-07T06:18:27 2022-07-10 2022-02-23T08:05:32 44.194.194.46 RebeccaBrown@Jaloo.name Gale Avenue 92
+1729586043 false 35 -27529 12453 -1922905302 135644899 -25303.123 -1.123671605866239E9 94034450353515393.270 99998568819864508.395 2022-06-16 2022-10-11T15:24:07 2022-07-21 2022-05-04T11:24:41 50.254.6.198 dMills@Skimia.gov Reindahl Plaza 44
+669865705 true -112 12875 -25206 683483771 -1438386774 4347.295 1.506470693807616E9 88643665771885132.584 99998312563274227.717 2022-01-22 2022-03-06T12:09:32 2022-07-15 2022-07-16T11:02:22 101.108.186.87 NormaKnight@LiveZ.biz Gale Center 35
+1943992017 true -31 25999 19375 -23445822 234441053 -19584.082 -5.70783230876946E8 72814161415290058.825 99998108790492690.570 2022-11-14 2022-12-08T18:38:37 2022-06-22 2022-06-17T22:08:14 6.10.22.70 7Parker@Quimm.biz Waxwing Hill 93
+2061597377 false 100 -31303 -22809 -1712737615 1377576722 22449.87 -1.437888446033773E9 35445448729929966.300 99998036695606472.762 2022-09-16 2022-10-02T19:13:57 2022-12-19 2022-07-06T10:08:54 4.93.160.191 EugeneWright@Fivespan.name Rieder Terrace 88
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_asc.out
new file mode 100644
index 0000000000..5886fc1ac9
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q11_date_asc --
+45150029 true 16 -19507 8330 -2136089243 -573416157 24291.943 -2.044079012439694E9 98823911702020758.323 36803235001158739.790 2022-01-10 2022-02-06T21:24:14 2022-08-30 2022-04-25T18:08:03 145.213.37.250 soluta_velit_sint@Centidel.org Atwood Drive 52
+-1595962753 true 114 -23385 13529 -2124085593 1355190506 -25249.451 -2.063695504681695E9 16213871536504510.983 63319058192011694.255 2022-01-10 2022-06-16T07:18:01 2022-11-25 2022-12-02T01:59:13 139.135.53.164 JoshuaPatterson@Riffpath.org Eagle Crest Point 20
+633894889 true -102 16807 1582 -2118550490 -961515504 27808.71 -5.49781788171066E8 58215663511753687.121 58914727532485247.351 2022-01-10 2022-07-04T07:40:02 2022-08-15 2022-08-20T19:47:43 95.142.162.117 qWatson@Innotype.com 6th Alley 76
+-442939551 true 66 -10258 -18247 -2115824485 -129687083 -2207.829 -1.789678928809944E9 67455083593991945.328 24087808672011992.668 2022-01-10 2022-10-02T03:03:19 2022-09-04 2022-11-05T22:07:52 122.51.165.56 RobinDunn@Kimia.mil Blackbird Crossing 53
+-1443625882 true -77 -1046 3582 -2095967062 -258412188 -9147.349 1.099851670900486E9 98832230981550821.348 96507502027785313.709 2022-01-10 2022-06-01T15:40:35 2022-12-30 2022-12-14T20:24:16 65.95.22.198 2Armstrong@Yambee.gov John Wall Hill 33
+1618071703 true -122 -29846 2096 -2092967033 -1502322884 10074.492 1.58406588921841E9 60354648484131640.262 84464451114820192.447 2022-01-10 2022-11-18T19:13:06 2022-12-11 2022-08-18T18:43:10 1.100.233.200 JonathanWheeler@Bubblemix.net Esker Alley 3
+1003728423 false -11 -29639 24830 -2087897275 -864417043 -27362.47 -4.42142425714961E8 23301017897934618.914 13014564554055456.834 2022-01-10 2022-07-06T21:01:52 2022-11-28 2022-09-06T07:08:29 70.150.117.116 mRogers@Wikivu.org Lunder Trail 42
+-1713053398 true 125 24891 20485 -2085227401 1387822597 -29551.752 -7.51503927591174E8 83490924321421189.731 67883758725303394.951 2022-01-10 2022-05-05T19:26:08 2022-12-28 2022-04-26T22:37:17 231.37.55.38 8Carter@Feedmix.mil Logan Place 53
+-552717113 true -100 -6485 1840 -2080027061 -683694166 24901.457 -8.76185833240946E8 48852235830078324.720 71674617947241266.630 2022-01-10 2022-12-14T07:00:37 2022-07-02 2022-03-05T16:13:25 196.168.27.195 FrankGilbert@Pixope.info Prentice Pass 87
+1711670524 false -69 -8072 -32585 -2077449691 -605877345 -22103.316 -1.433425324070884E9 29997670481504283.395 16569341791761686.932 2022-01-10 2022-03-01T01:15:43 2022-06-24 2022-12-14T12:13:24 170.175.139.138 esse@Linklinks.info Warner Crossing 60
+-943908353 true 70 1571 -3627 -2077437148 -1608684637 25449.088 3.52372438023482E8 9810271127104778.377 16828496110699534.790 2022-01-10 2022-01-29T12:47:14 2022-06-05 2022-01-23T13:20:42 114.93.129.117 totam_aliquam@Trunyx.name Mandrake Way 30
+1772842507 false 50 14702 -1550 -2073518326 -1033108812 12473.847 -6.3161006583213E8 14436847231070161.109 26610224448960906.375 2022-01-10 2022-05-18T02:31:56 2022-10-25 2022-05-03T00:57:06 242.93.200.208 lCarter@Devpoint.com Maple Wood Hill 50
+-719895240 true 18 -2180 15082 -2070345822 -1265186829 13151.707 1.2197607452317E8 56063508279381863.367 46152588533434926.209 2022-01-10 2022-11-15T00:41:44 2022-06-16 2022-02-22T01:40:53 132.56.247.63 assumenda_molestiae_culpa@Quamba.mil Kennedy Circle 29
+721705176 true 48 -16478 -29574 -2064567991 1895980983 -29204.008 -1.522171408921843E9 53672504337973221.511 21745766435033628.720 2022-01-10 2022-11-13T17:18:30 2022-06-26 2022-03-04T04:24:27 86.219.99.215 KarenDuncan@Quaxo.name Jay Terrace 2
+1007639847 false 41 13891 -26496 -2064253439 -243810128 -8276.231 3.95595458403956E8 53860411271916852.861 4818893478016717.292 2022-01-10 2022-03-15T21:53:31 2022-03-15 2022-07-24T21:30:48 211.130.236.133 necessitatibus@Teklist.com Talisman Drive 6
+517725215 true -14 29076 -3863 -2059830502 24191520 -4271.069 -2.136208546119772E9 49579391641389305.412 94748615728602621.360 2022-01-10 2022-09-29T13:33:55 2022-12-12 2022-06-02T17:00:37 151.174.44.99 sHowell@Meembee.mil Roth Point 25
+-1493801306 true 48 -9530 -13569 -2051444231 1890413268 11796.022 1.731528150371074E9 24782330162456582.141 96764243000217184.938 2022-01-10 2022-11-12T02:07:20 2022-09-08 2022-06-08T04:14:35 233.214.208.252 consequatur_tempora@Jatri.gov Wayridge Park 12
+2118489341 true -34 -4666 -31031 -2050195325 -1773849298 6089.9756 2.119721038034936E9 82394233604701364.314 56954426225924199.910 2022-01-10 2022-09-17T07:21:37 2022-09-28 2022-01-22T16:22:33 213.207.238.130 CharlesFernandez@Katz.name Larry Parkway 22
+2028572076 true 75 4023 -11950 -2037093680 48896844 6940.73 3.35736744420993E8 25279482426826273.959 34198987134748818.265 2022-01-10 2022-07-18T20:01:56 2022-07-05 2022-03-27T03:47:31 7.223.96.201 RobinLee@Twitternation.name Fallview Park 71
+-1836324034 false 95 -20718 -7608 -2035438927 -1852418234 26781.89 4.1762320229463E7 40181738950406136.320 92967735922682585.853 2022-01-10 2022-07-03T05:27:10 2022-06-01 2022-01-25T05:40:54 124.195.54.27 BrianRuiz@Yotz.info Sullivan Alley 67
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_desc.out
new file mode 100644
index 0000000000..b52c825891
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q11_date_desc --
+56373159 false -57 25710 27708 2147171064 -1083150336 443.9486 -2.86423836710735E8 85659629515126497.597 62858433964902277.438 2023-01-10 2022-06-09T08:55:06 2022-05-13 2022-01-31T11:22:31 142.127.205.24 FrankRichards@Rhynyx.org Maryland Pass 95
+-436735662 true 106 6496 13483 2143837975 1146883043 -1042.6069 -2.9330997096231E8 11851817078532709.757 15528482914420443.722 2023-01-10 2022-03-22T23:50:14 2023-01-06 2022-08-27T09:33:31 78.38.251.75 KathyBaker@Twitternation.mil Maple Wood Drive 50
+1871599613 false 68 21907 -24340 2141031258 1016634638 -22198.287 8.79444680816074E8 37633204902327223.218 90746287993996784.734 2023-01-10 2022-02-26T10:56:38 2022-12-04 2022-01-30T16:44:23 183.154.16.27 omnis_atque@Meeveo.edu Shasta Park 17
+1283190321 true 55 28478 -17048 2140833548 867393855 -25025.035 -9.95075167042897E8 44206615458639731.626 67442640969144301.905 2023-01-10 2022-12-24T11:46:41 2022-04-17 2022-04-05T21:48:27 106.217.219.71 enim@Lajo.mil Weeping Birch Road 81
+-694962827 true -22 8503 10624 2139995069 -762172645 -7851.69 1.685778554095771E9 18603007844498247.868 10404865114081238.644 2023-01-10 2022-09-14T23:22:02 2022-02-27 2022-05-17T14:48:09 181.226.43.236 yWagner@Quaxo.org Roth Trail 13
+864392608 true 94 -24023 31438 2137120100 791788416 11250.101 -1.441002296547653E9 65644625864269869.686 53722728973748238.915 2023-01-10 2022-11-10T15:42:24 2022-11-02 2022-11-25T08:47:45 76.246.100.125 RoseBoyd@Twitterbridge.name Oakridge Avenue 9
+1713097044 true -74 -8433 -8954 2137003315 1057327836 14379.353 1.40471556116768E9 18172191219156250.483 2036546008974432.125 2023-01-10 2022-07-12T22:20:27 2022-05-28 2022-07-07T00:59:18 212.144.76.161 JudithKing@Youtags.com Namekagon Terrace 73
+2098716950 false 123 14065 25356 2134428023 1359592390 9587.823 -1.15126135682833E8 78673083734657014.345 20161304298218160.210 2023-01-10 2022-07-01T20:49:36 2022-02-08 2022-04-26T06:08:12 149.89.243.7 nemo@Quatz.edu Old Shore Hill 83
+1085133672 true 111 28680 2039 2132496397 -1862191065 29829.01 -7488369.629529 96275743577510749.589 81344161904122194.599 2023-01-10 2022-03-10T20:14:05 2022-05-09 2022-12-29T01:08:21 105.76.158.197 nemo@Blognation.biz Messerschmidt Point 17
+147507255 false 58 14120 7978 2129501608 -477632016 -19722.633 1.467067408318817E9 8090648029524509.447 11588200352101124.733 2023-01-10 2022-01-23T01:33:41 2022-05-11 2022-11-26T16:56:51 45.99.69.225 vitae_perferendis@Zoombeat.edu Victoria Place 87
+-1405895266 true -76 -13413 26861 2128997181 370950669 -7662.348 9.12047677759944E8 55066796449309174.770 93885083872972672.219 2023-01-10 2022-09-03T22:52:37 2022-06-09 2022-03-23T08:43:46 27.108.222.24 PaulaJacobs@Mita.mil Calypso Street 14
+-321616924 true -99 25529 -30120 2128535300 -1224121458 -7418.188 -1.018512456276405E9 51228092948506456.752 59246800045440032.570 2023-01-10 2022-09-01T11:19:45 2023-01-01 2022-04-28T23:53:25 71.136.249.113 6Bell@Feednation.info Badeau Road 79
+2084425087 false -127 27056 -23918 2121445015 759270155 -11075.16 1.367452304525654E9 1390141744548898.180 79540867691227756.246 2023-01-10 2022-10-06T15:29:25 2022-08-01 2022-03-18T06:53:23 151.87.74.252 vChavez@Fivespan.edu Beilfuss Lane 37
+-1147273605 false 89 27846 -18231 2121438078 92285843 26871.3 1.255516596279802E9 8458006545663366.358 94782206362654537.496 2023-01-10 2022-01-20T16:38:52 2022-06-03 2022-02-12T22:20:36 114.128.6.31 CharlesStanley@Brainverse.edu Barby Pass 4
+-370231160 true -62 32018 8431 2120869348 -1437099419 10780.735 1.82531394142749E9 92672086784133326.690 75016020435886720.191 2023-01-10 2022-02-12T17:14:11 2022-10-28 2022-05-06T10:24:54 211.242.199.137 LindaFowler@Gabtype.gov Northridge Court 93
+-2125295677 false -47 -13694 32637 2120473752 226880678 27021.426 -440841.716447 50890508670557705.960 45663165388620626.133 2023-01-10 2022-12-12T05:16:18 2022-05-22 2022-01-16T16:20:16 11.252.109.68 6Fowler@Devpulse.name Menomonie Pass 55
+1716846616 false -14 -13399 5620 2118735163 805215789 -25128.734 1.247336639130183E9 94167533490062711.295 16315734799016695.602 2023-01-10 2022-07-06T08:29:14 2022-10-30 2022-10-10T18:19:20 204.19.86.157 8Sanders@Bluejam.info Kipling Crossing 12
+-2061570509 false -31 8525 -1795 2114915255 -1713145605 6742.736 -2.006715395135593E9 36708610439067521.928 47602509254638265.972 2023-01-10 2022-02-16T17:36:14 2022-07-24 2022-01-15T16:23:04 245.156.208.104 KeithBradley@Wikizz.net Anniversary Plaza 53
+1892433928 true 56 -26934 -1186 2113139730 621184115 -25364.152 1.934541410109143E9 9320633621180118.342 97202104508737561.152 2023-01-10 2022-05-03T21:15:45 2022-10-30 2022-06-11T03:00:02 90.67.255.60 5Morrison@Bluezoom.org La Follette Crossing 53
+-518083331 false -83 -19795 23289 2106444088 640756214 -10731.697 -1.625470197269475E9 60792557643844173.824 2780964013381426.234 2023-01-10 2022-12-13T20:24:21 2022-11-30 2022-05-16T08:48:33 30.76.33.224 consequatur@Yozio.com Duke Drive 96
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_asc.out
new file mode 100644
index 0000000000..007c238a06
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q12_datetime_asc --
+398572531 false 104 -15824 30286 136659331 -1288345942 13452.328 2.013437229996864E9 52515748270989673.914 64395973718059954.328 2022-04-14 2022-01-10T15:58:22 2022-11-28 2022-03-16T06:51:57 79.233.179.146 RoseShaw@Reallinks.com Hansons Parkway 27
+-227386124 true 73 -11287 -27016 768464342 2125223920 13369.397 -9.87914542455395E8 95927737281775565.136 57190870707475100.282 2022-03-16 2022-01-10T15:58:31 2022-11-02 2022-05-02T07:25:25 7.64.65.181 gHunter@LiveZ.net Oriole Circle 73
+-19581833 true 79 21739 17305 -1648142465 1169224340 -4452.572 1.20081587170498E8 93022819774045829.230 54677204030088082.409 2022-09-17 2022-01-10T15:59:05 2022-01-27 2023-01-06T11:05:48 40.60.137.158 lWeaver@Voonyx.mil Nelson Point 82
+969114743 false 12 31251 2064 1983361558 284792847 22777.398 -1.473178599380819E9 8708970919680269.840 37796454160530349.938 2022-02-21 2022-01-10T15:59:16 2022-07-08 2022-11-20T07:12:24 120.102.132.244 sPowell@Thoughtbridge.org Rockefeller Pass 74
+-723224842 true -101 691 -23590 1885844901 -1762405078 -21995.639 1.069765955025462E9 92762103346734638.819 73071962951227211.188 2022-05-21 2022-01-10T15:59:35 2022-07-24 2022-10-21T09:03:20 100.191.97.165 animi_nulla@Feedspan.edu Karstens Place 82
+-1843464679 false -128 -13755 -18262 140768659 262426471 21633.924 -5.31195483228335E8 56653641156549476.421 64741222367067744.400 2022-02-10 2022-01-10T16:00:15 2022-07-27 2022-09-14T18:30:57 116.146.1.140 KellyRobinson@Rhynoodle.name Ilene Court 30
+-1276676362 false 77 4836 21887 521057052 -1722331533 -22314.172 4.20100818339494E8 48480346882877531.917 59465139356192449.348 2022-05-20 2022-01-10T16:00:30 2022-07-16 2022-02-06T14:37:49 190.218.3.220 BettyAndrews@Dabjam.com Eagan Street 27
+-1040769327 false 124 7383 -11847 -326016194 -1343544935 23186.81 1.094967105220328E9 40999081648159066.827 40596598384439441.204 2022-08-04 2022-01-10T16:00:37 2022-11-28 2022-03-19T16:24:06 55.128.173.30 molestias_accusamus_ut@Centimia.net Sachtjen Plaza 24
+1580879896 true 3 -2180 -4863 1724747921 1489565814 4529.6475 -5.44494140753884E8 18739735537324630.529 73809169266134389.891 2022-08-25 2022-01-10T16:00:48 2022-02-07 2022-01-20T08:42:12 162.67.16.171 RogerPatterson@Kwimbee.info Mayer Park 37
+-188780917 true 79 -2357 -3287 923399288 -1690061360 1629.2401 4.98151886869095E8 48345363723307074.113 27419844037110652.150 2022-09-17 2022-01-10T16:01:04 2022-03-05 2022-06-14T21:01:15 37.53.114.66 jMoore@Tekfly.biz Coleman Drive 61
+425425555 false 66 13736 20225 498557725 1691617002 -28770.77 1.859059050176822E9 16973456685874873.530 32440480483939584.697 2022-05-24 2022-01-10T16:01:45 2022-02-02 2022-12-28T11:56:23 246.158.216.208 JudithRiley@Livetube.info Coleman Plaza 56
+1844939833 true -87 -24980 8626 1362277550 761263433 -10682.875 1.204869422496459E9 6388839377342282.941 75147328732864306.841 2022-03-06 2022-01-10T16:01:45 2023-01-02 2022-02-26T09:54:55 91.24.148.99 BonnieWatkins@Youspan.mil Shelley Point 16
+-1330671834 true -126 11051 3393 -1943845626 -943421338 22719.35 9.8130093209596E8 43126263209608491.809 24482199120032665.120 2022-04-24 2022-01-10T16:02:14 2022-04-29 2022-05-11T10:49:28 23.103.245.11 iste_et@Chatterbridge.com Waxwing Pass 26
+-998445187 true 72 -12304 22172 -1775850306 -525005035 2814.9053 1.180996237515648E9 87964064739140948.597 95934991241926225.524 2022-07-28 2022-01-10T16:02:27 2022-06-12 2022-07-12T02:39:53 42.18.241.169 quae_sed@Photofeed.info Buhler Place 9
+933483518 false -41 -31180 10183 1298448426 -745289014 11504.318 1.855337786519898E9 52962315651502772.909 54092119712757010.886 2022-04-19 2022-01-10T16:02:54 2022-12-14 2022-11-21T00:05 244.178.31.4 xRoss@Zoozzy.edu Longview Avenue 82
+736646172 true -65 -29943 -759 1215718088 -919029408 -17602.988 1.800776109984884E9 26525877105410978.684 43412176476359919.244 2022-04-21 2022-01-10T16:03:31 2022-02-19 2022-08-29T03:32:23 243.219.200.88 sunt_numquam@Skibox.name Hermina Court 83
+1352071745 true -40 -349 -14583 1451235628 279870234 8201.707 6.49885206121071E8 89665151476675946.921 62176723050646167.536 2022-06-15 2022-01-10T16:03:50 2022-10-25 2022-03-23T15:16:01 135.163.50.172 TinaHart@Quaxo.mil Sunfield Hill 80
+-1319756613 false -18 -29068 -2539 120232690 995049806 2349.1514 9.50574861725708E8 67069277976863468.247 27699597717777080.850 2022-08-24 2022-01-10T16:04:04 2022-04-28 2022-11-14T07:02:32 101.14.179.42 mAndrews@Oyoloo.mil Blaine Plaza 65
+1684592111 false 75 -9696 3760 -581460052 -2120607157 27925.836 1.892426389237949E9 1902718679437748.273 72734562394852711.410 2022-01-25 2022-01-10T16:04:38 2022-04-14 2022-06-03T22:36:14 42.184.181.140 ClarenceGarza@Oyoloo.edu Longview Pass 21
+760024953 false 98 22243 -6642 -1054071857 1544746333 25906.867 2.08388856967211E8 70193108754677521.215 79920838378941619.402 2022-09-14 2022-01-10T16:06:10 2022-05-15 2022-12-15T06:22:43 11.175.29.16 tRogers@Browsedrive.name Rowland Pass 2
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_desc.out
new file mode 100644
index 0000000000..0dfd94c8bc
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q12_datetime_desc --
+1390131471 true -25 -4830 -259 -1066005916 -1468142949 -15088.466 4.18529268033892E8 28789840661393982.630 2711322022578576.820 2022-04-14 2023-01-10T15:58:19 2022-11-11 2022-11-08T07:08:28 206.107.251.193 TammyMorrison@Edgeify.org Kingsford Junction 58
+992075057 true 69 20579 14896 668254923 145374625 -8449.486 1.018012378015139E9 52901779657013709.995 3782863113844868.873 2022-12-10 2023-01-10T15:58:05 2022-07-15 2022-03-15T03:06:31 153.174.252.249 AntonioBowman@Innojam.name Independence Point 44
+-872762008 false 96 -6782 25352 2019994917 1873939398 24246.695 -1.754617292596912E9 61612550972100153.182 71657433427323725.194 2022-02-06 2023-01-10T15:57:41 2022-11-24 2022-10-14T13:35:15 60.0.162.255 KathyHanson@Vitz.info Schiller Way 80
+1948967242 false 14 9189 28370 1434871175 1044101396 -4874.707 -3.7166526867238E7 52080969602253262.651 21362173204391739.292 2022-08-22 2023-01-10T15:57:04 2022-04-13 2022-05-29T01:48:58 188.199.23.151 ut_consequatur@Rhyzio.name Hooker Circle 22
+-1696440336 true 81 21973 -6749 1366406656 -2102012999 -30858.27 -9.351878342054E7 93886043582449574.701 68465353279837169.200 2022-09-17 2023-01-10T15:55:43 2022-01-25 2022-09-01T10:07:13 146.121.84.65 qui@Trilith.mil Cambridge Point 14
+-1974487578 false 127 -22998 -8483 1703822649 -1616142131 -19153.855 -5.82004175644415E8 74372372862774013.562 51545907153704816.772 2022-07-15 2023-01-10T15:55:32 2022-03-03 2022-04-19T19:55:51 243.188.73.192 oCooper@Talane.edu Del Mar Avenue 5
+-875740823 false 1 -19409 -18103 -1675630776 -1372334528 -16445.648 2.018283835300718E9 88912041120172355.230 82003003039149538.999 2022-03-23 2023-01-10T15:55:19 2022-08-21 2022-03-10T05:47:01 251.168.233.153 RyanRice@Blogtag.name Twin Pines Street 33
+326782068 false 109 -12972 -2179 2040107942 -1491242267 16577.234 1.47922140614803E9 26567233446731867.734 84217493695601697.997 2022-06-09 2023-01-10T15:55:09 2022-01-18 2022-03-21T13:59:43 182.67.131.46 tempora_et@Tambee.edu Anzinger Parkway 25
+-801349558 true -42 -22407 -22094 -1459594378 228960686 -9769.24 2.077062938838231E9 73030258438373197.120 52262794985491101.647 2022-01-23 2023-01-10T15:53:24 2022-05-29 2022-10-24T15:39:22 148.98.178.220 RuthWells@Flashpoint.info Warrior Pass 48
+546752983 false 77 -5329 21752 2035473225 1675425771 18688.0 -8.5648146144319E7 31526757185434628.845 66698749489987074.299 2022-09-11 2023-01-10T15:53:05 2022-03-11 2022-01-25T09:01:27 176.150.160.60 MarthaWallace@Dynabox.info Scofield Drive 5
+848288684 false 78 18504 -31816 -39577789 1181353725 8534.284 5.58103010379219E8 21874588065205497.669 56077931809553335.543 2022-11-25 2023-01-10T15:52:22 2022-07-18 2022-09-18T07:22:57 31.216.16.216 PaulKim@Meevee.gov Stoughton Street 58
+-1263350856 true 4 19833 9929 113755357 -2077553236 23880.182 1.110814616578153E9 78470595268731167.411 64870506613049853.237 2022-08-18 2023-01-10T15:52:14 2022-11-17 2022-12-10T00:07:24 175.195.211.143 MargaretFields@Dynava.edu Oak Valley Pass 70
+-365106038 true -68 7890 4125 -1637714937 981797519 2002.7689 1.587789066765131E9 52717473500355786.612 81780395964777394.730 2022-10-05 2023-01-10T15:52:03 2022-05-24 2022-02-21T22:57:51 82.173.6.5 LouisNelson@Eare.info Pleasure Place 39
+-1047266363 true -67 450 -24660 -1815567027 1026693250 -13756.589 6.71783949837051E8 39013162201507383.364 90437876600192763.460 2022-08-20 2023-01-10T15:51:56 2022-08-17 2022-09-19T01:45:36 45.45.139.39 DorothyReid@Realblab.edu Shelley Court 61
+1380823489 true 125 -23288 -31304 -1620708820 183634480 8690.287 1.089143087804835E9 88816216187143767.419 79977863841506873.394 2022-03-05 2023-01-10T15:51:13 2022-02-27 2022-12-16T01:48:46 113.65.179.131 RobinAustin@Photofeed.org Dorton Avenue 24
+-1126250302 false 99 21673 -26343 1861328091 -1739516645 8052.1733 -1.891426776824317E9 89945213768006513.891 30077669685454416.324 2022-05-31 2023-01-10T15:50:27 2022-01-12 2022-07-08T01:02:22 15.113.29.94 bJones@Oyope.com Jenifer Street 55
+1636974320 false -91 -27233 -18313 1144803378 1663615911 -25966.441 7.22324706023479E8 18684410454219087.191 80982813638697367.150 2022-02-24 2023-01-10T15:50:11 2022-08-26 2022-03-16T14:57:47 196.194.98.204 tGreen@Twitterlist.net Dixon Junction 53
+-1893286663 false -120 24273 7900 -1347487763 164864749 -17766.543 -3.03169332525345E8 32350663418360499.179 57812014428142349.468 2022-01-24 2023-01-10T15:50:11 2022-01-26 2022-10-13T12:02:35 2.176.226.184 bHenderson@Zoozzy.net Transport Pass 76
+-1838929716 true -7 13590 27006 1078801732 -538765858 2454.2322 -1.033081914363393E9 50694939932448239.625 7733188757011073.353 2022-04-01 2023-01-10T15:49:48 2022-10-21 2022-02-13T03:55:11 236.201.98.40 quasi_corporis_quos@Gigashots.net Norway Maple Circle 26
+528114905 true -111 9742 -32472 -117977774 1092699613 -5584.0483 -2.109555631793559E9 74430333927005549.370 15359161559210533.516 2022-07-18 2023-01-10T15:49:35 2022-05-02 2022-11-22T03:28:58 129.113.4.194 FrankVasquez@Omba.com Dakota Pass 77
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_asc.out
new file mode 100644
index 0000000000..fe77c2e5bb
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q13_datev2_asc --
+2133598214 false 64 -17725 -30892 -2146975814 -785473015 5554.3315 -7.07670608707416E8 39550144162788220.422 41357500306060590.461 2022-12-06 2022-08-10T22:15:25 2022-01-10 2022-07-12T11:41:01 189.114.136.127 rerum@Gabtype.edu Shoshone Court 22
+367110793 false -17 20839 -680 -2142080488 333629779 2168.549 2.97777270977873E8 39473089553015086.260 47635055176314981.257 2022-03-31 2022-08-03T13:46:23 2022-01-10 2022-04-01T19:59:42 35.44.130.64 BrendaGonzales@Yodo.biz Loeprich Pass 80
+47643737 false 73 -17759 20687 -2140044769 -2049461130 26184.016 -3.90752727197558E8 31606054951248587.468 7783475951196088.445 2022-08-10 2022-09-26T11:54:10 2022-01-10 2022-06-04T21:42:24 159.173.238.32 yRay@Dynazzy.gov Ludington Parkway 0
+-1968879736 false 84 26203 -11182 -2138529278 -317752860 -5591.201 -1.404030078790996E9 20957356361655916.898 60338362814142329.874 2022-09-30 2022-09-14T09:27:58 2022-01-10 2022-07-10T05:40 109.87.105.1 odit_sint@Eadel.biz Ilene Plaza 68
+-1156762100 true -2 -4906 16201 -2135250531 -1473092149 13383.368 1.197528990381749E9 17062190276150723.367 9734301943706675.434 2022-07-15 2022-03-28T02:55:12 2022-01-10 2022-01-16T07:18:33 168.238.16.209 BonnieFranklin@Kanoodle.biz Graedel Drive 74
+2069697095 false 33 17176 11096 -2117185324 53279997 29987.072 -2.58796461657595E8 75922041112654579.450 59743261011801800.413 2022-02-21 2022-08-22T11:52:22 2022-01-10 2022-08-31T02:36:07 66.171.17.35 voluptatem_quas_rerum@Kwideo.gov Debra Trail 15
+-1428855302 true 32 6235 10922 -2111769499 1175989093 -2964.8184 4.36215514885263E8 59308934930266657.983 45558916266306430.790 2022-02-04 2022-07-31T21:42:10 2022-01-10 2022-10-12T16:35:38 141.88.150.220 accusamus@Riffpedia.edu Debra Circle 31
+1065345384 true -23 3249 25341 -2103366732 941263660 24186.512 -2.19436971727631E8 59068318153705580.563 37340056829809766.385 2022-04-18 2023-01-02T14:14:22 2022-01-10 2022-09-09T17:09:01 4.98.166.245 dolore_placeat_facilis@Kamba.info Anhalt Center 29
+1833910575 true -108 -24289 -31921 -2102850466 -2097160101 22546.42 -1.897250159100898E9 35667126626131126.265 23727314888942662.978 2022-08-04 2022-06-10T05:38:26 2022-01-10 2022-02-28T12:32:04 214.251.78.45 MatthewHernandez@Gabvine.net Manley Road 46
+-690021780 false -108 -13241 14965 -2087994185 -1616908029 -14109.911 -1.779065986959512E9 65136696039133182.221 89415047244778430.524 2022-03-16 2022-05-21T23:55:35 2022-01-10 2022-06-02T00:31:51 233.112.66.155 qui_et@Blogtags.net Northfield Crossing 26
+345747412 true -108 -21250 -20787 -2086738248 -604922324 15193.834 -1.582563961727976E9 38754951253821634.880 75063615109283038.383 2023-01-01 2022-01-21T06:04:38 2022-01-10 2022-11-18T07:06:44 151.171.203.34 bLong@Photobug.name Fair Oaks Place 0
+-372626123 false 100 30892 11474 -2084730743 -1003384827 -16795.324 -2.66482900229458E8 38274861901008636.699 55868258475185633.998 2022-09-02 2022-09-26T09:26:39 2022-01-10 2022-05-03T01:54:18 87.215.82.226 RoyGreen@Twinte.mil Mallory Point 53
+1933728278 true 22 -9868 -2879 -2082829453 765306321 13285.469 -6.48002527053794E8 32026976534152264.605 67978527071141443.272 2022-02-12 2022-06-18T11:55:43 2022-01-10 2022-05-10T06:20:37 153.116.25.151 fMiller@Wordpedia.biz Sachtjen Crossing 75
+-899335933 false -89 21440 6030 -2081347927 1628630844 13481.725 1.718778818150949E9 53774595472737928.667 53313499951075075.438 2022-09-29 2022-11-08T22:25:18 2022-01-10 2022-05-20T10:32:49 29.245.30.231 jCunningham@Photojam.info Moulton Hill 98
+1875127214 false 112 -29763 15730 -2076648723 -1235400235 -21089.047 -8.46344570919055E8 63347069568442763.160 6277927567128061.983 2022-06-11 2022-03-20T18:01:32 2022-01-10 2022-05-01T01:32:24 36.238.7.14 oRuiz@Jetpulse.com 6th Junction 51
+-1742273414 true 0 -18264 -23436 -2070474524 410485674 26833.127 -1.006575273291974E9 73586344131503717.119 62397553545384420.801 2022-10-31 2022-06-02T14:12:06 2022-01-10 2022-06-10T05:24:56 204.0.155.201 HaroldWatkins@Midel.info Fallview Plaza 25
+18407394 true 88 14442 -11164 -2063031871 -606747075 23782.432 -3.24091037086612E8 73301955948794481.479 76391457194248119.941 2022-12-27 2022-08-19T17:38:23 2022-01-10 2022-10-19T08:28:58 163.138.253.190 expedita_est@Lajo.org Katie Circle 65
+926151420 true 110 -793 -9570 -2062115605 -1779247391 -21120.338 1.691382449493783E9 70887384831826844.935 15624283051576902.259 2022-01-15 2022-01-18T11:33:21 2022-01-10 2022-02-20T22:02:18 2.233.188.36 rFord@Bubblemix.name School Road 87
+1796909805 true 33 32398 15066 -2059031173 -1151066447 30360.873 -1.943948412332053E9 1060645175254625.275 91679904453987552.609 2022-07-21 2022-03-31T08:11:10 2022-01-10 2022-10-11T06:43:36 53.88.162.88 quo_at@Fivechat.com Johnson Park 81
+-2056188906 true -100 -6983 -21686 -2056692155 572017053 24283.582 -7.4428889320198E7 17363153585947227.962 75905320909210630.976 2022-02-07 2022-10-16T00:13:27 2022-01-10 2022-05-13T02:41:37 236.40.210.234 1Alvarez@Eadel.gov Sunfield Alley 55
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_desc.out
new file mode 100644
index 0000000000..51adbd5dee
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q13_datev2_desc --
+2135908468 true -120 16077 4556 2143384637 -405206580 5421.973 2.86547678151814E8 4602250727469436.685 92202795681145703.263 2022-09-25 2022-04-28T10:55:02 2023-01-10 2022-10-04T17:30:46 122.119.146.42 JuliaBaker@Bubblemix.name Dakota Pass 89
+-1512249101 true 48 30597 32694 2142286124 -1821570699 -5880.8228 -7.42137004235877E8 84071566806744952.316 7359872474738353.652 2022-10-19 2023-01-01T23:13:06 2023-01-10 2022-10-28T13:49:28 189.149.118.170 yWright@Edgepulse.com Carberry Court 48
+-1770100894 true 8 -7817 -20159 2141665842 -971735894 -20806.344 1.96902070987103E9 12752024591701115.548 45088640814925845.600 2022-03-26 2022-12-09T03:56:29 2023-01-10 2023-01-03T00:04:15 169.220.157.133 dOwens@Quire.com Bunker Hill Pass 19
+-2006221932 false 75 19546 -7851 2137993045 2055362901 19778.533 -7.02527423306826E8 1963404328664105.324 80947953368783118.235 2022-10-30 2022-09-29T17:29:10 2023-01-10 2022-06-14T10:36:55 108.20.56.201 suscipit_laboriosam_tempora@Thoughtstorm.gov Heath Court 14
+1133750611 false 19 -21407 -21269 2137140915 -488834060 354.32346 1.659679012918404E9 17802003643825419.550 68568089336716561.481 2022-06-08 2022-11-30T10:35:47 2023-01-10 2022-04-28T02:56:24 36.192.27.252 inventore@Feedmix.com Towne Drive 54
+627764544 true 87 7511 1623 2134670263 1805984845 -22132.87 8.85485624873741E8 24506148630615884.248 60901110455289230.329 2022-09-23 2022-06-25T08:34:02 2023-01-10 2022-05-25T19:29:35 88.231.54.12 kReyes@Bubbletube.edu Pine View Trail 46
+-525282145 false -67 2573 16693 2134104264 1005656644 22698.537 1.159611102532654E9 45158419238749204.911 34789385857509481.512 2022-11-23 2022-12-29T21:07:46 2023-01-10 2022-04-21T18:35:22 244.40.39.75 tBlack@Voonix.info Killdeer Lane 93
+394159067 false 92 3163 -27594 2133391808 -418861716 -6281.406 -7.11646101939523E8 77537132793987835.920 75791318869626496.620 2022-04-08 2022-06-12T03:53:25 2023-01-10 2022-07-28T12:01:51 62.120.54.15 MartinWhite@Twinte.com Nova Court 7
+-1810149414 true -73 20106 24978 2127263930 -1548870190 18499.852 1.020422023788034E9 87364955034963175.426 28357699424870651.798 2022-06-01 2022-04-01T23:10:01 2023-01-10 2022-08-25T08:21:04 218.96.227.9 sMendoza@Rhyzio.net Vidon Lane 70
+2112300694 true 47 -24924 14315 2125253359 1584792761 613.7653 4.55688160011837E8 6591133412069812.190 71901728808080343.385 2022-06-14 2022-05-05T21:03:48 2023-01-10 2022-08-04T22:02:12 76.178.94.123 doloremque@Eabox.name Spenser Trail 70
+805177271 true -113 -30907 -31300 2120885163 -43503665 27946.63 -8.90713782977671E8 79480225718806594.791 29857375301798851.444 2022-12-02 2022-12-16T15:44:04 2023-01-10 2022-11-08T06:45:31 185.36.183.21 et@Mydeo.name Thompson Crossing 56
+111036594 false -84 -17839 9838 2119921657 -593999332 -15966.607 -2.063820459840978E9 75366678047526224.766 63998521727981116.606 2022-10-17 2022-12-04T11:38:19 2023-01-10 2022-02-23T01:16:51 191.255.22.49 JoeBaker@Youspan.mil Lake View Alley 57
+-1770817987 false -20 11583 -2671 2119040621 624208898 -5228.81 -2.78302970328152E8 17941386887897056.118 11899526568093727.358 2022-11-18 2022-01-21T23:03:22 2023-01-10 2022-11-10T05:41:45 100.11.32.199 velit_commodi_accusamus@Voomm.gov Iowa Plaza 44
+1024513024 true 86 -21286 11190 2118241217 -472027739 31261.693 9.71565646697208E8 78027879960732674.917 6301898336111519.330 2022-04-24 2022-10-11T14:09:56 2023-01-10 2022-12-08T21:07:26 254.19.51.141 nobis@Quimm.org Prairieview Parkway 88
+-1448305201 true -80 6293 -3660 2117900648 -1563536431 -28754.547 -1.613773825190437E9 45450228907052547.544 52619835326601404.303 2022-06-14 2022-04-24T18:27:20 2023-01-10 2022-08-04T07:34:19 18.71.71.254 perspiciatis_itaque_minus@Fliptune.biz Farragut Terrace 25
+-713833058 false -82 -14164 15408 2117248310 -686141402 17675.533 9.37875378624397E8 15765069107479361.861 49165450310001614.880 2022-07-30 2022-02-09T02:25:16 2023-01-10 2022-09-11T23:56:26 128.58.245.73 JohnMcdonald@BlogXS.mil Graedel Court 37
+1330959981 true -62 28035 -15952 2115025714 2080110570 4264.9404 -8.20843484546934E8 74212342808885749.980 52813901778078833.847 2022-04-07 2022-09-12T02:52:57 2023-01-10 2022-04-25T08:55:49 196.155.151.65 kPayne@Avamba.mil Express Road 11
+-1397201346 true -5 7314 -12565 2114964742 -1935959664 24499.186 1.573856871514853E9 90048089418607254.991 70882243835620622.859 2022-09-06 2022-08-06T15:43:49 2023-01-10 2022-03-09T04:08:22 29.15.71.237 MildredRoss@Talane.edu Lakewood Gardens Drive 52
+496250252 false 70 -28673 8252 2114887007 -1427439640 6455.6455 1.69941556957551E9 23351052108667185.335 84842748115180769.262 2022-08-15 2022-12-27T12:33:06 2023-01-10 2022-02-26T12:36:52 28.155.71.249 eRyan@Geba.edu Clemons Hill 97
+-2144573786 true -14 12024 17566 2112187773 -590989675 -9049.307 7.4022969373203E8 14818930632155820.939 52081198872407354.000 2022-07-23 2022-11-07T23:36:15 2023-01-10 2022-08-29T11:12:33 239.219.190.193 iMorgan@Mybuzz.mil Butternut Junction 72
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_asc.out
new file mode 100644
index 0000000000..d529872a03
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q14_datetimev2_asc --
+755366035 false 79 4132 -25325 -387631717 1087461642 -628.5988 1.952250555808231E9 22831880007732095.345 50491596287709053.348 2022-12-12 2022-11-24T11:12:14 2022-10-28 2022-01-10T15:58:40 61.225.183.165 MargaretEdwards@Tekfly.name New Castle Circle 29
+78354921 true -101 16317 -22682 1875364866 493160211 6647.924 -4.118583450822E7 11785036705001142.200 98578317795671280.305 2022-03-09 2022-08-17T01:28:36 2023-01-09 2022-01-10T16:01:50 233.142.114.64 8Black@Twimbo.org Johnson Street 67
+368515789 true -83 -11275 -20051 576563617 -1104825272 -24694.344 2.45343925042296E8 83652505897808471.460 14170936804202410.552 2022-04-20 2022-03-14T07:52:01 2022-07-03 2022-01-10T16:02:21 127.62.73.237 JasonLittle@Skinder.mil Oak Valley Center 47
+-1510477454 true 69 6238 -19462 -1816395909 105883429 29650.547 1.240988083367038E9 88963236536078959.366 85944124623622546.668 2022-06-11 2022-11-10T22:08:45 2022-07-25 2022-01-10T16:03:23 91.168.156.5 RebeccaFields@Thoughtblab.edu Texas Terrace 64
+52784960 false 102 3479 -13921 -1064005566 644536622 5325.0425 1.596685981136262E9 10610183127825981.612 80284431255136857.710 2022-04-25 2022-12-08T23:01:55 2022-08-11 2022-01-10T16:04:31 149.216.36.0 ChristinaRodriguez@Youspan.biz Randy Circle 17
+-1683775817 false 71 19225 -32131 742992063 1626906818 32651.121 -1.632682384887526E9 60375695436836332.771 87315224836228918.795 2022-11-05 2022-11-10T11:14:54 2022-06-11 2022-01-10T16:04:41 97.5.232.212 sRivera@Zoomcast.mil Golf View Crossing 62
+-996697723 false 85 25637 -21148 -744222108 -593493650 -11450.651 -1.167904321387118E9 32585085266732240.402 64562066838726736.278 2022-09-10 2022-08-08T18:00:04 2022-11-03 2022-01-10T16:04:49 54.143.193.60 vitae@Oyoloo.mil Ruskin Court 16
+1402184551 false 7 -21444 -16013 -1256679026 -1439667661 2700.9944 -1.444617894945704E9 44853498876094960.297 94632541519623071.590 2023-01-02 2022-08-27T03:37:26 2022-08-04 2022-01-10T16:05:38 11.8.86.176 eFields@Gigabox.org Village Court 44
+-33968025 true -46 18193 15477 -733803005 1838898287 15033.911 -7.68768505032434E8 88488171622590599.810 42526411727465526.361 2022-12-21 2022-04-14T09:10:01 2022-11-01 2022-01-10T16:05:45 238.124.55.15 yWard@Yakidoo.name Northport Pass 5
+-700290209 false -61 -24768 8981 1769095688 -1811059535 26550.553 1.898948089429888E9 6302075696085095.930 95858385508825939.586 2022-04-12 2022-05-06T18:56:26 2022-01-18 2022-01-10T16:06:02 70.75.107.213 JacquelineRamirez@Edgetag.edu Schlimgen Way 58
+97156797 false 30 17239 5439 -1623839913 -1922469617 -23665.729 -1.88884989441398E8 45755156309522466.870 49311124665541595.480 2022-04-03 2022-09-08T10:57:29 2022-05-25 2022-01-10T16:06:40 249.98.251.14 KathleenWilliams@Fanoodle.mil Gerald Plaza 4
+-1651831027 false -40 -24105 -7389 -1431870339 -1002197417 20793.098 -1.295938018197165E9 10862309589738237.466 44264881470360983.805 2022-08-18 2022-03-04T10:00:09 2022-04-17 2022-01-10T16:09:50 71.24.67.176 9Meyer@Voomm.name Eliot Street 7
+-1521811253 true -60 -8632 6288 -626724778 -1920488824 -8787.745 -1.72476970658196E8 57901851298744604.934 97458644512885827.102 2022-02-23 2022-06-25T08:32:30 2022-02-08 2022-01-10T16:09:54 98.159.195.141 nPalmer@Blogspan.info Kennedy Avenue 90
+1680480394 false 34 -24709 -16704 -1473750556 -351836436 9071.129 -1.830655735609612E9 38386913868571378.894 2790815456820904.170 2022-03-13 2022-03-17T14:09:04 2022-02-17 2022-01-10T16:10:07 83.206.190.20 EdwardRogers@Skinix.mil Bobwhite Road 69
+203472004 true -69 7857 29140 -1123086736 -1898153416 -10556.305 -1.77309875898539E9 60377727563550063.665 51492832283400442.873 2022-09-19 2022-11-19T14:48:07 2022-08-07 2022-01-10T16:10:59 207.113.20.129 nam@Gigaclub.info Crescent Oaks Crossing 79
+-1471279101 true 34 10628 -16106 -788430590 1894961333 4313.937 -5.1092627768235E7 71134698800701686.263 27555656427882512.659 2022-02-22 2022-05-11T23:40:21 2022-04-11 2022-01-10T16:11:51 179.160.110.61 quidem_dolores@Jetpulse.net Mesta Way 40
+686752469 true -46 909 -17835 -515031918 -560944317 24897.818 -9.6981475802878E8 68736411734897767.367 81258071637598243.191 2022-06-04 2022-08-11T20:17:35 2022-06-03 2022-01-10T16:11:53 145.225.78.240 2Ryan@Topiczoom.name Dawn Center 29
+-1463329772 true -64 23204 -27723 1906472648 1753599187 -28017.578 -8.7412093534361E7 34175877199258167.909 30323570439371776.353 2023-01-07 2022-07-02T15:40:57 2022-10-09 2022-01-10T16:11:53 60.230.5.23 asperiores_aut@Chatterpoint.name Summit Plaza 70
+-510695659 false 69 -14005 -17375 -1323249438 488331620 6671.3335 4.03622966295354E8 69297743384305331.670 40281101252049750.461 2022-12-24 2022-06-09T15:30:28 2022-02-19 2022-01-10T16:13:35 127.36.89.221 sed_cumque_omnis@Ainyx.org Aberg Street 53
+1038756525 true 68 -31254 -2346 1028405269 1789547553 22300.36 1.097286253842532E9 84787711042937558.513 61289821142114474.254 2022-03-02 2022-03-21T19:39:21 2022-12-02 2022-01-10T16:13:38 168.182.92.190 NormaRussell@InnoZ.edu Lawn Hill 18
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_desc.out
new file mode 100644
index 0000000000..59dd43ad80
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q14_datetimev2_desc --
+-1460696092 false -97 -2229 -9276 530527963 -658660963 -6392.991 1.070207632356559E9 51697377775165538.424 27225608586195589.798 2022-06-06 2022-07-04T13:35:39 2023-01-08 2023-01-10T15:54:54 34.201.94.216 RogerFerguson@Brainbox.net Calypso Street 87
+-1330227872 true -84 -4657 14877 -2064827646 715518221 26711.805 1.606809192182132E9 42538622852040097.670 91851991844064745.311 2022-02-16 2022-01-30T01:00:10 2022-06-27 2023-01-10T15:54:33 146.164.88.114 2Watkins@Photofeed.mil Hermina Plaza 42
+-1911680504 false 27 22579 30242 2078632063 -1616359267 1131.4033 -1.620026728921817E9 83034082469706378.876 72019727709057736.800 2022-02-17 2022-07-29T02:43:05 2022-03-13 2023-01-10T15:54:23 54.247.61.224 oButler@Oyope.mil Waywood Alley 96
+101227407 false -126 12424 10489 1995718879 -464770757 21452.365 -1.298753384191263E9 63761511886741335.861 80009003816572842.344 2022-10-26 2022-05-09T15:24:24 2022-08-29 2023-01-10T15:53:53 10.139.173.164 KathrynBurns@Lazz.biz Green Ridge Place 34
+90453398 false 88 11777 3887 192433708 1603276431 -13262.567 -1.915556868466225E9 34014441659017924.203 23048228277112759.704 2022-07-19 2022-07-03T16:15:42 2022-09-01 2023-01-10T15:53:50 179.71.154.133 oRyan@Buzzdog.name Laurel Center 85
+-1662253841 false 63 2032 -11874 -1932505194 -1399777322 16880.77 -1.519859996691444E9 56970527355985709.162 63623448263670416.340 2022-06-14 2022-01-13T22:59:40 2022-07-25 2023-01-10T15:53:42 38.233.171.77 zFrazier@Fadeo.com Fair Oaks Trail 76
+2050064096 false 25 29019 3243 -230367489 -941111571 7400.8613 -1.851388483983088E9 226348102723553.824 21196940057983146.102 2022-01-30 2022-11-05T19:15:47 2022-06-17 2023-01-10T15:53:21 78.99.152.130 TimothyRodriguez@Skiba.gov Quincy Street 10
+611127903 false 39 3457 31331 1586087269 2099786888 9167.861 7.40817506739393E8 76135761346738557.500 33316929850521405.551 2022-06-05 2022-10-27T15:56:34 2022-11-28 2023-01-10T15:53:20 242.215.184.220 et_non@Skinte.com Boyd Way 92
+974018288 true -96 -3790 -18552 -1745676531 498576598 -21261.895 2.02833954475258E9 74412367636815540.338 21098746824407609.260 2022-10-27 2022-04-27T10:34:32 2022-04-28 2023-01-10T15:53:13 157.66.0.200 rFranklin@Skiptube.com Claremont Place 66
+-2025121003 true 98 23822 10317 -2018705059 1916911140 13203.572 9.2911973892668E7 12249279130142689.133 76350796289203640.329 2022-07-14 2022-01-13T00:35:34 2023-01-08 2023-01-10T15:53:07 202.202.55.60 ChrisWest@Janyx.net Spohn Court 64
+1030448900 true -70 -28179 13001 -747816388 -721287450 -1172.9457 -1.3783788712626E7 27935674067996655.648 47572043970529301.102 2022-04-14 2022-05-08T09:13:38 2022-05-17 2023-01-10T15:53:05 41.98.48.113 dolorem_consequatur@Twimm.com Namekagon Drive 66
+-242258228 true -68 -15487 -12409 1608057881 1598998546 14191.23 3.82595692387622E8 19897840121651746.140 85671925794548632.210 2022-02-11 2022-01-23T10:11:49 2022-09-26 2023-01-10T15:53:02 8.217.66.147 repudiandae@Oozz.info Bowman Lane 64
+2077818081 false -111 -14000 23312 -1064508762 261566359 -5224.155 2.083079549441855E9 43245476996773941.738 28439978402783179.370 2022-12-18 2022-06-07T15:47:03 2022-02-15 2023-01-10T15:52:06 102.62.212.218 5Taylor@Eazzy.org Talisman Avenue 33
+-1523448329 true -38 22410 -7360 -641966300 -453267994 2730.9773 -1.493077666188507E9 31054867297987176.544 75184464997965549.611 2022-02-01 2022-12-19T05:07:44 2022-10-28 2023-01-10T15:52:01 21.153.120.86 nFranklin@Wikido.org Clemons Drive 16
+1905349457 true 9 -29912 6653 -806554627 -1508039995 29528.578 4.97728171025548E8 73019312741185243.275 41776560302308166.469 2022-12-21 2022-07-17T05:36:46 2022-08-26 2023-01-10T15:51:30 84.148.159.64 id_fugiat@Leenti.mil Oneill Plaza 6
+-1409463354 true -79 -17549 -20797 -1235902706 1287125300 18818.393 -2.089314157103185E9 63536403364005197.721 62702866242320144.501 2022-03-22 2022-05-19T04:04:46 2022-11-10 2023-01-10T15:50:49 46.211.238.210 MarkGardner@Voolith.info Schmedeman Circle 63
+-1225949109 false 21 -25562 -15584 1049919668 -1531844516 1401.4991 8.60001496950306E8 46863118513399593.572 56484137302104819.546 2022-08-26 2022-07-31T15:24:34 2022-07-13 2023-01-10T15:50:10 198.143.122.50 mHernandez@Vidoo.name American Ash Lane 11
+-199257892 false -71 7766 -14400 332882194 555986434 15951.512 -8.33659684687661E8 36795573298172542.285 51484756427294065.321 2022-01-17 2022-08-07T18:57 2022-06-20 2023-01-10T15:49:43 249.56.248.134 LoriPeterson@Oyonder.info Shopko Point 92
+-580431718 true -98 27378 22309 867743322 442023125 28779.576 -1.12667442379089E9 98762307453210732.937 48034921398559420.240 2022-05-02 2022-12-27T09:22:58 2022-12-23 2023-01-10T15:49:36 253.53.23.10 yGonzales@Avamba.org Bellgrove Park 16
+-1669001955 true -88 -9812 -8994 -1945221726 -1463310929 -23013.854 3.46004724369729E8 51179538056668726.666 56823652649349950.258 2022-04-10 2022-09-07T08:44:20 2022-12-20 2023-01-10T15:49:10 194.237.171.255 TimothyKing@Jamia.info American Hill 32
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_asc.out
new file mode 100644
index 0000000000..d71c569f4e
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q15_char_asc --
+-253938067 false -40 27258 -5928 2061922250 1496737886 5772.6973 6.06076201086729E8 60015904398688265.304 1754132376561068.511 2022-09-07 2022-11-23T12:57:47 2022-07-25 2022-09-11T06:50:01 0.0.112.236 nHowell@Devpulse.info Jackson Avenue 67
+109045218 true 100 -20151 -19882 -110183145 -619054806 23015.803 -1.437034101778622E9 15432008675859507.489 69972174390695974.576 2022-04-13 2022-09-30T18:38:26 2022-02-04 2022-08-07T19:06:07 0.0.141.235 vero@Oyonder.gov Hazelcrest Way 45
+-1028986020 true -109 28986 14238 -1736389557 1987535150 -15644.225 1.451063217218461E9 49113860871835022.616 31046413624968009.531 2022-08-12 2022-02-09T00:57 2022-01-15 2022-02-05T11:27:35 0.0.147.179 exercitationem@Livetube.biz Ramsey Park 44
+-1447120758 false 104 27194 -14878 -373426246 740957837 5517.1963 2.39950583453862E8 52088711656772050.492 42362793424784481.903 2022-03-03 2022-06-17T05:23:11 2022-06-10 2022-01-23T09:12:02 0.0.158.180 JoshuaThompson@Pixope.info Chinook Terrace 80
+-1464866908 true 8 15768 22426 1485033220 -918020430 16532.443 -1.48369281225366E9 45550443706866425.980 64471960948135748.330 2022-08-28 2022-05-16T20:10:46 2022-01-20 2022-10-12T06:39:01 0.0.173.63 culpa_ut_omnis@Cogibox.mil Miller Drive 86
+-1661698503 true 126 -17986 -28788 -839244895 564690702 13945.036 -2.008353962471632E9 2868487869278653.559 99436850501846431.477 2022-09-30 2022-09-15T16:17:33 2022-06-27 2022-03-30T14:54:03 0.0.189.137 qBaker@Dynazzy.com Laurel Point 47
+-1526783763 false 9 -1840 15145 1621060662 -380506944 581.4438 -1.391258038688637E9 28635299784354798.894 55258277581265783.545 2022-10-03 2022-10-22T15:41:50 2022-10-17 2022-11-24T10:09:46 0.0.199.186 MarilynRogers@Gabtype.gov Crownhardt Hill 28
+-1174385149 true -36 -31267 7431 748383400 -1782698096 4226.3384 -1.083150366886749E9 8129207772663429.404 63420406170608204.417 2022-11-10 2022-07-09T21:16:10 2022-02-01 2022-05-06T15:53:29 0.0.20.37 fSullivan@Eire.edu Mcguire Road 99
+50902780 true 2 -16828 28703 1208486587 -74819671 -2158.284 -1.148517068916708E9 82590226618452760.477 48994995597883814.209 2022-05-19 2022-05-10T20:24:46 2022-11-02 2022-04-22T09:12:14 0.0.23.196 fuga_officiis_aliquid@Chatterbridge.name Trailsway Hill 92
+354872785 false -8 -23044 -18910 -403720874 -1472669446 28636.297 -5.00744090095746E8 22062650149414224.482 53433470277239324.415 2022-01-26 2022-05-01T06:17:56 2022-07-26 2022-01-20T01:49:14 0.0.241.109 MartinMitchell@Feedfish.edu Anzinger Crossing 18
+-128907865 false 54 -8332 -8218 -1690732746 821665409 -10875.8 -3.03226791069825E8 20040395786878026.390 27384295151729802.390 2022-01-14 2022-01-25T07:09:29 2022-09-18 2022-12-07T15:28:04 0.0.6.219 non_nesciunt@Quamba.biz Dahle Point 18
+1669737785 true 50 13436 -5439 -352131903 -860164339 29512.43 -5.5725064488281E7 95721473550833224.949 73581216486041728.733 2022-04-02 2022-11-29T03:46:59 2022-10-31 2022-11-29T01:10:19 0.0.64.30 sint@Buzzdog.mil Linden Junction 35
+1060110570 false 18 4932 -31418 -1109053205 -2070957788 16692.02 1.39271842729734E9 70802595134660500.380 68713946547667189.783 2022-04-12 2022-10-25T17:08:51 2022-06-29 2022-03-17T18:15:01 0.0.68.92 qui_a_quos@Minyx.edu Oakridge Drive 93
+-1193443339 false 90 20941 2364 367400850 1369142817 -2850.9583 -1.073191087237996E9 64557232837889758.458 56011302765065072.792 2022-07-01 2022-11-02T18:30:10 2022-11-10 2022-03-21T21:29:42 0.0.93.170 9Mcdonald@Ntag.name Sundown Circle 80
+1824177681 false 66 -11060 30241 698774384 -706655319 9563.255 1.711512546331549E9 86123581066112873.177 55214482096451540.655 2022-02-18 2022-06-27T18:41:58 2022-06-07 2022-11-20T18:10:51 0.1.106.158 FrancesHunter@Zoomzone.net Porter Junction 97
+-1010884152 false 104 7699 16377 2042492551 -1612800915 8224.908 -1.223988811139082E9 66259336731313525.998 58723281040536682.941 2022-06-06 2022-09-12T02:10:29 2022-09-06 2022-06-27T20:18:30 0.1.175.230 aut@Tazz.gov Independence Terrace 34
+19156669 false -27 -259 -4519 -1134542266 -313282257 16304.245 1.2280493397297E8 78408058298171417.803 30015106421241075.831 2022-05-11 2022-11-30T09:44:48 2022-11-16 2022-11-08T00:13:56 0.1.195.216 ShawnBennett@Jazzy.edu Myrtle Crossing 7
+-1657927617 true 4 26889 27282 -504423350 1595585863 28450.484 -1.660718820204285E9 39686973033625060.755 72068073088516397.143 2022-10-25 2022-08-10T06:15:23 2022-12-06 2022-10-14T08:30:35 0.1.220.203 HeatherBishop@Quinu.net Fallview Lane 0
+1981891589 false -113 19955 28233 -1327770544 -355908019 16261.51 5.28572899087892E8 64030119903544942.626 17199335182798345.180 2022-11-17 2022-11-10T12:47:05 2022-01-26 2022-06-27T13:14:40 0.1.244.27 nihil@Skynoodle.name Florence Avenue 31
+-106065753 false -83 -335 18246 406939467 1700773704 27185.422 -1.383589711089231E9 54710816599500355.989 12193470696400113.320 2022-11-20 2022-08-10T16:22:33 2022-02-06 2022-11-09T12:34:17 0.1.34.119 saepe_fugit@Gabtune.org Burning Wood Way 14
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_desc.out
new file mode 100644
index 0000000000..54d802df19
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q15_char_desc --
+-1331577760 true -11 9047 -16042 315413695 1297934047 -21483.018 -2.26702700070283E8 16104896194012429.274 87402351967250684.928 2022-03-15 2022-04-22T07:07:30 2022-04-04 2022-10-08T08:41:41 99.99.73.10 sBrown@Cogilith.com Butterfield Park 41
+-1712336695 true -23 -14592 -26122 836879246 496203717 1772.0596 1.185438524640771E9 20080170946700327.840 56801583459856893.830 2022-10-01 2022-10-25T03:09:47 2022-09-01 2022-07-16T03:02:43 99.99.65.2 tempora@Tagpad.gov Sutherland Street 77
+824193689 false -49 -11509 31496 1825355576 1348925826 -29811.771 1.555339546364234E9 36073525734273916.881 63227915060384469.762 2022-07-21 2022-09-28T21:04:48 2022-04-15 2022-12-06T02:30 99.99.52.107 6Woods@Jabbersphere.org Kim Way 98
+1628694721 true 68 32655 26442 154177324 -560202813 3579.6008 1.255404269167506E9 38063662382836804.367 22835870212258864.233 2022-11-29 2022-07-27T11:59:25 2022-01-12 2022-09-13T02:26:26 99.99.42.106 et@Lazz.net Florence Alley 85
+585838464 false -117 8231 -21782 21936678 1139137663 10938.842 -1.057008120850436E9 21895162787971921.483 46478461969542333.380 2022-03-14 2022-10-07T07:39:40 2022-05-25 2022-10-11T11:28:20 99.99.32.22 vHarris@Realcube.net Eggendart Avenue 66
+-360092657 false 79 12895 -28578 -1168970205 -831904083 -31004.512 1.432690821104434E9 97049703840275279.473 65417203213940735.724 2022-03-09 2022-07-01T16:12:26 2022-10-18 2022-04-22T06:23:46 99.99.251.179 PhilipWard@Oodoo.edu Kinsman Plaza 67
+1037753714 false -6 1466 -28789 1161664534 2003513669 -7275.823 -1.352268570474401E9 63693907264007526.706 16092016026315635.631 2022-08-13 2022-06-22T01:11:23 2022-01-31 2022-08-25T17:05:43 99.99.25.187 hBell@Jabbercube.org Nancy Point 75
+-1924704990 true 73 -30843 -12729 -1533516077 -632464735 -24846.486 -1.557415605506909E9 60732582186708126.168 63146209740350464.773 2022-09-20 2022-07-22T06:14:59 2022-08-07 2022-02-06T09:23:20 99.99.232.59 wSpencer@Zazio.info Westport Lane 18
+-1878438384 false -40 -26244 -28252 671564995 624092585 -28578.262 6.76825147497824E8 61408724469676584.495 67846104265740508.611 2022-02-04 2022-03-09T16:06:39 2022-06-29 2022-08-19T12:26:30 99.99.185.180 xReed@Oozz.info Stang Terrace 0
+-1610582240 true -119 -29809 -26159 487504607 -105456031 1036.6146 -1.719819451468896E9 26867176777263708.699 29518437746859778.487 2022-11-22 2022-11-07T18:36:22 2022-05-20 2022-11-26T17:10:27 99.99.164.6 LisaOrtiz@Ozu.gov Waubesa Street 26
+-276584768 false -53 -32713 -16081 -462004515 1430690796 -29099.066 -9.4342937285693E7 272598634884611.563 66316712668660562.390 2022-05-05 2022-04-27T01:36:05 2022-11-07 2022-07-22T08:01:26 99.99.153.30 veniam_est_fuga@DabZ.mil Mendota Center 41
+-1494150861 true 0 -4621 2933 1611917990 -1719636659 21074.697 2.21699064875878E8 53087198341020605.170 11686777916746799.747 2022-11-19 2022-01-19T22:04:30 2022-11-26 2022-08-23T03:13:09 99.99.131.135 temporibus_sint@Jabbersphere.org Loomis Lane 56
+1000539971 false 66 -23990 -8284 -2104470411 -967492502 -20395.6 1.75026400847612E9 86495489904533644.698 983928040161651.973 2022-03-17 2022-05-10T01:21:40 2022-06-24 2022-10-11T11:38:23 99.99.110.39 ipsam@Snaptags.gov Dottie Drive 23
+751854895 true 9 -5966 -29957 1933610720 568244976 -17778.19 1.083495191384842E9 41175360255408185.797 15402010564132004.572 2022-10-10 2022-06-21T17:10:40 2022-04-30 2022-03-26T23:24:15 99.98.7.143 JohnPhillips@JumpXS.mil Northfield Street 40
+1441624730 false -38 -12917 14591 -827053022 -1520961109 -8798.018 1.773274879550194E9 16894403904562058.880 19774247748352723.496 2022-08-20 2022-09-15T19:15:57 2022-08-17 2022-03-03T23:08:50 99.98.55.187 magni_distinctio@Latz.edu Sherman Point 80
+1690370495 false -65 9865 10316 1004878685 -1634361062 17097.492 -5.06221481685881E8 85412879871181681.636 99389772778275988.194 2022-12-04 2022-04-21T08:59 2022-02-05 2022-03-27T04:34:26 99.98.35.34 fShaw@Dabtype.info Warrior Plaza 98
+1331566436 false -123 22434 7943 -257611424 252761259 -28889.205 1.134490007284071E9 98097833124037540.937 14081308502706946.151 2022-05-22 2022-01-22T11:57:33 2022-05-31 2022-04-23T14:33:58 99.98.225.219 MatthewDixon@Quatz.biz Lillian Hill 6
+1415797339 false 80 -17729 25445 -1539361515 -1419632228 -16896.219 -3.44039476377946E8 67871896371312643.741 66750608328000893.222 2022-05-03 2022-05-07T23:46:47 2022-08-11 2022-12-17T17:28:26 99.98.215.80 wWatson@Meevee.net Sheridan Parkway 58
+-624984161 false 40 7355 31824 -2031164725 -570808911 -26422.096 -1.03572662369708E9 42766196239369804.410 60319854991159903.596 2022-12-31 2022-08-11T19:20:57 2022-10-18 2023-01-08T18:22:36 99.98.201.155 pMorris@Quimm.mil Fallview Terrace 18
+-1095871081 true 104 15570 -26366 -411129909 1539982848 13558.636 -1.417665566745042E9 12781487249997112.145 55812779586883865.724 2022-05-09 2022-04-13T04:19:10 2022-12-21 2022-09-03T22:11:39 99.98.160.119 necessitatibus_perferendis_mollitia@Miboo.edu Kedzie Crossing 94
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_asc.out
new file mode 100644
index 0000000000..243ae0d582
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q16_varchar_asc --
+-421858848 true -75 -104 -11439 1797695104 2105972372 -15571.382 -3.13416812104635E8 66211621978377773.712 84213740854143146.702 2022-02-10 2022-08-17T05:42:16 2022-02-17 2022-04-07T15:02:47 99.37.174.165 0Adams@Avavee.gov Farragut Avenue 98
+1778199034 false -120 9252 15150 -958286252 2121854656 21649.045 -1.483857694140935E9 65983807817182051.212 57824727639993577.784 2022-06-04 2022-11-25T18:56:01 2022-12-06 2022-01-21T00:17:38 104.173.194.209 0Adams@Babbleblab.org Heffernan Place 92
+2125857335 false -97 5857 -17639 -1920641609 529426952 -4368.816 -8.34307056540495E8 46777988452739592.810 97451548289298816.795 2022-06-25 2022-07-22T21:09:52 2022-12-20 2022-05-19T02:54:37 233.87.159.216 0Adams@Blogtags.gov Nelson Court 83
+164252321 false -111 -28521 28470 -1468347723 -550203363 6653.323 -1.26180418760216E8 30956206602610132.137 70456065456224859.584 2022-02-26 2022-05-01T18:51:48 2022-02-24 2022-08-23T02:25:56 124.83.205.120 0Adams@Blogtags.net Weeping Birch Park 10
+-1395129601 false -50 -30770 32057 -720211049 186813977 21040.217 -6.58404593391288E8 60727264521358083.818 49333586356906756.880 2022-11-20 2022-10-06T11:29:42 2022-03-16 2022-12-07T06:21:39 179.60.104.122 0Adams@Centizu.biz La Follette Point 83
+-1081206783 false -23 17847 26665 -947135330 -43853619 -11561.912 -6.09321264357218E8 55701153208270371.240 2411433397927536.737 2022-05-06 2022-05-13T07:24:18 2022-05-25 2022-11-02T12:51:44 231.198.214.91 0Adams@Centizu.name Pleasure Point 91
+-529090333 true 100 32113 -15771 -1459335612 -1588076150 -19139.355 -1.829078671770872E9 48521368446241192.527 6139998172032968.178 2022-10-01 2022-11-22T13:39:29 2022-03-01 2022-01-12T18:16:02 132.94.71.172 0Adams@Dabtype.mil Mockingbird Place 27
+-463506609 false 112 25192 -6487 1254335929 1714503190 14583.035 4.95256485257821E8 19137653761507551.873 97649938057988199.640 2022-10-15 2022-01-20T09:11:43 2023-01-02 2022-11-02T20:39:12 145.224.235.215 0Adams@Demivee.biz Lakeland Street 84
+472939106 false -11 -6066 26161 1801908468 1928153315 -30342.908 -7.30091520636972E8 45312953546435208.950 65701556117586573.477 2022-04-30 2022-09-21T11:49:18 2022-08-10 2022-10-01T06:05:06 88.234.210.202 0Adams@Eayo.biz Sundown Terrace 96
+-1223953816 true -30 17694 -16459 -148076065 -261859686 748.5687 -1.768193158119264E9 13068923230186124.622 33301347986256707.665 2022-11-14 2022-05-22T10:16:32 2022-03-20 2022-07-05T20:54:31 105.250.160.250 0Adams@Eazzy.name Hudson Lane 63
+400323629 false -80 27808 15056 -1770745436 -449189586 -15391.033 1.463640500290254E9 13327585285006091.219 8357011414103597.650 2022-10-11 2022-01-15T10:59:09 2022-07-17 2022-05-14T11:59:17 173.31.173.101 0Adams@Eimbee.gov Cascade Way 78
+914144591 true -67 30729 -22645 326305693 -743982796 -31949.08 1.97803703422932E8 62257931951431274.472 204101120200419.182 2022-02-26 2022-05-12T20:37:13 2022-11-24 2022-06-14T16:23:28 121.78.49.147 0Adams@Fanoodle.biz Di Loreto Trail 83
+1214074782 false -3 -23037 15215 1114355328 1903201717 -21974.174 2.103916341460758E9 50127971203500124.220 49111120280429020.687 2022-06-24 2022-02-19T19:18:41 2022-09-06 2022-07-31T16:06:44 246.147.88.176 0Adams@Feedfire.net Scott Plaza 47
+-704633044 true -108 25437 18792 186199696 -1391744433 -20749.486 -1.125399054343154E9 23960515845960565.489 54081990138712437.537 2022-02-26 2022-04-28T15:57:58 2022-12-14 2022-04-13T10:15:19 50.44.53.188 0Adams@Feednation.mil Susan Pass 40
+-1549681696 false -85 -13603 -13704 -915405460 1738838557 3141.5361 -2.97652470613914E8 92253318844724875.743 57864712370072939.265 2022-04-22 2022-10-12T10:28:20 2022-04-02 2022-11-28T04:49:21 73.208.65.31 0Adams@Flashset.com Hovde Hill 25
+864128085 true 67 22996 18256 -741106301 -1184298400 18545.238 1.694037939410913E9 97006674633358758.300 81560892839529258.188 2022-12-20 2022-04-09T20:40:15 2022-10-20 2022-10-15T08:00:06 254.254.196.98 0Adams@Flipbug.com Katie Point 81
+-1495887859 true 63 -2896 -4146 -1739034249 -380406778 -18377.836 7.84313715126075E8 48482808327324600.685 26339656191567982.300 2022-07-07 2022-02-17T07:44:31 2022-05-30 2022-07-16T10:12:18 18.251.165.22 0Adams@Gevee.info Sherman Terrace 70
+792152995 false -19 5700 9871 1034989059 -738030182 -19515.191 -1.083594064583577E9 17073301499600251.902 738488906565712.547 2022-09-19 2022-12-22T14:13:55 2022-05-12 2022-04-30T11:09:28 58.21.141.10 0Adams@Jamia.org Gulseth Center 31
+-124653936 false -71 18179 19935 -1390930139 804818547 9542.708 2.74460725522634E8 31567325872879436.445 35460428483836996.940 2022-12-11 2022-09-02T08:37:43 2022-11-27 2022-04-30T04:36:08 156.83.149.87 0Adams@Janyx.gov Holmberg Street 65
+-2110699357 true 87 -833 7738 -673738377 -1062114366 -12725.854 9.43055268902166E8 4892436008635635.900 91245669539822906.596 2022-12-21 2022-02-17T03:42:39 2022-03-10 2022-10-17T11:43:29 72.231.231.72 0Adams@Jetpulse.info Hudson Point 36
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_desc.out
new file mode 100644
index 0000000000..dd868ca2b8
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q16_varchar_desc --
+662531722 false 48 -206 -13596 2019660998 -1766766472 -20109.396 -1.814550838401074E9 36738629026567407.620 55904519836354353.576 2022-08-14 2022-05-17T08:00:22 2022-09-02 2022-02-14T20:02:32 82.50.188.139 zYoung@Zoovu.org Southridge Street 61
+130926446 true 105 12042 8442 1659265921 480642288 18212.434 1.612014975253071E9 88102591439342972.100 9139328414562640.904 2022-04-07 2022-03-28T16:41:14 2022-06-15 2022-07-23T06:53:43 155.113.194.128 zYoung@Zoomzone.biz Grayhawk Pass 31
+1245179577 false 124 -26762 7919 -1745784945 -1035341289 16691.45 -2.069415625024853E9 54041227921821380.948 83540556062899645.243 2022-10-07 2022-10-12T02:15:34 2022-11-12 2022-12-06T01:22:58 125.131.195.30 zYoung@Zoomlounge.mil Colorado Court 11
+552069084 true -6 -16750 9289 -479842162 -708802434 14229.186 8.5574561107844E7 93561682246078815.634 95698629984115168.828 2022-06-11 2022-03-21T15:17:25 2022-03-29 2022-01-22T11:56:20 172.75.247.140 zYoung@Zoombox.edu Kinsman Center 19
+1060455696 true -5 -7679 -22953 777654849 16025651 -4613.541 -2.42846385460306E8 97483452045750237.306 45278827571542119.859 2022-11-22 2022-04-17T18:27:44 2022-09-09 2022-01-17T01:23:40 184.6.134.120 zYoung@Yambee.name Westerfield Crossing 46
+1416689150 false 95 13887 25602 -760779777 -583887194 -3448.5054 2.138515855115856E9 37163265296852857.422 26868460766500939.216 2022-10-02 2022-06-12T23:04:11 2022-06-12 2022-08-06T10:18:27 85.206.42.73 zYoung@Wikibox.com Prentice Trail 13
+-1722359780 true -25 -10937 25627 1863815904 857866364 26096.742 1.90183660005557E8 31524755859798316.256 96543754932550314.714 2022-06-21 2022-04-21T01:33:02 2022-07-02 2022-02-13T16:35:41 88.99.133.147 zYoung@Vinder.org Canary Parkway 91
+2112488511 true -16 -13154 -28240 1254569160 403222972 16686.61 -1.841377578067562E9 24510591458871527.248 80594090908020998.259 2022-01-16 2022-10-17T19:46:19 2022-08-03 2022-03-08T18:24:22 228.150.118.114 zYoung@Thoughtstorm.edu 4th Alley 74
+-1482246145 true -106 -18713 -14604 -1197424578 214175844 -3836.9036 3.9589229240208E7 16960757975659393.635 45338212877606335.505 2022-11-14 2022-11-12T15:25:34 2022-07-11 2022-05-19T14:15:50 217.139.233.131 zYoung@Thoughtbridge.mil Continental Drive 67
+-644507442 true -40 31641 -25862 -1790889154 -1404707906 17343.885 1.737692320515817E9 53286004790989688.316 17703206212211138.234 2022-07-27 2022-12-18T17:53:45 2022-09-29 2022-10-01T07:25:51 94.170.177.234 zYoung@Skippad.net Charing Cross Center 52
+-354190829 true 60 22867 1052 -173107591 -1409233094 -13404.633 -2.007737794671291E9 21642190053674066.564 17487145059280950.480 2022-09-05 2022-10-14T12:56:17 2022-09-21 2022-01-24T17:25:20 99.250.199.1 zYoung@Skipfire.edu Westridge Park 76
+330135121 true -56 14452 31524 -2010582449 -1047322258 4297.5596 8.145848157256E7 86993882380386051.986 14360639605714550.978 2022-05-24 2022-11-02T08:52:45 2022-12-20 2022-08-12T07:54:47 120.48.217.151 zYoung@Skinix.gov Jenifer Trail 28
+-1124120084 true -128 -31831 3182 725748224 1293378306 -14287.929 -1.985905340225478E9 71383661629105444.358 88133313515558712.623 2022-11-29 2022-09-09T08:37:51 2022-01-20 2023-01-03T23:15:04 18.164.94.137 zYoung@Skinder.gov Utah Hill 49
+-1690084304 true -108 -24818 -24568 -905799624 -1948006796 31817.932 -1.029835834870436E9 41086919080271309.256 18880042539531098.275 2022-02-26 2022-11-13T19:40:45 2022-05-02 2022-06-12T17:09:21 73.170.53.26 zYoung@Skimia.info Ronald Regan Road 49
+1098880974 false 117 -24002 -20806 -185110644 -1038995074 14082.866 -1.921400240189578E9 78346053662501348.604 59552996290687282.400 2022-07-15 2022-08-12T19:45:12 2022-08-18 2022-02-20T02:50:44 241.111.54.249 zYoung@Rhycero.info Graedel Street 59
+2018447359 true -48 22867 -5527 65392670 -1126401313 21589.85 -5.7482620780016E8 48592779402668399.669 30356364161196306.520 2022-04-11 2022-05-19T21:26:49 2022-03-04 2022-10-30T09:03:23 45.108.243.171 zYoung@Realbridge.biz Michigan Trail 16
+446715564 false -44 -23721 -16271 -1800346257 -1292692094 30569.791 -1.767617706908059E9 10447827669552088.565 49621957955099644.862 2022-04-08 2022-07-16T17:41:06 2022-10-28 2022-09-15T05:03:12 238.237.183.93 zYoung@Quinu.biz Crest Line Alley 29
+973795098 false 100 4563 -3620 718634291 -365945168 -23038.889 -1.095987274354548E9 27228007073316839.814 76046921382683024.570 2022-07-13 2022-06-02T02:47:42 2022-06-18 2022-06-05T08:57:17 131.175.168.11 zYoung@Quimm.name Cordelia Plaza 64
+-757369693 true -37 13813 11564 -265423504 1262073599 3595.745 1.51725892560408E8 49243869281888627.621 57813067390186827.587 2022-10-02 2022-08-02T11:03:01 2022-02-17 2022-01-25T21:33:50 236.31.247.40 zYoung@Quatz.name East Center 51
+-1215064666 false 3 11152 23332 1745631368 1775459731 1700.391 -1.04266610682783E9 89305210055280091.734 143626455306392.438 2022-06-04 2022-06-16T19:46:02 2022-08-16 2022-08-30T07:23:47 131.249.239.87 zYoung@Oyoyo.biz Stuart Park 73
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_asc.out
new file mode 100644
index 0000000000..764aeecfe7
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q17_string_asc --
+-1592797960 false 7 -6579 -4583 -1627101797 -1654417357 27475.512 -7.72179757635776E8 5106404149572992.768 89644326556158513.379 2022-10-08 2022-10-23T21:29:23 2022-11-22 2022-05-04T12:36:15 203.19.103.240 VictorMyers@Realbridge.mil 1st Alley 12
+-1702895253 false 74 -23326 15941 1750833797 891145292 -5566.2886 6.4382361116976E7 52189184506203487.310 34872247060725414.103 2022-03-06 2023-01-09T20:39:13 2022-04-26 2022-12-05T18:43:08 143.232.171.53 nobis@Browsecat.mil 1st Alley 13
+1168042908 true -12 15806 -20284 -864425143 -1233425583 6070.7563 -1.687605190786361E9 93797407399565913.962 16604520726130112.540 2022-06-12 2022-09-12T07:57:08 2022-05-20 2022-01-13T00:52:13 132.111.222.23 zFrazier@Vinte.gov 1st Alley 15
+910407155 true 116 19545 24523 -487765455 -744291975 14334.146 -1.370426800828882E9 24415617793165219.823 85156661075679181.191 2022-11-22 2022-12-02T10:41:46 2022-05-13 2022-05-30T05:06:41 227.128.59.245 dolorem_maxime@Plajo.name 1st Alley 16
+443629478 true 101 -11983 22518 1293233069 1720627422 -1102.1978 -1.5211350824911E7 61032815302357696.530 66535740915975078.367 2022-08-13 2022-02-15T13:12:26 2022-10-05 2022-03-01T00:39:57 252.11.32.94 rDay@Dabshots.net 1st Alley 16
+-558108333 true 14 7586 -30868 2002724802 1763447185 -23086.096 1.85638128615846E8 24041567062979912.765 66897979016479933.675 2022-06-15 2022-04-22T07:16:02 2022-12-08 2022-07-29T03:10:35 68.176.214.175 BettyWarren@Browsecat.edu 1st Alley 18
+-1974667132 true 42 4139 -22365 -766929243 561391544 -19803.291 -1.065853626171658E9 15610738818188781.565 52482249297349333.699 2022-07-01 2022-03-31T07:09:51 2022-01-13 2022-09-28T18:08:16 223.83.173.58 possimus_et@Minyx.mil 1st Alley 19
+-397089338 false -93 4940 -29817 140324916 -1600969036 4689.1763 -2.06639748964639E9 51555626034242289.996 15916441852690239.231 2022-04-04 2022-01-13T20:12:48 2022-05-04 2022-01-11T01:13:25 252.64.86.251 eum_expedita_molestias@Feedbug.edu 1st Alley 19
+1680748963 true 85 18149 18969 -92138496 1496123550 1554.6405 -2.86568393056742E8 40045618626472403.297 32641466394086614.649 2022-12-18 2022-04-28T21:13:46 2022-02-24 2022-02-13T14:33:28 69.238.217.1 sit_doloremque_quidem@Podcat.name 1st Alley 2
+-1918366340 false 70 13772 -3666 -1953153949 794516042 30508.299 -3.6696945276336E8 24271391813829958.167 59107956519203663.641 2022-06-09 2022-02-12T20:25:46 2022-01-29 2022-11-16T04:01:03 211.200.144.103 quae@Mybuzz.com 1st Alley 23
+-1569180608 true 106 -31165 29111 1331727343 1878010588 23252.588 -1.231731682067512E9 80664184950286523.256 10731295967421040.309 2022-09-08 2022-08-16T16:35:28 2022-01-25 2022-09-04T09:34:12 240.54.161.78 mHoward@Teklist.info 1st Alley 25
+317056040 true -46 -16521 -22293 64676326 -1602922021 15013.503 9.42511173939751E8 27773242362015829.371 15981739244075342.717 2022-10-26 2022-04-12T06:46:28 2022-11-21 2022-03-20T23:04:57 52.176.134.155 voluptatem@Skynoodle.mil 1st Alley 26
+1807221916 true 112 8609 13724 1353141153 883070966 -25159.037 -2.140929160065219E9 23406056908281689.749 23553265743374278.450 2022-08-25 2022-12-05T14:00:56 2022-08-12 2022-09-30T14:24:20 39.131.108.169 tLarson@Jabberbean.com 1st Alley 26
+459208370 true -105 7183 -28526 1499825638 -1607553214 12269.968 -1.761041511613938E9 42798595719558090.580 61330784035771336.193 2022-05-17 2022-08-20T20:21:55 2022-04-03 2022-06-07T23:55:47 196.44.104.55 ClarenceNelson@Voonyx.org 1st Alley 26
+-10663124 false 107 1019 22572 1151877578 996484353 -9232.662 -8.04361595870219E8 77889185630116813.498 58742070671324246.252 2022-11-30 2023-01-02T04:34:16 2022-04-01 2022-02-28T06:38:23 74.199.167.167 MichelleStewart@Eire.name 1st Alley 27
+-732258845 false -40 -9632 21176 451804115 1696491377 -12843.192 3.79427988057741E8 15638281725428596.745 35143558808840530.861 2022-05-13 2022-02-19T10:00:08 2022-03-31 2022-08-29T15:21:22 161.16.206.176 EmilyTorres@Wikizz.info 1st Alley 29
+-1075152603 false -122 -31053 -8072 -416573763 -96380668 -22764.047 -1.359660555702382E9 19869290518855525.928 53800078998086841.650 2022-07-16 2022-12-22T21:49:30 2022-10-11 2022-10-01T16:32:50 143.68.82.222 0Warren@Dabtype.com 1st Alley 3
+-1094508864 false 117 -17762 20701 -1973158190 -1241485587 -24601.283 6.72091766154775E8 54548642673501144.185 17155322170144469.269 2022-03-01 2022-11-21T05:16:50 2022-10-22 2022-05-03T18:21:10 64.143.247.4 JohnRiley@Skajo.mil 1st Alley 30
+1190613902 false -37 -2518 -2859 1504641832 -308301378 17676.936 -1.800508497969299E9 54361167905408506.274 46265893863186851.662 2022-03-23 2022-04-03T07:18:06 2022-01-11 2022-06-25T05:22:10 94.218.6.31 rem_occaecati@Npath.net 1st Alley 31
+101321946 true -101 -27798 -21430 -1969397161 1096940579 5275.2524 1.36416645484735E8 29219757547674036.584 83480590743076696.507 2022-02-21 2022-07-02T17:46:09 2022-07-28 2022-10-21T19:12:29 87.176.129.84 ArthurJenkins@Twimm.net 1st Alley 33
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_desc.out
new file mode 100644
index 0000000000..8443775f22
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !dup_nonkey_topn_q17_string_desc --
+1788885478 true 63 -11603 3603 -2099239257 215943754 -20036.201 4.20506006996905E8 79486202597669846.661 68427975603194356.948 2022-10-16 2022-06-11T18:46:40 2022-02-07 2022-04-22T12:09:06 107.130.185.130 TammyRoss@Pixoboo.gov Westridge Way 96
+-1908632538 false -13 -21521 20792 314894420 391302757 -26360.688 -2.130985315271908E9 21030644542468258.957 2098173440227552.250 2022-09-01 2022-01-20T09:09:35 2022-08-31 2022-04-18T10:48:43 198.171.156.31 RandyDiaz@Yakijo.mil Westridge Way 95
+257393848 false 42 -26805 3875 -1897423790 375837646 -13273.37 6.9697487758171E8 42884975833855223.353 84310229524119763.590 2022-07-14 2022-08-15T18:14:46 2022-11-01 2022-05-27T21:08:53 70.151.162.7 nobis@Pixoboo.com Westridge Way 95
+-420225434 true -8 29043 -17756 -365199063 61604339 -14375.166 1.132912438548864E9 82889461616174859.743 34845826481852959.468 2022-10-02 2022-01-24T14:16:52 2022-01-14 2022-12-07T23:08:20 174.51.38.80 LarrySmith@Roombo.net Westridge Way 94
+195786707 false 57 17148 -713 620394269 -595208350 14440.632 -4.16626631409584E8 49563225865731116.263 80295423676735577.609 2022-08-14 2022-05-21T08:57:32 2022-08-09 2022-10-06T14:19:54 219.175.201.6 CherylBrown@Blogspan.gov Westridge Way 91
+418908889 true 46 -20041 -25147 74622799 1731721011 -5553.182 1.138268469627672E9 47073624330727067.681 65660071267706921.327 2022-11-03 2022-03-18T22:31:21 2022-01-17 2022-04-27T07:23:22 8.96.132.28 6Wallace@Kayveo.info Westridge Way 91
+312554226 false 66 4914 -5871 330605379 -676471521 -20194.97 1.02628849302948E9 48101486995500295.358 47139795015533125.459 2022-08-19 2022-08-27T09:31:33 2022-10-29 2022-11-19T08:16:56 240.88.201.114 quia@Twitterbeat.net Westridge Way 90
+443757029 false 65 -3132 25334 70154103 -1714376369 -19339.865 -1.757875633009279E9 78923550065287892.761 5270698736150700.302 2022-09-13 2022-02-19T12:54:16 2022-05-20 2022-03-11T15:03:41 146.114.119.163 7Lee@Jabberstorm.biz Westridge Way 9
+-1362809497 false -37 -31048 7539 1771425675 299951714 17394.299 4902695.642423 18550221340526293.213 11360144073035110.860 2022-04-19 2022-01-26T21:15:21 2022-01-17 2022-09-25T17:02:16 90.111.218.36 uGarcia@LiveZ.gov Westridge Way 89
+-1859417451 true 1 -29290 23259 -146034629 -792220741 -16748.357 -4.39889132616518E8 7675275209982281.850 15123111098081104.340 2022-03-28 2022-01-17T07:31:19 2022-11-13 2022-04-22T22:56:40 162.122.150.229 et@Chatterpoint.mil Westridge Way 89
+-529223414 true 88 -5452 20614 -900428298 740440588 23007.346 -1.662857591934437E9 877863554691558.898 56007378700458463.351 2022-07-07 2022-12-19T21:38:45 2022-10-29 2022-10-29T05:22:13 3.167.101.33 rerum_aut_dolores@Oyonder.edu Westridge Way 89
+2034441890 false 62 -11190 29625 -1519565861 818425899 20055.523 -1.561890863176794E9 22076739850886636.520 22571648105451090.654 2022-05-30 2022-10-08T04:45:40 2022-05-05 2022-12-24T20:54:18 147.80.140.38 yGonzalez@DabZ.name Westridge Way 89
+-1794943771 false -67 -5097 -15138 -1295454768 -972205738 20271.934 -1.800836466541678E9 38544426212096088.530 29969096078554471.481 2022-06-21 2022-09-20T15:56:01 2022-10-19 2022-11-19T00:17:54 23.81.121.178 ex@Twitterbeat.biz Westridge Way 87
+230766091 true 31 12180 -6122 -1689662597 2001417237 -13576.946 9.21989416750725E8 65669183802887664.711 65230640004270083.875 2022-06-26 2022-06-10T03:12:46 2022-11-03 2023-01-10T12:21:52 197.82.90.185 similique_suscipit_debitis@Rhybox.edu Westridge Way 87
+1657504758 true 17 29317 27364 -1267821738 -1256756498 26649.877 -3.25197861948544E8 56386698141704941.483 62312436470384583.290 2022-05-31 2022-12-24T12:04:06 2022-03-17 2022-03-16T10:21:57 62.179.6.11 cHicks@Wikizz.info Westridge Way 86
+1618055511 false 35 -23474 4358 -2021819558 -1105824380 18573.38 1.922391897886631E9 57744065520145976.231 6695578893767881.911 2022-04-11 2022-07-10T18:02:20 2022-05-24 2022-05-11T20:44:46 80.237.166.177 iAlvarez@Tagopia.com Westridge Way 86
+1624733818 false -100 25858 -851 1332889445 1058738313 -26333.469 1.920784533754478E9 54698007295776299.290 1042711916750383.473 2022-08-20 2022-04-26T10:09:36 2023-01-01 2022-08-30T10:57:06 146.171.143.208 LawrenceBrooks@Ntag.com Westridge Way 80
+1916823156 false 67 -20298 12904 -1475233551 42003257 -1733.4249 1.291079052928937E9 99906662946434400.570 53233051136435203.685 2022-01-20 2022-08-18T04:15 2022-08-16 2022-12-12T08:01:09 226.137.150.145 8Carpenter@Blogtag.com Westridge Way 80
+-453555518 true 24 31559 -3815 2022813179 -1927482006 6423.038 -1.99428251937564E8 47736023841899638.552 96854679979479728.502 2022-09-18 2022-09-16T10:33:40 2022-04-16 2022-05-27T03:41:43 10.230.38.117 StevenSimpson@Voomm.gov Westridge Way 8
+1989621701 true 1 25701 -5014 -1997486447 -99345622 4059.546 -1.74320200146372E8 93568203003475872.662 28102352307302453.552 2022-03-03 2023-01-06T22:36:20 2022-02-28 2022-09-10T20:38:29 136.24.182.227 debitis@Buzzdog.gov Westridge Way 78
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_asc.out
new file mode 100644
index 0000000000..6faa78e88a
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q01_bool_asc --
+2022-06-13T07:08:23 -2147483358 16697470310045199.514 false 0 21661 27910 50137345 -31890.162 2.5182778747432E8 8892361240908133.332 2022-03-29 2022-05-06T07:35:41 2022-02-20 86.198.4.14 tHarrison@Yotz.edu Ohio Terrace 97
+2022-07-16T17:14:43 -2147480317 10126355674710455.926 false -106 25720 2137 -1044710620 19297.592 -4.6721094672452E7 74446297684183183.297 2022-02-12 2022-02-10T22:47:34 2022-08-24 176.57.174.210 2Jacobs@Oloo.edu Sunfield Pass 74
+2022-03-12T18:09:32 -2147474804 5170475614524523.563 false 81 -17173 20232 1094003829 -21709.188 -1.487469632520682E9 37494213942760235.318 2022-03-29 2022-07-02T11:19:41 2022-07-14 222.252.244.150 at_non@Feedbug.biz Division Parkway 27
+2022-02-07T15:19:07 -2147474201 49303092715634273.638 false -39 -17552 22077 819770754 3815.9624 -3.07788874880729E8 22473676566411893.142 2022-02-17 2022-07-22T02:13:31 2022-07-02 176.107.188.43 ipsa@Photobug.org Algoma Center 6
+2022-11-04T19:40:54 -2147468104 27727896561928356.763 false 82 28127 -16794 953496574 -2973.964 1.538181391859708E9 55664064661456781.100 2022-07-30 2022-04-25T14:47:28 2022-12-25 93.64.145.202 SarahOliver@Topicblab.net Shopko Alley 97
+2022-09-02T05:05:13 -2147464684 52641288250964188.795 false 114 -15050 4397 1467965089 24381.705 -6.7825676777073E7 89275295308566490.932 2022-11-01 2022-06-23T04:06:05 2022-09-30 30.43.252.68 lDiaz@Kwideo.info Quincy Road 30
+2022-06-20T17:19:49 -2147452176 42963905746019101.945 false -85 -5897 -29349 1525786458 13439.43 1.580339430307399E9 4315552136410587.989 2022-01-19 2022-01-30T20:58:15 2023-01-02 204.35.13.187 DonaldOwens@Gabvine.com Continental Crossing 89
+2022-05-02T20:24:54 -2147449203 26373576153379339.703 false 100 5626 10817 -1071291634 -32229.045 -3.63129015178875E8 12284411005290507.833 2022-11-01 2022-05-13T23:57:47 2022-06-29 142.56.17.46 9Price@Fliptune.net Monument Hill 80
+2022-12-12T15:38:03 -2147447412 11774006348685852.217 false -128 -12502 18730 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 2022-06-13 2022-06-08T00:10:42 2022-01-19 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+2022-09-09T18:14:23 -2147445583 48715652698659874.382 false -106 -18847 28383 -249047381 -25610.389 -1.172353483917956E9 29809461999773154.513 2022-10-04 2022-03-22T06:00:02 2022-11-08 86.232.2.134 odio_distinctio@Einti.com Mallory Place 2
+2022-09-11T03:05:51 -2147440231 34028908311454481.592 false -98 3388 -7469 -520983933 10625.003 2.03995201402268E9 3462857055462597.650 2022-01-26 2022-11-01T00:41:21 2022-08-16 129.54.117.50 amet_ea@Quimba.name Butternut Alley 71
+2022-03-04T17:56:58 -2147429509 89258793731621871.659 false 126 26815 -11284 -688010171 27046.46 -5.27072353971484E8 66247237013637477.644 2022-10-01 2022-09-08T08:07:23 2022-07-21 8.115.159.161 AnthonyGriffin@Katz.edu Fordem Plaza 6
+2022-12-02T03:44:10 -2147429313 61886285781136168.806 false 110 23694 10888 2044460430 15311.488 1.375307496401204E9 53151235042978489.270 2022-08-11 2022-10-20T13:09:41 2022-05-13 193.174.176.52 JoyceChavez@Eayo.com Bay Place 92
+2022-01-24T23:50:40 -2147426673 89764720990212770.220 false 14 -1228 32445 -1925449184 32501.54 -2.39912871351486E8 55348475727816727.866 2022-12-10 2022-01-16T21:35:19 2022-04-12 18.231.153.73 8Clark@Kare.info Manley Place 39
+2022-02-27T06:18:59 -2147394395 14678495134516321.939 false 26 -30748 7400 1258683172 -27487.441 4.33082826182803E8 45348180393347858.264 2022-04-09 2022-10-04T18:07:27 2022-04-13 144.218.112.167 BrandonHart@Gigabox.gov Lakewood Hill 77
+2022-10-15T02:27:14 -2147383849 57756485700967354.947 false 52 2101 27388 -511873914 13334.803 1.406773860292186E9 93516878967509776.434 2022-06-04 2022-05-10T05:58:30 2022-04-10 151.25.124.55 bGutierrez@Realcube.gov Bultman Pass 95
+2022-09-12T03:34:38 -2147383439 29228393040815920.274 false -67 -11231 -2125 -1738258888 28451.842 -4.49988538175004E8 28398963940839059.717 2022-12-01 2022-06-16T08:26:30 2022-03-19 140.243.38.93 rBell@Youbridge.info Dovetail Terrace 51
+2022-06-16T12:08:56 -2147369442 95280790050572342.278 false -24 -21797 -23643 -789601264 -29951.023 -1.094422939727163E9 83680832437281060.324 2022-12-30 2022-10-09T06:30:35 2022-06-23 65.65.41.22 NicoleBlack@Vitz.com Marcy Avenue 83
+2022-09-14T05:20:55 -2147360972 34160135921220642.561 false -70 -29980 14978 -1782596577 22961.69 -1.458730846514128E9 71947137678798367.780 2022-05-02 2022-12-28T23:38:41 2022-12-10 192.115.131.183 quaerat_rem@Voolia.gov Sachtjen Road 56
+2022-08-07T09:34:26 -2147356155 10694832387001448.166 false -99 -31982 15642 2037570311 -28052.602 -1.251616108720754E9 56934260571029675.510 2022-12-23 2022-09-02T08:08:49 2022-05-30 156.238.169.183 animi_quidem@Eidel.net Springview Plaza 31
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_desc.out
new file mode 100644
index 0000000000..aaecccdeef
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q01_bool_desc --
+2022-01-28T07:05:42 2147473376 45825484466840064.118 true -23 -15598 -10213 -794130865 25225.979 -1.060667482169878E9 19712527510160101.667 2022-08-23 2022-09-07T09:37:41 2022-06-06 199.195.172.243 BenjaminGreene@Devify.org Hoffman Road 93
+2022-10-26T15:14:11 2147467668 17196762472988513.310 true -5 28431 -17708 -947082776 26115.467 -1.064859020746046E9 12851908920109725.570 2022-12-17 2022-11-09T06:13:10 2022-05-22 14.249.104.252 qMarshall@Yamia.mil Schurz Junction 33
+2022-05-18T22:01:25 2147447138 50480005137427111.177 true 28 16452 -30571 -2075189185 22385.588 -3.55214861990496E8 11932816216934343.652 2022-08-23 2022-10-21T03:38:58 2022-10-21 234.3.203.12 CarlMurphy@Wikivu.biz Northport Way 26
+2022-07-11T06:10:41 2147446227 39942552524190612.962 true -65 -22474 14929 1989464327 9511.273 5.86654785560309E8 79596075449045726.816 2022-11-07 2022-06-21T12:58:35 2022-11-24 19.107.68.34 tSanders@Jaxnation.biz Farragut Point 44
+2022-06-13T04:42:29 2147444078 80627252554457775.754 true 91 -17156 8627 1521831153 11225.079 2.09693779861494E8 8183865884308683.425 2022-11-08 2022-04-03T00:29:22 2022-03-20 233.68.240.228 3Martinez@Browsedrive.info Donald Crossing 7
+2022-07-10T04:17:41 2147434485 1432088841386171.665 true 28 22783 -31955 -940172357 12963.05 -1.015348724865612E9 21415159800393256.390 2022-09-01 2022-09-17T21:00:35 2022-04-11 234.6.225.52 MelissaHenry@Realpoint.biz Bultman Court 97
+2022-03-26T23:37:01 2147432357 56924709102413625.675 true -111 24610 -30943 -1776521623 -7130.226 -5.00592536993921E8 16271114464316416.681 2022-03-24 2022-01-23T12:31:45 2022-05-28 58.48.43.183 ChrisJacobs@Buzzster.name Leroy Pass 32
+2022-08-24T06:52:46 2147425822 33378418596041889.584 true -17 -3026 29468 -1873981318 25636.371 6.43280347073812E8 90354184407027392.172 2022-06-28 2022-02-24T12:47:51 2022-10-15 97.226.248.251 qRussell@Cogilith.name Kings Place 83
+2022-05-04T22:35:17 2147425482 6517881695345385.105 true -1 -17372 20231 635029396 -19429.021 6.56125881323546E8 7165704130056347.115 2022-06-13 2022-12-05T18:10:15 2022-12-05 243.50.186.81 ErnestFlores@Thoughtbridge.com Dixon Court 53
+2022-07-05T21:37:51 2147419311 28290293258808439.134 true 26 16950 8811 1233278399 -103.00702 1.520246238447387E9 88652736846204706.947 2022-03-10 2022-08-07T15:58:44 2022-05-23 133.108.194.1 DeniseRamos@Shufflebeat.net Mifflin Junction 55
+2022-08-09T07:43:48 2147375954 28228200342554508.463 true 15 -29566 3184 1446182442 27525.846 -1.443946518312972E9 17957789229933477.747 2022-10-04 2022-01-26T03:41:36 2022-11-04 119.180.253.71 beatae@Gigazoom.mil Warbler Center 96
+2022-05-28T17:02:01 2147373423 1637907410895731.258 true -96 10681 20459 1339500570 -11608.654 -3.93375885580383E8 36042489765482544.378 2022-03-13 2022-03-12T22:06:49 2022-02-06 44.122.107.86 JaneMorgan@Meembee.gov Washington Plaza 39
+2022-07-06T16:00:59 2147368042 29068106840796910.714 true 27 -13477 11315 231988388 18722.197 7.36279137148427E8 9745163628451074.185 2022-11-23 2022-08-02T08:01:28 2022-06-14 135.125.99.160 vLittle@Lajo.com Weeping Birch Plaza 51
+2022-01-28T17:36:34 2147361419 66235090663479853.137 true -51 15176 -9717 281926529 -28998.344 1.014652450168952E9 64008372108259969.509 2022-01-14 2022-01-16T14:56:11 2022-03-01 25.158.126.209 LauraCrawford@Rooxo.mil Muir Circle 73
+2022-01-18T01:55:01 2147361117 1344175823772476.813 true -66 3884 -6259 942799387 -31530.1 9.7573614242114E7 79407496412683634.664 2022-01-20 2022-10-12T06:08:47 2022-07-14 9.97.60.8 0Brooks@Avamba.info Golden Leaf Pass 69
+2022-10-27T20:30:25 2147356019 92590184406014430.471 true 36 11194 12156 -436138908 -28744.945 4.20634527634209E8 4496968200996145.117 2022-12-16 2022-08-12T22:39:19 2022-04-03 7.109.111.0 non_et@Vitz.info Gerald Alley 31
+2022-07-30T21:15:19 2147355776 7961742472373102.406 true -19 27852 21157 -1872018283 26782.947 1.38643630286072E8 29573321742106989.137 2022-06-08 2022-06-12T19:28:07 2022-10-19 246.25.242.131 3Gardner@Flashspan.edu International Terrace 11
+2022-11-26T19:49:17 2147352335 80764280990878997.426 true 2 -29308 29440 921017929 11988.182 8.24736685451722E8 9835279556807483.866 2022-04-25 2022-06-27T00:38:47 2022-07-19 125.250.128.104 gCarter@Vimbo.mil Butternut Pass 36
+2023-01-03T05:22:23 2147349942 84133377525592228.154 true 31 5348 12735 1083196085 -11532.327 -5.88257975589088E8 16614091336559109.461 2022-02-18 2022-01-22T00:13:52 2022-12-22 150.74.85.3 ChrisGibson@Plajo.biz Brentwood Road 76
+2022-11-28T17:14:43 2147325698 9725750329249688.208 true 65 -13772 14606 -1653013708 10253.94 -1.966317816086957E9 53022579230034648.990 2022-12-04 2022-11-01T04:09:20 2022-02-23 241.217.119.108 dolore_dolore_minima@Babblestorm.info Division Junction 1
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_asc.out
new file mode 100644
index 0000000000..ac3f2a9609
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q02_tinyint_asc --
+2022-12-12T15:38:03 -2147447412 11774006348685852.217 false -128 -12502 18730 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 2022-06-13 2022-06-08T00:10:42 2022-01-19 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+2022-04-24T22:05:46 -2146517454 36311076627234901.358 true -128 -22452 -14112 2016812833 24896.398 4.06916902991652E8 42981217181930845.261 2022-08-29 2022-04-25T13:41:59 2022-08-06 140.151.153.118 eum_et@Voolith.name Nelson Court 46
+2022-12-07T02:49:40 -2146383485 68235552816386779.452 true -128 -11548 -29603 -634395390 -7073.377 -7.68698044932161E8 4477021624885860.622 2022-02-07 2022-04-14T02:32:34 2022-04-01 68.237.107.196 FrancesMurphy@Devpulse.net Sunbrook Place 35
+2022-12-24T14:42:35 -2146302732 79346435402101036.467 false -128 149 31577 -1844257832 -3185.0405 2.96757621404148E8 87013852077324124.120 2022-06-08 2022-03-27T07:02:24 2022-10-27 138.41.52.222 HeatherHughes@Fiveclub.mil Canary Hill 71
+2022-10-14T00:03:27 -2146230291 517350648331859.492 false -128 -772 28354 -851990365 -3025.3677 8.914648206465E8 88767996189732717.439 2022-12-03 2022-02-03T11:15:21 2022-09-24 204.159.146.7 3Castillo@Voomm.name Butterfield Crossing 58
+2022-02-27T01:18:43 -2145242920 36121188588273373.792 true -128 20305 7765 -1406700789 28185.135 1.011412369524311E9 70890772755517481.741 2022-05-26 2022-08-28T00:15 2022-09-09 170.118.120.118 error_quod@Omba.net Acker Crossing 89
+2022-11-13T04:26:03 -2145042412 40720927210509700.191 true -128 -20704 13443 -1612284457 11655.705 -6.74023449159679E8 93066083013275096.593 2022-07-24 2022-11-03T12:43:02 2022-11-20 122.205.223.77 necessitatibus_dolores_occaecati@Buzzdog.biz Oxford Junction 82
+2022-07-02T07:37:49 -2143600625 77711255526118300.368 true -128 18771 -13026 -1470090009 25352.48 7.7020202702841E8 89861418696597024.483 2022-10-06 2022-08-14T04:40:05 2022-12-21 119.129.178.24 RalphBurns@Gabcube.name Chinook Court 92
+2022-09-20T14:03:04 -2142870012 62010864745188472.197 true -128 -1261 19837 537699650 821.9667 1.746494221685806E9 70002709673606159.105 2022-08-07 2022-10-21T21:02:25 2022-05-20 179.5.49.90 GaryGray@Jetpulse.edu Prairieview Avenue 47
+2022-01-24T13:44:04 -2141311933 77413615069452766.268 false -128 19118 19844 921662575 -30874.328 -1.224064709848546E9 4675428570248306.858 2022-03-09 2022-09-13T07:44:14 2022-04-12 156.137.202.188 fRyan@Meembee.info Manley Hill 20
+2022-02-23T09:24:34 -2141063827 39689077505421124.774 false -128 -4462 25348 729060759 -31897.695 1.316675872124587E9 20498623232495251.952 2022-09-04 2022-05-31T04:25:17 2022-03-29 56.20.87.143 bSchmidt@Bubblemix.name Florence Alley 28
+2022-08-23T09:13:13 -2140912431 24445083223357943.966 false -128 -2686 14641 -694682404 -31831.951 1.62533515482917E9 31642914907686595.842 2022-04-06 2022-02-12T04:03:02 2022-12-15 179.84.233.58 AaronHernandez@Edgeblab.biz Sugar Way 75
+2022-02-25T06:06:04 -2139719603 34020993937610437.535 true -128 3009 20609 -435886806 -21041.531 -1.41310418994296E8 35427782671909779.468 2022-02-28 2022-04-21T15:47:53 2022-12-24 139.122.157.188 VictorJacobs@Meezzy.com Oneill Junction 43
+2022-03-26T15:48:26 -2138931467 52391890161369595.151 false -128 -18390 23767 -262837238 -22577.486 -1.490521422086689E9 97704075077274232.100 2022-07-07 2022-10-14T09:57:51 2022-06-05 176.70.158.217 cTucker@Avaveo.biz Park Meadow Park 68
+2022-02-06T04:17:35 -2137048270 18645616274997858.913 false -128 -11578 -7374 -909723995 2713.552 9.34755336010703E8 32227498333012689.836 2022-07-10 2022-07-18T16:03:06 2022-07-11 249.62.70.159 dSanchez@Innojam.info Sauthoff Plaza 86
+2022-03-07T07:50:29 -2133385864 77263944859469027.463 true -128 -30898 -18992 -1384734562 26367.035 -1.7441791444587E7 1620225450243695.193 2022-03-17 2022-05-13T21:30:33 2022-07-07 43.4.221.31 excepturi_quisquam@Babbleopia.biz Melby Drive 18
+2022-12-02T11:09:29 -2131124298 58016775974959372.644 false -128 11302 -17011 -1520545869 28195.58 -1.267177164917066E9 9268277470355006.598 2022-06-08 2022-12-02T04:01:27 2022-07-27 245.220.83.56 voluptas_eos_quia@Livetube.net Mifflin Plaza 23
+2022-12-14T09:48:35 -2130128972 71953147938406859.267 false -128 -16295 28847 -1477634 27222.605 -2.50371264958583E8 34751068014238389.637 2022-09-15 2022-11-19T18:38:25 2022-06-20 113.163.2.198 EugeneBrooks@Browsedrive.edu Dapin Street 87
+2022-06-29T16:54:51 -2130037027 88593476121695838.846 true -128 9305 27545 -2031448951 -17447.258 -1.183373898413665E9 23881983327618442.587 2022-12-24 2022-09-04T00:12:15 2022-12-31 204.83.18.163 AnnieTorres@Centimia.mil Fremont Pass 1
+2022-04-01T23:24:17 -2129826379 24176223511074859.400 false -128 30476 7571 -678483885 22552.55 2.085865685457981E9 6544553689920437.248 2022-01-31 2022-04-17T08:58:46 2022-03-14 126.137.222.175 facere_possimus@Eidel.edu Service Circle 91
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_desc.out
new file mode 100644
index 0000000000..9389dcb311
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q02_tinyint_desc --
+2022-09-12T11:47:54 2147067132 52955030802767286.752 true 127 4967 11609 -1399650990 -29449.205 -1.62998021558943E8 12940444810371045.566 2022-10-07 2022-06-17T14:22:24 2022-10-11 102.164.240.244 HaroldGriffin@Thoughtstorm.com Memorial Terrace 67
+2022-10-13T01:07:24 2146616991 7881710570035405.645 false 127 -8310 -9628 -1045940332 -9868.593 1.570376206014117E9 29862310132486517.984 2022-04-27 2022-01-26T15:22:21 2022-11-06 252.44.56.210 dolore_ipsam@Cogibox.name Kenwood Court 17
+2022-10-09T12:50:32 2146539105 48546657665862541.114 true 127 -23802 -15504 1920811802 23855.672 -6.7041068215823E7 25606948646015411.717 2022-03-27 2023-01-09T10:38:45 2022-02-25 164.8.208.66 EugeneGeorge@Yadel.info Russell Junction 49
+2022-09-05T12:35:15 2146288022 94206548442916014.435 true 127 -23754 20466 -1565751463 14044.293 -2.045105873679679E9 41258855366086887.670 2022-08-24 2022-02-05T17:22:14 2022-09-24 101.221.40.1 GaryFields@Oyoba.mil Pawling Road 71
+2022-10-27T05:42:51 2146282810 16587476823913378.895 false 127 12125 13339 2144421638 17975.88 -1.912929853100911E9 56863526261225533.488 2022-06-10 2022-07-03T14:45:55 2023-01-04 180.188.87.76 HowardHernandez@Rooxo.biz Southridge Center 12
+2022-07-18T11:27:11 2146034217 36405916908128864.366 true 127 24781 -9222 -1212067295 26735.014 7.5911512329467E7 17070022842490123.148 2022-06-23 2022-03-13T19:32:04 2022-01-11 80.112.172.234 5Willis@Trudeo.gov Pawling Alley 70
+2022-11-12T04:03:03 2144971954 81541079225570430.860 true 127 -23152 1281 74566817 2629.9456 9.11553052098868E8 32978858990532311.500 2022-02-19 2022-12-21T07:52:55 2022-12-31 199.239.239.245 ShawnCunningham@Edgeify.biz Pond Parkway 14
+2022-09-24T08:14:42 2142982526 96528647242192769.710 true 127 25971 -32041 -1473310209 -31937.684 -2.066106047153405E9 28025089093469027.810 2022-09-16 2022-04-12T16:38:54 2022-08-18 46.151.35.20 illum_autem@Photospace.mil Pennsylvania Alley 4
+2022-06-23T05:40:32 2141608036 52618762564347867.369 false 127 13993 1464 420468240 -6237.7544 -1.3893797190184E8 94298643645110404.749 2022-12-05 2023-01-08T12:28:46 2022-04-12 223.96.180.107 rMorales@Realpoint.info Maple Parkway 70
+2022-09-07T22:29:59 2141468385 83403386069815682.239 false 127 -27414 28878 2017251881 -25077.691 1.59341412858189E9 62561054747145086.239 2022-09-26 2022-09-21T08:30:32 2022-12-29 15.225.104.165 KathleenDixon@Thoughtworks.biz Truax Way 37
+2022-03-09T21:11:15 2139414696 55270957107015844.569 true 127 3426 -17915 -7938806 22177.371 1.957310526612257E9 61811486828069184.807 2022-08-14 2022-06-03T03:12:25 2022-07-02 146.212.91.113 minima@Fadeo.name Graedel Trail 17
+2022-09-24T13:46:08 2139269475 32941261583844339.834 false 127 25889 -18628 -900521062 17133.07 -2.128282228949938E9 18133239196112731.325 2022-11-21 2022-11-20T20:12:42 2022-10-20 14.108.137.209 6Harrison@Eire.name Bluejay Trail 46
+2022-07-18T23:51:34 2138414995 80121675104398429.440 true 127 -11553 18672 371595905 -21799.115 7.41315579318121E8 3981673451938226.659 2022-09-05 2022-06-19T20:09:40 2022-04-25 131.231.149.73 et_ut_quo@Eidel.org Starling Court 32
+2022-09-04T14:19:02 2138277710 56389933193020366.845 false 127 15802 -8735 550097059 7686.7285 6.26661332666768E8 95797220270167390.846 2022-11-20 2022-12-07T17:46:43 2022-04-07 155.146.230.211 CarlosCarpenter@Ozu.biz Barby Court 11
+2022-02-02T12:50:51 2138245427 66405514090062978.699 false 127 -9580 12555 -489666078 -9201.424 -9.33785719496523E8 41716831478894306.408 2022-09-05 2022-06-20T09:36:33 2022-10-24 193.103.46.78 1Henry@Edgepulse.net Schlimgen Avenue 24
+2022-03-01T13:23:21 2137510590 80342039923187416.806 false 127 -32046 25676 119627160 -4462.3394 1.497579302954467E9 98344974016851549.825 2022-03-15 2022-09-19T00:34:47 2022-06-25 26.56.35.92 tBoyd@Rhybox.net Dwight Street 96
+2022-02-07T22:45:39 2137094268 31182921503667828.398 false 127 -14814 11699 -304553362 21947.398 -1.39028562355098E9 47028155576424101.208 2022-05-24 2022-11-28T13:51:06 2022-01-11 92.179.166.80 MargaretCooper@Meemm.gov Oak Point 56
+2022-05-19T03:03:26 2136672917 3926011027229543.660 false 127 -9703 -19183 -1216951175 -20778.127 6.81057487643244E8 76001639232703921.350 2022-11-02 2022-12-05T22:08:49 2022-03-02 20.142.229.220 eligendi@Twiyo.com Southridge Court 85
+2022-03-16T23:42 2136647169 90405154064863253.406 true 127 3775 17404 358534230 19361.938 1.140613254765717E9 10234364020739859.302 2022-12-18 2022-05-03T14:28:15 2022-12-08 116.97.128.59 zCole@Trilia.name Continental Terrace 23
+2022-10-21T07:22:35 2135014707 75730450425528137.800 false 127 25724 -9662 1824856223 31940.584 9.24879496113318E8 42669376082239422.968 2022-10-27 2022-06-24T13:56:05 2022-11-07 21.253.217.6 VirginiaJames@Oba.edu Moland Court 56
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_asc.out
new file mode 100644
index 0000000000..2bc49ac3ea
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q03_smallint_asc --
+2022-11-11T18:36:07 -2119181910 94635764902337719.587 false 9 -32768 -21447 -397700359 8544.816 8.42565878027755E8 4094297227123464.119 2022-10-30 2022-03-03T18:49:12 2022-07-28 89.85.158.113 expedita@Dabvine.org Schurz Point 86
+2022-05-29T08:39:24 -1772659910 21736833643914977.474 false 90 -32768 -18778 -1538078533 32518.29 1.839297758005148E9 8025233121771129.982 2022-07-26 2022-05-09T08:39:41 2022-08-01 121.249.9.41 yHanson@LiveZ.gov Arizona Road 39
+2022-05-04T20:07:58 -1666166714 3962173432088222.445 false 71 -32768 4632 1883461151 -30630.502 -8.5079006807073E8 53571183342198399.700 2022-05-05 2022-12-14T16:47:29 2022-10-28 232.16.80.219 est@Skyble.biz Oak Valley Point 2
+2022-08-05T18:03:44 -894847791 79816115052757123.810 true -3 -32768 28801 1255173066 202.17188 -1.474409948411377E9 3158312006873245.853 2022-04-16 2022-04-03T22:46:48 2022-11-25 126.55.0.220 8Kennedy@Fanoodle.name Southridge Hill 60
+2022-07-23T19:06:36 -612930133 47014660443866476.232 true -61 -32768 -22666 -1178658838 -28884.086 1.11103948397087E8 80042788253782204.498 2022-04-20 2022-03-01T22:23:27 2022-09-19 22.192.94.124 MildredRobinson@Devshare.edu Westport Pass 49
+2022-02-27T11:08:01 -573443804 88074988987401774.411 false -115 -32768 11929 -2016424421 29634.79 -2.18478165703325E8 12703696687710822.643 2022-08-15 2022-09-04T12:01:35 2022-10-01 84.50.196.143 autem_tempora_est@Browsetype.name Saint Paul Way 89
+2022-09-22T13:11:04 -561278478 74730986624403222.314 false -69 -32768 -16693 -759611463 21118.123 1.667026581303165E9 2956123704992284.781 2023-01-05 2022-02-27T11:59:07 2022-10-14 167.22.70.149 sJohnson@Bubbletube.name Summit Center 21
+2022-03-19T23:50:29 -375081698 47131568808788018.212 true 66 -32768 20928 -745557940 -18539.678 -1.40295670471318E9 97736016154408847.117 2022-08-19 2022-11-19T22:31:35 2022-12-19 223.197.134.245 MarilynMitchell@Gevee.info North Park 58
+2022-03-17T02:46:27 145301727 68906855503494742.331 false -101 -32768 -13729 778326569 -21269.486 1.604892898933131E9 20775250579937603.453 2022-01-18 2022-08-26T02:15:34 2022-07-12 15.126.62.157 8Ryan@Buzzshare.org Southridge Crossing 57
+2022-12-04T12:03:05 379694752 21184279894375388.370 true -51 -32768 -21837 953289513 1709.1425 9.43268787230081E8 15994775827042591.220 2022-08-08 2022-02-22T12:42:20 2022-03-19 166.24.100.153 xPrice@Eire.mil Scott Avenue 24
+2022-05-24T00:51:56 393425067 64456854851162701.200 false 63 -32768 -32408 -1635483986 -28936.332 -1.085881992618776E9 36803042446327799.658 2022-09-07 2022-03-25T23:19:36 2022-02-22 58.107.119.127 RebeccaEdwards@Browsecat.com Northwestern Alley 6
+2022-03-27T16:04:51 830069116 57613139135938777.187 true 126 -32768 -10729 2103092395 29968.945 1.639990989663357E9 59005793503222374.208 2022-05-10 2022-09-09T07:30:25 2022-02-07 112.14.223.193 tDaniels@Kazio.mil American Alley 35
+2022-11-10T21:43:27 1140193466 82831592007803346.142 true -121 -32768 14986 -1219445196 -29587.404 -5.32522576898622E8 76851400354416509.617 2022-10-21 2022-07-28T19:01:49 2022-03-30 187.21.28.160 1Green@Thoughtsphere.info Manitowish Parkway 21
+2022-04-08T23:28:30 1193667351 70550050881757088.893 true -110 -32768 -29595 -1191722621 -28450.025 1.807240652717508E9 89756525150809703.472 2022-05-08 2022-05-10T18:22:23 2022-01-28 238.187.41.156 sWheeler@Brainlounge.net Chive Park 49
+2022-06-05T02:25:39 1278185126 59887577210052257.857 true -93 -32768 23276 819897081 -27640.775 -1.343836015081554E9 1325037666391987.251 2022-09-12 2022-04-14T01:33:59 2022-03-28 60.161.98.109 RaymondLewis@Skibox.mil Pankratz Drive 84
+2022-07-06T12:06:05 1504265399 79531626414884406.312 false -6 -32768 9477 -205821866 -5769.2314 -8.26175747976332E8 6993548111617615.667 2022-08-10 2022-09-09T18:30:35 2022-04-30 68.51.54.193 wHenry@Aimbo.edu Veith Center 45
+2022-08-29T19:24:26 1544459161 75707175342781346.106 false -13 -32768 21957 -1773993625 18035.14 -1.030924547303447E9 92724336835089908.357 2022-04-10 2022-06-07T18:20:13 2022-05-27 208.148.214.190 maxime_quidem@Shuffletag.info Express Trail 61
+2022-03-29T02:05:08 1663741632 70464541385762238.753 false 53 -32768 1239 -1893520603 14750.256 1.411475653420637E9 4567372818900016.238 2022-08-06 2022-06-06T09:28:37 2023-01-05 36.64.144.72 AaronWest@Dynazzy.edu Jenna Hill 75
+2022-05-11T20:00:03 1858358065 22960893441577020.907 false 92 -32768 27889 -1689270915 17365.418 -2.035031502327624E9 68912075638025607.120 2022-08-11 2022-01-20T21:32:33 2023-01-08 169.187.30.86 PhyllisHoward@Oyoba.com Cherokee Alley 50
+2022-07-08T09:53:55 1884553032 23729748825156743.750 false 106 -32768 -6025 -200563489 30379.486 1.336059195210369E9 32158999009020847.504 2022-07-25 2022-07-12T05:55:10 2022-07-31 118.64.20.102 zCarr@Skalith.com Caliangt Way 64
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_desc.out
new file mode 100644
index 0000000000..bc26424b46
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q03_smallint_desc --
+2022-12-03T04:12:36 1678560897 78263512868717237.334 false 87 32767 21441 1556232486 9959.018 1.560810265595625E9 53367707717244888.172 2022-10-14 2022-05-30T15:56:43 2022-09-13 61.118.67.174 fHernandez@Gigazoom.net Harbort Plaza 74
+2022-09-01T10:32:27 1516239965 54004301963415238.688 false -103 32767 -32345 -1959086052 -9526.442 1.368417829727535E9 59529746584863408.273 2022-03-18 2022-03-17T21:04:28 2022-11-27 112.9.110.220 sapiente_et@Wordtune.com Del Mar Alley 14
+2022-10-04T15:45:06 1444824980 23715281033213564.754 false -60 32767 -13200 1953979294 -13759.598 4.36756893815203E8 74289852103116884.548 2022-11-30 2022-12-08T16:19:44 2022-04-08 177.5.37.239 JoanWard@Jaloo.org Hudson Drive 72
+2022-04-25T13:05:07 1215121536 78115061843119221.123 false -39 32767 26516 -1500040018 18335.352 1.316773570462298E9 23999652729376863.467 2022-04-28 2022-03-20T09:23:07 2023-01-05 69.61.76.149 yHoward@Bluezoom.org Dunning Junction 81
+2022-08-14T13:26:56 849037708 31486374249394627.990 true -75 32767 -17558 587123427 -4247.6797 2.14502216256895E9 64375063060958299.247 2022-02-14 2022-07-27T20:09:32 2022-05-26 4.135.73.142 ut_dicta_reiciendis@Kaymbo.org Tony Terrace 18
+2022-06-16T06:04:54 676346698 64406411256628519.146 true -120 32767 13260 410411161 -5488.7783 2.142165802160835E9 15442903026737808.173 2022-12-09 2022-06-10T13:10:41 2022-11-20 3.240.90.12 sint@Topicstorm.mil Ryan Crossing 40
+2022-01-29T12:08:27 270262401 73421324604106832.546 true -46 32767 24735 -906217398 12946.995 5.41332101656695E8 97295895998092890.998 2022-04-22 2022-05-15T14:03:58 2022-09-11 153.23.200.191 ut_quod_at@Cogilith.info Macpherson Street 42
+2022-12-20T08:33:10 -453799527 1609414000539010.600 true 29 32767 20152 -944621837 -10862.854 2.1202667278816E7 38553894693583118.368 2022-09-09 2022-12-20T21:20:42 2022-04-11 153.12.224.226 CarolynMitchell@Ailane.edu Fordem Terrace 17
+2022-06-06T13:59:23 -485021625 65215899088499149.343 true -36 32767 110 1326710722 -15452.647 1.712244760219285E9 54985116338987826.693 2022-07-20 2022-04-01T23:42:43 2022-05-19 72.62.79.250 bFrazier@Blogtag.info Raven Place 15
+2022-07-17T06:31:17 -764873455 12937614675175936.291 false 53 32767 -29442 1072161671 28272.633 -1.984372369420127E9 36404274389736129.849 2022-11-25 2022-02-08T07:54:49 2022-09-18 161.155.111.69 facilis_voluptates@Youtags.name Almo Crossing 53
+2022-03-09T17:02:55 -1541436852 47783666261750053.846 true 38 32767 22638 244031682 31381.406 -1.24899826345357E8 80101741223666579.290 2022-01-27 2022-05-31T14:28:14 2022-06-18 245.151.64.68 5Duncan@Riffwire.info Loomis Park 59
+2022-09-24T13:30:50 -1843658789 21382968659216707.283 false 92 32767 16634 -1709129926 -29226.172 2.54394965271565E8 13439705918528964.604 2022-06-17 2022-05-13T21:20:39 2022-10-05 81.233.60.195 CherylBrooks@Kwideo.gov Manitowish Court 27
+2022-10-21T10:42:13 -1922279700 79171403893470668.461 false 40 32767 -8714 -1068042024 -31981.738 1.872934727916913E9 42784764695752210.645 2023-01-07 2022-06-02T23:27:58 2022-06-06 121.88.192.83 qui_aut_enim@Meejo.gov Logan Center 7
+2022-04-07T17:10:59 2047945442 35392804656997541.850 false -92 32766 20312 -973812323 -15728.488 -5.8402730971289E8 36805974594534434.619 2022-04-17 2022-04-16T07:09:32 2022-03-02 209.36.134.255 mBrown@Minyx.info Debra Terrace 19
+2022-02-08T21:03:59 1801338708 85359521530662573.619 false 64 32766 20369 -438205059 23985.758 -1.145449603692417E9 8285652611887586.485 2022-07-25 2022-07-16T22:58:45 2022-06-21 203.254.103.210 ArthurGonzalez@Realpoint.biz Oak Pass 68
+2022-04-01T02:26:38 1756277047 22565414784695921.250 true 78 32766 12887 190327578 22342.154 -5.98004048152577E8 7306868138616339.579 2022-02-13 2022-09-21T12:25:19 2022-10-05 188.143.228.103 exercitationem@Blogpad.edu Onsgard Junction 89
+2022-11-17T12:08:38 1519769949 61531324239017326.290 false 47 32766 -10929 1601858125 14056.325 1.532909781459057E9 74738228295173840.308 2022-12-02 2022-09-12T05:04:34 2022-06-05 43.114.219.1 StevenMitchell@Oozz.gov Miller Place 22
+2022-05-09T22:05:07 1115035313 666861267107.644 true 79 32766 9212 450171396 -1866.4689 7.77563839932363E8 90992477662136679.337 2022-12-13 2022-03-19T09:35:44 2023-01-02 218.227.189.124 suscipit@Trunyx.biz Sauthoff Hill 54
+2022-09-21T17:39:24 835121496 16261714214835321.379 true -53 32766 24600 1799461459 -7978.5894 1.61916308072381E9 49740940016941499.836 2022-05-29 2022-12-19T05:26:22 2022-05-05 192.12.165.182 JohnnyCole@Babbleblab.com Bunker Hill Avenue 47
+2022-04-24T14:01:52 693350452 58547572369398935.574 true 115 32766 -29000 1804011300 27503.322 1.541716030386427E9 38398874365459315.998 2022-08-12 2022-03-06T12:02:41 2022-07-29 29.234.237.236 TheresaThomas@Flipbug.biz Sachs Center 98
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_asc.out
new file mode 100644
index 0000000000..5f118b6c39
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q04_int_asc --
+2022-07-07T21:54:18 -2120733118 99987866980043755.800 true -58 21277 -32768 -1316677093 28088.38 1.115136612586051E9 2364850569062051.836 2022-04-18 2022-06-07T08:10:38 2022-05-11 84.210.182.140 laudantium_dolorem@DabZ.edu Sauthoff Road 1
+2022-07-07T21:05:36 -1903035708 79838626915225705.915 false 78 29 -32768 -517391953 -21292.13 1.336659715432206E9 82639136682635162.808 2022-11-26 2023-01-01T23:45:07 2022-03-18 23.39.113.132 ut@Brainlounge.net Brown Lane 73
+2022-12-01T13:00:03 -1502344793 7739319881715713.769 true -30 -13315 -32768 1035625019 -9074.537 -1.375730749351314E9 4509729191622434.232 2022-07-04 2022-02-21T23:54:51 2022-06-18 51.85.36.73 voluptas_et@Gigashots.info Village Place 54
+2022-04-02T13:59:42 -1249563481 25793286891144450.357 true -37 -18567 -32768 -209145436 20378.133 1.928345967460078E9 41432280276950618.638 2022-10-27 2022-01-30T04:30:56 2022-06-26 13.180.193.75 BenjaminSullivan@Yakidoo.com Anzinger Parkway 73
+2022-08-10T06:54:08 -1047509451 93870904411793291.772 true 27 -25069 -32768 -458727865 12787.854 1.023346475883571E9 35609833305491315.248 2022-05-27 2022-10-24T12:18:54 2022-08-22 100.74.206.16 dGreen@Zoozzy.org Upham Terrace 12
+2022-08-24T21:26:51 -1009584686 82997961698597105.800 true -94 -10973 -32768 -1247987750 -6420.7715 -1.154210842239973E9 427012722987017.972 2023-01-02 2022-05-24T06:40:37 2022-08-31 46.113.95.140 dolor_et@Dabtype.org Talmadge Terrace 93
+2022-06-27T08:58 -681728365 69518569749382164.510 true -9 6876 -32768 -1435371922 13394.644 7.34503660987504E8 52834354694219144.950 2022-03-12 2022-05-22T08:08:32 2022-07-08 133.88.101.209 hWatkins@Yodel.net Village Road 61
+2022-07-04T09:21:34 -407869610 44421550103074848.341 true 99 -6977 -32768 374288810 19392.492 1.3126169728449E8 71408716144006001.764 2022-01-24 2022-12-29T01:53:56 2022-11-06 238.188.218.213 nDay@Voonix.edu Norway Maple Lane 36
+2022-02-24T13:07:31 -129132199 29458096786879531.580 false -4 -20635 -32768 1033655858 21715.297 -7.54058346736829E8 95161363430606469.721 2022-02-04 2022-06-21T16:33:53 2022-10-24 248.169.15.230 lHall@Flashspan.gov Florence Trail 22
+2022-05-09T04:26:15 857697236 68028597663670515.123 false 28 28325 -32768 -47389999 -23293.6 1.275376606739085E9 3134649734681167.894 2022-09-01 2022-08-25T18:38:59 2022-09-17 171.107.129.4 TheresaGutierrez@Devify.biz Blaine Trail 90
+2022-10-18T20:45:15 1024239356 77200808830411345.553 false -5 20973 -32768 -954961445 10491.175 1.341381155702512E9 35911990125854291.712 2022-09-23 2022-12-23T22:00:22 2022-03-12 98.201.72.10 fDunn@Fivespan.org Coleman Crossing 67
+2022-06-05T10:30:30 1104090010 58796999828858368.722 false -10 12370 -32768 755194185 -16738.787 1.307386947167164E9 24312160338609669.522 2022-07-02 2022-11-01T03:38:28 2022-02-15 159.69.88.128 iure_nesciunt_voluptates@Dynabox.edu Larry Alley 39
+2022-03-09T02:48:28 1267495803 76819740367836335.444 false -60 -8694 -32768 -358529373 -6907.075 1.47274930258069E9 66847365669609031.157 2022-07-21 2022-05-20T01:41:24 2022-05-19 70.110.202.114 7Hernandez@Babbleblab.edu Twin Pines Place 55
+2022-06-12T19:01:56 1768680570 86304150812719249.660 false 23 12019 -32768 1037057674 -28341.41 -1.387592834682792E9 61999802022591109.158 2022-03-02 2022-02-24T07:00:46 2022-02-24 1.34.159.115 IrenePierce@Dablist.org Crescent Oaks Pass 99
+2022-02-14T20:41:46 2039358007 72249645328554877.980 false -41 8509 -32768 -1456067092 25266.559 2.030338532394684E9 78742588047728422.952 2022-05-16 2022-06-28T11:34:18 2022-01-12 59.81.108.106 consequuntur_inventore@Edgetag.name Glacier Hill Road 13
+2022-06-16T17:25:25 -1491663265 92341119506055736.630 true 35 23857 -32767 -1872209135 -23958.512 1.557031147242115E9 36680505639263456.400 2022-07-11 2022-02-05T00:08:30 2022-12-19 157.229.39.177 voluptas_earum_aut@Eayo.gov Waxwing Drive 31
+2022-08-21T05:56:17 -1207015343 1151857603920162.560 true 86 -10131 -32767 49692912 -28471.277 7.63516943282041E8 98104061235416014.815 2022-09-13 2022-08-31T09:00:17 2022-06-28 126.180.238.9 zJames@InnoZ.edu Cardinal Hill 16
+2022-02-16T16:05:29 -1145194166 52422077162919646.913 true -115 8257 -32767 1312281596 -27755.525 3.86726461334295E8 44099774217953217.896 2022-04-20 2022-11-18T17:04:17 2022-03-07 189.103.26.171 BrianRobinson@Quimm.net Lukken Park 58
+2022-12-05T13:53:27 -1129343965 12435233240700717.533 false -70 27672 -32767 438109108 5640.3486 -2.094277754194657E9 79632329522874968.103 2022-09-01 2022-08-31T14:08:30 2022-07-20 116.151.106.28 hDean@Twitterwire.name Northview Avenue 78
+2022-01-29T00:50:31 -1056246287 32792455115584086.957 true -5 -21700 -32767 682848989 -8755.646 3.8361190595868E7 73635997870057025.649 2022-03-12 2022-06-21T02:56:39 2022-07-12 150.75.99.137 LoriHernandez@Skipfire.org South Junction 91
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_desc.out
new file mode 100644
index 0000000000..9c9ff48814
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q04_int_desc --
+2022-08-10T12:50:03 1888116922 8768513323897507.592 false 89 20914 32767 1029418657 -17939.033 -1.903101775754356E9 99369207633318231.438 2022-12-27 2022-07-19T02:25:13 2022-10-17 118.14.237.254 architecto_consequatur_ratione@Plajo.com 6th Plaza 21
+2022-10-28T16:20:35 1753279192 26345129549082063.665 true -80 -27354 32767 1647985131 -6298.85 -1.0099842728928E8 73151402356517623.689 2022-07-06 2022-04-11T13:29:26 2022-10-14 17.135.232.84 LouisHill@Jabbersphere.edu 5th Crossing 77
+2022-07-09T08:42:19 696741380 88816479023759266.396 false 28 -810 32767 -503228152 -2033.0967 1.283612783887132E9 23560155062530607.449 2022-07-04 2022-01-16T01:51:12 2022-04-25 242.21.240.41 qui_molestias_sit@Twimm.edu School Way 39
+2022-04-29T14:52:37 538602653 80209164909064212.965 true 41 2824 32767 623318514 -90.34033 1.652544048058129E9 6278079706749755.145 2022-11-20 2022-04-28T16:31:42 2022-07-07 26.120.45.167 EdwardGilbert@Realpoint.edu Chinook Point 18
+2022-10-10T11:30:38 -43570738 33950598159842941.991 true -93 -22754 32767 228365884 -12285.596 1.072148305961583E9 40385648446590087.908 2022-10-17 2022-05-21T00:05:59 2022-12-02 180.210.2.61 vel_porro@Devcast.com Ridgeview Lane 29
+2022-12-15T08:25:51 -685985077 34867175910609485.940 false -46 15505 32767 1069243549 22190.662 1.465829004826134E9 94315647872734731.908 2022-07-05 2022-11-07T22:34:03 2022-03-17 164.89.83.128 3Peterson@Ozu.edu Sutteridge Hill 29
+2022-07-23T15:42:08 -693959934 3532747518626402.670 true 90 -27833 32767 402481406 -12022.679 3.20633431835798E8 13878558879578976.858 2022-01-31 2022-05-11T00:08:57 2022-04-20 105.178.67.122 adipisci@Meembee.edu Maple Junction 57
+2022-03-04T01:38:22 -1103551683 20765387673237390.730 false -95 -23968 32767 573511873 -4560.8164 -1.612783058153555E9 75476565259401372.959 2022-01-25 2022-12-07T07:56 2022-12-29 234.188.87.33 bRoss@Wikibox.name Forest Place 70
+2022-10-19T22:21:20 -1422824838 10273762521063911.978 true -33 23628 32767 1377740827 6697.8125 -3.20776843199587E8 87270405671531592.941 2022-03-01 2022-06-17T23:50:57 2022-07-11 87.210.226.137 AndrewRichards@Quatz.mil Magdeline Hill 2
+2022-12-25T19:18:30 -1800188877 56797235723096309.823 false 5 29573 32767 1250889188 3222.5032 7.59123194761978E8 38132941604652656.707 2022-11-30 2022-02-20T20:31:38 2022-03-06 81.3.160.15 CarolynMoreno@Twitterbeat.org Walton Park 0
+2022-04-03T00:16:30 -1881570490 90040616641745625.691 true -68 11611 32767 -832750635 15422.077 -1.008890733534576E9 61740717634381831.350 2022-09-11 2022-12-02T05:15:13 2022-02-26 37.77.240.236 ut@Realfire.info Southridge Crossing 2
+2022-11-04T23:13:59 -1961333255 82565493020808350.827 false 79 -32572 32767 -564816125 -19275.254 -8.56043163982228E8 31317454682606080.715 2022-03-01 2022-10-01T09:47:08 2022-08-20 128.227.27.151 ThomasPalmer@Skynoodle.mil Sunnyside Court 22
+2022-04-21T05:42:34 -1983542492 79069368837730231.108 true 37 -16507 32767 -2079663849 3108.9314 -7.02990221574151E8 95289208283784171.498 2022-09-04 2022-06-09T09:02:11 2022-03-24 199.138.101.12 magnam_odit@Mybuzz.org Lake View Park 87
+2022-10-05T19:18:01 -2052264650 78424390200285140.477 true 59 1764 32767 -1578947731 11197.878 1.40143850979203E8 56495401490046518.286 2022-11-11 2022-01-15T07:58:06 2022-04-02 71.247.208.219 oBanks@Kwideo.biz Heffernan Circle 14
+2022-05-13T00:48:07 -2112183148 27284911861750304.908 true 13 -14685 32767 -992170175 -8207.334 -1.667568460711954E9 39868154097191057.561 2022-09-03 2023-01-06T07:18:34 2022-09-26 68.254.153.214 wSanchez@Mydo.net Shasta Plaza 37
+2022-08-23T01:47:29 1733753204 46175547965371997.896 true 23 -21333 32766 -872139105 10232.654 7084307.228661 55581520919805163.310 2022-03-11 2022-03-25T15:33:56 2022-03-04 163.25.37.85 JaniceMendoza@Tagpad.biz Atwood Parkway 95
+2022-08-04T17:14:23 1453791862 77641367384062160.957 true 46 17496 32766 1556963309 -1303.7205 1.96424427370409E8 98209234373345503.606 2022-05-29 2022-12-06T12:21:05 2022-06-03 102.132.7.251 qui@Browsezoom.org Arrowood Lane 18
+2022-08-10T03:05:16 1246797667 71996802156521651.643 true 50 -31477 32766 -1808899886 -20132.887 -2.17433200722871E8 94532041589761841.578 2022-12-30 2022-08-16T00:43:25 2022-10-26 46.162.166.232 MartinCampbell@Realbuzz.org Blue Bill Park Drive 18
+2022-01-22T21:51:12 1092104347 22457349947009384.351 true -36 17554 32766 -1768138005 3526.0737 -1.092995250003986E9 19695739333265998.991 2022-10-25 2022-03-23T04:18:20 2022-05-26 181.78.226.237 2Barnes@Yakitri.name Claremont Drive 27
+2022-08-03T13:55:56 641788466 7328522000342647.719 false -50 8592 32766 1350609753 -18208.885 -6.40295431186389E8 33177060653065518.611 2022-07-08 2022-01-25T03:02:51 2022-09-14 199.182.62.95 nesciunt_ipsum@Skyble.info Maryland Parkway 8
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_asc.out
new file mode 100644
index 0000000000..f1401bb667
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q05_bigint_asc --
+2022-06-13T07:08:23 -2147483358 16697470310045199.514 false 0 21661 27910 50137345 -31890.162 2.5182778747432E8 8892361240908133.332 2022-03-29 2022-05-06T07:35:41 2022-02-20 86.198.4.14 tHarrison@Yotz.edu Ohio Terrace 97
+2022-07-16T17:14:43 -2147480317 10126355674710455.926 false -106 25720 2137 -1044710620 19297.592 -4.6721094672452E7 74446297684183183.297 2022-02-12 2022-02-10T22:47:34 2022-08-24 176.57.174.210 2Jacobs@Oloo.edu Sunfield Pass 74
+2022-05-02T04:24:15 -2147477545 41444040735473920.151 true -64 -5005 21145 -429303067 12734.948 -4.6851297091213E8 53125989849165374.107 2022-02-02 2022-03-05T11:14:22 2022-10-18 147.133.227.47 rem_explicabo@Yozio.org Brown Road 85
+2022-03-12T18:09:32 -2147474804 5170475614524523.563 false 81 -17173 20232 1094003829 -21709.188 -1.487469632520682E9 37494213942760235.318 2022-03-29 2022-07-02T11:19:41 2022-07-14 222.252.244.150 at_non@Feedbug.biz Division Parkway 27
+2022-02-07T15:19:07 -2147474201 49303092715634273.638 false -39 -17552 22077 819770754 3815.9624 -3.07788874880729E8 22473676566411893.142 2022-02-17 2022-07-22T02:13:31 2022-07-02 176.107.188.43 ipsa@Photobug.org Algoma Center 6
+2022-11-04T19:40:54 -2147468104 27727896561928356.763 false 82 28127 -16794 953496574 -2973.964 1.538181391859708E9 55664064661456781.100 2022-07-30 2022-04-25T14:47:28 2022-12-25 93.64.145.202 SarahOliver@Topicblab.net Shopko Alley 97
+2022-09-02T05:05:13 -2147464684 52641288250964188.795 false 114 -15050 4397 1467965089 24381.705 -6.7825676777073E7 89275295308566490.932 2022-11-01 2022-06-23T04:06:05 2022-09-30 30.43.252.68 lDiaz@Kwideo.info Quincy Road 30
+2022-01-12T10:31:19 -2147455527 29099557100349011.625 true 69 5585 4327 -285779226 -21540.486 1.835808603850457E9 54187873992172620.878 2022-11-15 2022-06-04T18:07:03 2022-03-06 251.57.239.161 KathrynGrant@Jatri.com Talmadge Terrace 31
+2022-06-20T17:19:49 -2147452176 42963905746019101.945 false -85 -5897 -29349 1525786458 13439.43 1.580339430307399E9 4315552136410587.989 2022-01-19 2022-01-30T20:58:15 2023-01-02 204.35.13.187 DonaldOwens@Gabvine.com Continental Crossing 89
+2022-07-28T16:57:11 -2147449255 78090412186437460.598 true -12 30216 -6175 -612488037 4770.788 3.41784111819403E8 66010364586901704.721 2022-05-05 2022-06-17T21:16:21 2022-07-30 116.207.187.0 zMartinez@Jabberstorm.net Pawling Terrace 74
+2022-05-02T20:24:54 -2147449203 26373576153379339.703 false 100 5626 10817 -1071291634 -32229.045 -3.63129015178875E8 12284411005290507.833 2022-11-01 2022-05-13T23:57:47 2022-06-29 142.56.17.46 9Price@Fliptune.net Monument Hill 80
+2022-01-28T08:36:26 -2147448019 67591684441602394.918 true -61 7766 22532 -609849098 -27249.846 9.29542497341581E8 39481914812189670.121 2022-08-16 2022-09-20T13:43:17 2022-12-10 108.177.1.120 maiores_possimus_dolores@Tagopia.name Mitchell Terrace 22
+2022-12-12T15:38:03 -2147447412 11774006348685852.217 false -128 -12502 18730 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 2022-06-13 2022-06-08T00:10:42 2022-01-19 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+2022-09-09T18:14:23 -2147445583 48715652698659874.382 false -106 -18847 28383 -249047381 -25610.389 -1.172353483917956E9 29809461999773154.513 2022-10-04 2022-03-22T06:00:02 2022-11-08 86.232.2.134 odio_distinctio@Einti.com Mallory Place 2
+2022-09-11T03:05:51 -2147440231 34028908311454481.592 false -98 3388 -7469 -520983933 10625.003 2.03995201402268E9 3462857055462597.650 2022-01-26 2022-11-01T00:41:21 2022-08-16 129.54.117.50 amet_ea@Quimba.name Butternut Alley 71
+2022-03-12T15:32:48 -2147436000 30763183670763392.566 true 38 29989 -15212 -2059345979 -15143.42 1.652582093181943E9 59619727495487524.575 2022-04-07 2022-12-26T02:46:25 2022-05-15 188.148.220.97 tenetur_cupiditate@Meemm.name Doe Crossing Avenue 8
+2022-03-04T17:56:58 -2147429509 89258793731621871.659 false 126 26815 -11284 -688010171 27046.46 -5.27072353971484E8 66247237013637477.644 2022-10-01 2022-09-08T08:07:23 2022-07-21 8.115.159.161 AnthonyGriffin@Katz.edu Fordem Plaza 6
+2022-12-02T03:44:10 -2147429313 61886285781136168.806 false 110 23694 10888 2044460430 15311.488 1.375307496401204E9 53151235042978489.270 2022-08-11 2022-10-20T13:09:41 2022-05-13 193.174.176.52 JoyceChavez@Eayo.com Bay Place 92
+2022-01-24T23:50:40 -2147426673 89764720990212770.220 false 14 -1228 32445 -1925449184 32501.54 -2.39912871351486E8 55348475727816727.866 2022-12-10 2022-01-16T21:35:19 2022-04-12 18.231.153.73 8Clark@Kare.info Manley Place 39
+2022-07-25T03:06:25 -2147421318 24287700579137232.797 true 105 6251 -6812 1436392860 11044.398 5.72113383114619E8 72488255457463303.173 2022-01-22 2022-07-02T17:44:40 2022-02-01 215.68.120.190 AmyKnight@Jatri.gov Morning Alley 47
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_desc.out
new file mode 100644
index 0000000000..fa11289019
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q05_bigint_desc --
+2022-11-06T20:45:23 2147476415 79015094907713747.951 false -107 5853 32354 1813108632 -31056.639 -1.124844835680021E9 40135874837185031.606 2022-02-21 2022-02-26T03:23:29 2022-02-17 97.85.179.247 BarbaraGonzales@Talane.net Logan Junction 65
+2022-01-28T07:05:42 2147473376 45825484466840064.118 true -23 -15598 -10213 -794130865 25225.979 -1.060667482169878E9 19712527510160101.667 2022-08-23 2022-09-07T09:37:41 2022-06-06 199.195.172.243 BenjaminGreene@Devify.org Hoffman Road 93
+2022-09-09T11:15:36 2147472006 26658958117089694.950 false 91 21995 -28829 1921853977 -9326.696 -1.865361821014336E9 40145011496472182.350 2022-03-15 2022-07-07T10:12:05 2022-01-25 24.129.28.35 uGreen@Avavee.edu School Drive 93
+2022-10-26T15:14:11 2147467668 17196762472988513.310 true -5 28431 -17708 -947082776 26115.467 -1.064859020746046E9 12851908920109725.570 2022-12-17 2022-11-09T06:13:10 2022-05-22 14.249.104.252 qMarshall@Yamia.mil Schurz Junction 33
+2022-08-02T13:11:26 2147466395 14160522214564153.767 false -35 5963 26203 1370349994 -10364.076 4.63808372886602E8 89497971198029168.922 2023-01-06 2022-06-16T16:39:52 2022-03-02 3.186.137.109 ScottPerkins@Edgewire.org Tennessee Terrace 33
+2022-05-18T22:01:25 2147447138 50480005137427111.177 true 28 16452 -30571 -2075189185 22385.588 -3.55214861990496E8 11932816216934343.652 2022-08-23 2022-10-21T03:38:58 2022-10-21 234.3.203.12 CarlMurphy@Wikivu.biz Northport Way 26
+2022-07-11T06:10:41 2147446227 39942552524190612.962 true -65 -22474 14929 1989464327 9511.273 5.86654785560309E8 79596075449045726.816 2022-11-07 2022-06-21T12:58:35 2022-11-24 19.107.68.34 tSanders@Jaxnation.biz Farragut Point 44
+2022-06-13T04:42:29 2147444078 80627252554457775.754 true 91 -17156 8627 1521831153 11225.079 2.09693779861494E8 8183865884308683.425 2022-11-08 2022-04-03T00:29:22 2022-03-20 233.68.240.228 3Martinez@Browsedrive.info Donald Crossing 7
+2022-07-12T23:46:35 2147438346 21307779971435471.232 false -9 -13506 -28486 -32114689 -3217.3818 1.872555303307973E9 73436580521307978.373 2022-03-18 2022-08-16T14:54:57 2022-10-01 204.85.217.82 et_modi_ut@Feedfire.gov Portage Junction 14
+2022-07-10T04:17:41 2147434485 1432088841386171.665 true 28 22783 -31955 -940172357 12963.05 -1.015348724865612E9 21415159800393256.390 2022-09-01 2022-09-17T21:00:35 2022-04-11 234.6.225.52 MelissaHenry@Realpoint.biz Bultman Court 97
+2022-03-26T23:37:01 2147432357 56924709102413625.675 true -111 24610 -30943 -1776521623 -7130.226 -5.00592536993921E8 16271114464316416.681 2022-03-24 2022-01-23T12:31:45 2022-05-28 58.48.43.183 ChrisJacobs@Buzzster.name Leroy Pass 32
+2022-08-24T06:52:46 2147425822 33378418596041889.584 true -17 -3026 29468 -1873981318 25636.371 6.43280347073812E8 90354184407027392.172 2022-06-28 2022-02-24T12:47:51 2022-10-15 97.226.248.251 qRussell@Cogilith.name Kings Place 83
+2022-05-04T22:35:17 2147425482 6517881695345385.105 true -1 -17372 20231 635029396 -19429.021 6.56125881323546E8 7165704130056347.115 2022-06-13 2022-12-05T18:10:15 2022-12-05 243.50.186.81 ErnestFlores@Thoughtbridge.com Dixon Court 53
+2022-06-03T22:53:31 2147424135 28644420545888776.933 false 40 -26116 -3291 306086353 26600.498 -9.60218756607374E8 40720938996818932.750 2022-02-13 2022-06-12T16:28:59 2022-10-15 168.234.102.40 GloriaAustin@Geba.biz Towne Pass 41
+2022-07-05T21:37:51 2147419311 28290293258808439.134 true 26 16950 8811 1233278399 -103.00702 1.520246238447387E9 88652736846204706.947 2022-03-10 2022-08-07T15:58:44 2022-05-23 133.108.194.1 DeniseRamos@Shufflebeat.net Mifflin Junction 55
+2022-08-27T13:18:38 2147398708 51773242262469907.285 false 29 -289 26743 -1393968680 11646.462 1.957852164380779E9 85909529735007926.735 2022-02-22 2022-08-12T18:11:59 2022-07-08 234.138.112.197 qui_sed_illum@Meedoo.org Muir Street 54
+2022-02-11T11:21:58 2147392850 57804265792541730.362 false -127 -23408 25721 -1101220500 2316.0918 -6.35043706494339E8 35840155922867023.289 2022-07-10 2022-06-26T10:41:26 2022-09-19 144.119.210.60 quia_ut@Gabcube.info Gateway Center 79
+2022-07-21T23:53:47 2147386878 30764594265766461.896 false -60 -8721 -22051 1711980281 -29701.404 1.849181274536084E9 83609670760129800.710 2022-09-16 2022-11-15T00:38:24 2022-06-14 246.45.68.181 fHunt@Eire.edu Scoville Road 95
+2022-08-16T10:03:56 2147383369 72879775219031581.449 false 22 -22449 1772 170772797 27267.404 2.83215517915306E8 66999108327070808.155 2022-12-17 2022-10-21T08:42:32 2022-04-01 121.224.155.131 molestiae@Eadel.info Mayfield Avenue 56
+2022-08-09T07:43:48 2147375954 28228200342554508.463 true 15 -29566 3184 1446182442 27525.846 -1.443946518312972E9 17957789229933477.747 2022-10-04 2022-01-26T03:41:36 2022-11-04 119.180.253.71 beatae@Gigazoom.mil Warbler Center 96
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_asc.out
new file mode 100644
index 0000000000..208832d488
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q06_largeint_asc --
+2022-12-04T06:22:57 -246711478 84654501521416796.390 false -103 -18113 19389 -2147482973 14880.098 -1.523112342164441E9 21878190873933476.500 2022-09-25 2022-04-07T18:05:54 2022-05-30 20.199.205.220 aLynch@Skipfire.mil Di Loreto Road 30
+2022-11-30T20:02:35 1303195728 96061793274819565.143 true -100 12686 9445 -2147477373 -272.6262 -1.337520506414394E9 99863726797306412.976 2022-07-29 2022-05-10T11:59:21 2022-06-05 116.199.111.187 oLynch@Skipstorm.biz La Follette Plaza 69
+2022-03-21T12:40:58 1766740169 58314620472932457.796 false -34 11103 24685 -2147470250 -21601.188 1.276817809965177E9 44606525392375639.351 2022-06-03 2022-12-07T09:41:05 2022-06-20 89.87.243.146 5Mcdonald@Edgeblab.biz Messerschmidt Park 66
+2022-05-28T16:26:13 269572186 75567480714706601.281 false 64 18423 15956 -2147468067 3118.419 1.14080614906741E9 97285517234959003.152 2022-04-25 2022-03-06T00:36:03 2022-10-25 67.67.254.248 quibusdam@Thoughtstorm.edu Banding Place 66
+2022-12-19T03:11:53 368664399 3856321685307290.500 false 55 -8418 23923 -2147463607 31785.799 -1.504358530434769E9 27357840533120346.393 2022-02-08 2022-05-30T02:56:16 2022-04-22 133.61.35.110 placeat@Realcube.com Hagan Junction 54
+2022-09-04T10:29:29 505158832 89258531165302642.352 false -2 26698 -29551 -2147460661 31994.326 -4.74098431981176E8 3099285301222708.927 2022-07-16 2022-03-15T12:56:56 2023-01-01 195.12.29.188 eFerguson@Devbug.gov Hovde Drive 86
+2022-11-24T15:17:28 -1274411366 36273428103740588.470 false 61 -2478 28518 -2147460092 5253.492 1.017796579773484E9 18578574573465258.900 2022-12-27 2022-06-20T02:17:02 2022-12-24 227.83.220.48 soluta_excepturi_voluptatem@Kwinu.com Autumn Leaf Parkway 8
+2022-02-25T13:09:10 1490273478 28860967798783963.919 true 5 3415 -10554 -2147456557 26398.396 -1.225803954377621E9 14411424230518932.655 2022-04-16 2022-07-19T17:48:55 2022-02-21 233.151.111.62 bFranklin@Dazzlesphere.info La Follette Parkway 9
+2022-11-25T03:24:41 1730057638 50526728974898764.444 true -21 -15927 -26670 -2147455128 -6386.3496 -1.241704346224951E9 37568557666081895.982 2022-06-17 2022-08-29T17:34:03 2022-04-06 75.238.221.73 AmandaJenkins@Zoonder.edu Ridge Oak Drive 89
+2022-09-15T01:11:08 2021945645 17740170857018755.373 false -7 9373 9553 -2147444846 -30542.957 -1.872565612753137E9 67600428727997910.476 2022-02-01 2022-05-07T11:25:46 2022-10-22 158.88.108.223 rWard@Eayo.com School Point 37
+2022-10-10T06:44:51 226924829 3593445574299269.961 true 122 26618 -2154 -2147436212 -25458.258 -2.084037938361169E9 73840033676088294.277 2022-10-03 2022-11-03T06:21:14 2022-02-23 37.232.120.223 necessitatibus@Tanoodle.name Dayton Terrace 36
+2022-05-04T14:48:45 -1213650127 19845163495939085.178 false 124 -16334 -18785 -2147434245 -28859.63 -4.26520567613069E8 51651176782949307.366 2022-10-07 2022-06-07T14:03:31 2022-09-16 177.86.31.32 JeffreyAlvarez@Eire.mil Springview Alley 12
+2022-12-05T23:31:47 2006293223 80010595377329795.785 false 120 -28127 -11779 -2147430826 16500.771 1.944697050616735E9 32098443507824497.353 2022-12-11 2022-04-02T10:03:31 2022-07-11 143.39.158.253 nulla_culpa@Edgeblab.gov Lakewood Point 85
+2022-11-27T07:30:34 1874606984 16920471508203112.408 false 113 -22035 -25464 -2147430552 -28138.596 -1.228214561951064E9 83072574392637665.579 2022-12-29 2022-06-02T05:20 2022-11-20 96.95.209.35 LoriAlexander@Jaxnation.mil Butternut Street 30
+2022-09-04T11:30:07 -356943580 37063782312262520.329 true 98 26068 32563 -2147429517 -27552.44 -1.682020011894294E9 22119933110158544.773 2022-01-31 2022-02-21T00:09:01 2022-08-22 155.217.45.197 PhillipRichards@Devbug.biz Warner Court 62
+2022-01-16T02:22:46 142063602 39444397208179062.259 true -71 7717 32637 -2147428986 -29604.64 -1.358212623780673E9 44149938348576967.404 2022-06-14 2022-12-13T17:57:07 2022-10-26 27.237.247.100 5Cox@Thoughtblab.biz Green Parkway 52
+2022-03-27T01:06:41 100350310 2429621132701832.504 false -27 -27878 12495 -2147423561 -7305.504 1.666994499841093E9 72834442231694344.686 2022-04-11 2022-06-07T09:36:46 2022-05-14 88.177.123.59 MaryColeman@Jaxworks.info Dunning Court 47
+2022-03-18T11:33:26 1142814905 37567364131794579.150 true -96 -13298 18670 -2147420684 7109.774 -1.469514153557711E9 9700567439687183.354 2022-10-17 2022-06-10T04:55:02 2022-08-01 229.78.241.213 kOwens@Skalith.edu Milwaukee Hill 99
+2022-09-05T08:20:12 1240124884 57484486337212427.249 true 27 19583 4124 -2147418398 4085.9597 2.124100330596222E9 29941035414366039.852 2022-03-27 2022-08-12T18:06:12 2022-07-22 225.255.60.232 tRomero@Jamia.gov Bashford Hill 14
+2022-07-15T07:14:59 -869403442 46336475426741737.925 true -79 -23899 8551 -2147416198 11694.44 2.060779514945475E9 21456006682378061.440 2022-12-15 2022-08-02T21:07:51 2022-07-10 150.253.89.219 EricCunningham@Chatterpoint.info Cambridge Avenue 42
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_desc.out
new file mode 100644
index 0000000000..71ae265eab
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q06_largeint_desc --
+2022-05-05T14:11:29 -254043651 92989254691730246.428 true 20 -12236 -22730 2147477970 32652.574 1.81252995854517E9 45443105341951463.379 2022-01-26 2022-09-27T09:14:03 2022-05-10 203.241.115.245 ToddWilliamson@Mita.net Independence Court 1
+2022-12-06T15:36 -1817842795 47268237300520155.430 true -54 -7307 -13351 2147475104 22036.732 1.49289066483237E9 91576671268310880.960 2022-09-22 2022-04-01T09:40:47 2022-03-08 12.208.19.233 wSimmons@Wikizz.info Oakridge Road 57
+2022-02-03T04:23:27 2110351806 18096615419125373.807 true 44 20850 31485 2147467308 14726.297 -2.116799679040196E9 50421976480155985.787 2022-12-17 2022-08-08T17:58:18 2022-11-12 202.103.10.99 officiis_et_omnis@Vimbo.gov Hoepker Alley 16
+2022-11-24T15:54:28 -463532063 65141640514860949.237 false -48 -13750 14822 2147462906 29250.246 -9.53329295044577E8 74125400250152591.764 2022-06-12 2022-11-04T16:42:21 2022-11-11 80.218.178.26 adipisci_beatae@Rhyloo.name Elka Terrace 59
+2022-12-15T04:57:02 -578378367 9720688031613570.665 false 94 1429 -19545 2147461759 15314.816 1.269180209779099E9 83514287335752076.410 2022-11-15 2022-08-23T18:34:37 2022-07-21 107.8.55.199 et_maiores_quod@Wikibox.mil Ryan Alley 1
+2022-06-06T13:08:23 176699102 97998705376490694.780 true -74 31309 -28430 2147453103 20794.389 1.676245213092824E9 30594542911506047.728 2022-05-06 2022-11-17T08:21:06 2022-01-11 57.76.60.111 6James@Skajo.com Burrows Crossing 79
+2022-11-11T16:14:36 -494447345 323181627092381.347 false 79 -6825 -18855 2147452974 -16348.068 7.98768657350112E8 75472366136429688.190 2023-01-02 2022-08-18T21:48:34 2022-02-15 165.10.182.59 dolorum@Devpulse.com Artisan Drive 2
+2022-04-08T21:30:16 -1478316915 60063426612015703.618 false 39 -3895 -26200 2147450430 9825.488 -1.41916821735485E9 77032754816718293.492 2022-03-30 2023-01-10T03:23:18 2022-01-30 37.118.147.31 non_veniam_iste@Innojam.info Fremont Circle 28
+2022-09-28T21:25:05 764874444 60109810009473038.185 true -20 1408 29473 2147448236 -32209.44 9.48479975322217E8 25919373179366574.603 2022-04-12 2022-09-10T02:45:29 2022-04-05 166.120.223.31 ErnestStevens@Skynoodle.org Old Shore Point 26
+2022-10-14T05:20:52 1595935241 27902839053795843.897 false 9 -21127 22822 2147441159 -17789.01 1.50715349820349E9 10022854468513820.850 2022-02-02 2022-08-21T12:07:07 2022-07-25 61.42.208.133 eos_accusamus_quasi@Fivespan.edu Ryan Avenue 35
+2022-11-28T07:01:50 1640272994 52127613480719973.480 true -79 -16021 -20610 2147434231 343.96222 1.36827702016383E8 93580208061798478.635 2022-08-03 2022-09-22T11:54:33 2022-06-12 50.238.208.223 2Johnson@Jetpulse.org Sherman Crossing 22
+2022-06-07T22:06:39 1219569626 47463517184600068.589 true 102 30657 -27866 2147430546 -30624.21 -1.57475059644786E8 98252031839665903.857 2022-12-22 2022-06-01T22:23:01 2022-03-29 13.185.213.79 vGonzales@Demimbu.com Delladonna Court 45
+2022-03-31T14:14:09 1703854096 37888586206164868.780 true 17 -9679 -4552 2147430153 20638.639 -8.49761147089966E8 62923240861759445.150 2022-09-14 2022-07-13T10:43:50 2022-07-30 51.117.123.126 sPeterson@Tagopia.info Goodland Plaza 70
+2022-02-27T10:05:57 692279612 15843459443851354.245 false -32 -12615 3567 2147429935 2580.702 -7.9936447504658E8 58662040384094405.250 2022-10-31 2022-09-30T09:15:34 2022-11-25 45.202.7.82 2Woods@Twimbo.net Kenwood Way 84
+2022-12-18T13:06:53 -267286656 13195275906866189.194 true -59 3154 3597 2147422236 -32265.494 -1.17224805061347E9 11810409337999823.603 2022-08-27 2022-12-01T07:30:24 2022-04-07 55.111.10.106 bCarpenter@Nlounge.name Barnett Terrace 3
+2022-04-18T19:06:02 1932199506 11843733083881423.758 false 121 -2722 -29211 2147420268 25321.805 -8.8706405191796E8 79625987451182569.849 2022-06-22 2022-04-01T04:02:20 2022-03-30 74.191.151.221 6Watkins@Fatz.com 3rd Plaza 10
+2022-12-15T05:20:03 223905557 85929696615604319.578 false -73 -23617 -618 2147418766 -23098.146 3.75672820015594E8 79759186335411663.445 2022-05-11 2022-07-23T13:40:35 2022-12-08 58.193.16.232 nWhite@Meejo.com Ludington Street 21
+2022-04-12T18:54:42 629183294 21260739465078612.550 true 9 -32697 -18977 2147415722 -14578.275 1.140790249811087E9 54442471810989683.166 2022-04-18 2022-01-17T05:05:50 2022-11-17 190.92.79.131 nostrum_necessitatibus_perferendis@Brainbox.biz Dunning Lane 50
+2022-07-22T01:56:01 -912865425 76030009831914932.956 true -27 933 -16029 2147415689 18758.906 1.477874145025536E9 50513806382172699.667 2022-08-01 2022-04-13T22:52:56 2022-03-22 198.123.234.245 beatae_porro_earum@Fadeo.mil Miller Avenue 63
+2023-01-03T18:46 935786761 13241289963707582.793 false 118 26620 16970 2147412302 -19167.205 -1.04699334862877E8 99005295897018148.356 2022-01-19 2022-04-29T16:15:57 2022-12-10 174.28.24.125 dicta@Topicblab.edu Acker Avenue 52
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_asc.out
new file mode 100644
index 0000000000..0bf6c87622
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q07_float_asc --
+2022-07-24T00:47:48 904239531 33565969037066895.718 true 52 19155 -17843 -870063950 -32767.988 -8.48448360999358E8 66639118858001777.565 2022-03-01 2022-01-28T19:07:42 2022-05-31 187.21.149.194 JesseVasquez@Oyoyo.org Cherokee Alley 22
+2022-02-12T22:26:31 2108790490 86676668827760441.915 true -75 -22704 -19474 613611806 -32767.787 1.644913013099952E9 31375202450831669.536 2022-12-15 2022-11-29T17:28:16 2022-02-09 2.164.27.215 ut_voluptate_nostrum@Realfire.mil Sutteridge Court 77
+2022-02-16T00:16:30 -175996605 43041167243007063.975 true -12 29739 -3935 -1932953359 -32767.746 -2.074393977727773E9 64318533569881963.437 2022-09-27 2022-08-02T16:47:36 2022-05-08 31.199.136.214 RalphGraham@Voolith.mil Lighthouse Bay Center 8
+2022-06-28T16:18:39 -1729238049 14902567026287623.608 false 7 4996 -16429 1936002549 -32767.72 -1.972391364003938E9 29191167190453912.182 2022-05-21 2022-11-14T15:52:20 2022-10-25 103.139.73.137 JustinCarpenter@Einti.biz Twin Pines Parkway 83
+2022-07-10T03:32:07 322457889 83017026184485620.890 true 101 10659 24047 1340057814 -32767.707 -9.08730451038922E8 20006513970590562.630 2022-01-11 2022-12-02T22:17:10 2022-09-30 151.249.119.32 eum@Skivee.mil Hanson Park 43
+2022-07-13T00:55:01 19840994 47712155853010152.649 true 122 14088 20384 -343237821 -32767.684 -5.77925471856236E8 64616761541007404.300 2022-10-18 2022-09-22T12:16:47 2022-07-12 146.145.128.31 7Kim@Kwinu.mil Dryden Plaza 18
+2022-03-30T03:28:42 1348539021 64429861037880761.570 true 111 -27347 21390 1803141201 -32767.668 -7.92723412691912E8 18940294349435889.299 2022-08-31 2022-10-24T00:10:45 2022-11-12 5.92.88.123 quas@Kimia.name Northport Circle 28
+2022-09-30T07:57:09 -2087749504 35974515412216284.768 false -56 26332 16149 -1918451952 -32767.629 1.505657067710979E9 14125801984329646.132 2022-12-29 2022-12-23T09:43:14 2022-08-27 178.38.96.116 sed_velit_velit@Skaboo.name Di Loreto Point 60
+2022-06-13T04:20:21 -412116091 14704466008982914.593 true 31 3670 16698 -1176087665 -32767.58 9.96148449354842E8 2331543756766195.399 2022-03-05 2022-11-12T19:54:38 2022-02-18 253.140.247.58 RubyOrtiz@Yotz.net Kingsford Crossing 31
+2022-07-03T02:38:25 -1885965822 18809384744155126.992 false -54 19220 5741 40929511 -32767.557 1.897494615946867E9 60705295259854870.426 2022-10-11 2022-04-07T05:42:40 2022-11-02 135.82.1.27 6Frazier@Agimba.com Dapin Hill 10
+2022-12-28T12:27:58 2144982721 34151648280765961.556 true -113 15003 -16225 1537538725 -32767.49 -1.036707525400561E9 62094645821469413.892 2022-09-16 2022-07-27T06:59:26 2022-10-09 219.3.222.122 aliquam_optio@Linkbuzz.name Delaware Park 68
+2022-05-20T01:20:46 855210976 40439533526429101.994 true -109 20072 -13887 572793058 -32767.479 -9.95966842673598E8 10518058910752436.100 2022-10-21 2022-08-06T03:23:51 2022-05-21 64.172.124.211 quasi_sed@Linkbridge.biz Russell Park 40
+2022-02-02T01:21:18 415683678 49547346495865901.946 false 53 2404 23197 1824160959 -32767.453 -2.039937903393366E9 67542038172891692.347 2022-07-29 2022-05-31T18:16 2022-01-11 232.113.214.41 7Kelly@Kanoodle.mil Ludington Park 17
+2022-12-13T19:11:50 -1790026203 3006589949410236.238 false -77 7967 17077 -290248005 -32767.354 -9.28722235122386E8 24631351662980061.994 2022-06-12 2022-03-03T03:10:23 2022-04-04 131.226.158.250 NancyReed@Tagchat.mil Moulton Place 40
+2022-10-03T23:47:27 -1096721480 38168021051635209.280 true 28 21242 29443 -1278081844 -32767.334 6.35216208676209E8 70115031022976032.272 2022-06-29 2022-04-20T19:27 2022-03-11 5.1.22.237 oThomas@Devpulse.com Hoard Terrace 92
+2022-02-13T04:02:10 -1856473613 58977472424341523.150 true 48 -2077 24889 -552848396 -32767.33 1.084642554354116E9 67110277205429974.534 2022-05-12 2022-02-11T18:55:06 2022-04-08 219.197.188.140 quis_distinctio_ut@Realbuzz.com Utah Street 22
+2022-04-15T16:27:31 -49252508 13217520985568169.130 true -71 -15126 14471 -1729837304 -32767.291 1.420844360079393E9 33440706532871170.910 2022-09-09 2022-10-30T01:15:15 2022-05-20 1.200.56.211 LillianLawson@Vinder.org Bluejay Lane 62
+2022-12-20T00:56:18 180234905 66788060212625427.800 false -67 30913 14670 1441689123 -32767.148 1.486941962798543E9 28309713375130051.380 2022-07-17 2022-12-07T06:20:09 2022-07-27 91.214.19.50 7Elliott@BlogXS.info Nova Alley 59
+2022-09-15T23:02:14 1295918703 60804256677594169.934 true -69 -24133 -30961 -582139753 -32767.148 9.25359500606945E8 60393934721443505.647 2023-01-06 2022-02-26T05:59:38 2022-07-12 120.166.54.251 PhyllisHansen@BlogXS.name Butterfield Junction 82
+2022-10-27T17:15:41 -499854500 38741293912690690.322 false -79 -1558 -25539 851517119 -32766.943 1.413894336107252E9 58594526725832285.190 2022-07-01 2022-01-29T20:31:19 2022-04-30 120.118.142.155 DianeHicks@Eabox.biz Redwing Street 99
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_desc.out
new file mode 100644
index 0000000000..047f2f0d62
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q07_float_desc --
+2022-05-01T22:47:40 -1823175604 26844134249385819.791 false -29 -30329 1822 -1358168511 32767.928 2.009688291575429E9 17771168838097809.431 2022-07-16 2022-09-27T15:50:52 2022-05-11 238.180.194.241 illo_odio_doloribus@Edgeify.com Anhalt Park 64
+2022-12-22T02:25:34 191948397 54405155782334714.669 true -104 8926 15485 -498481413 32767.89 5.6676607501201E7 21068783695616905.925 2022-12-29 2022-10-10T18:16:59 2022-10-30 232.100.143.255 lStone@Agimba.gov Hovde Junction 64
+2022-12-26T10:05:45 1283692793 74203772188095329.182 false -90 15635 -15276 233117712 32767.844 9.99261833045144E8 15327922014220167.461 2022-08-23 2022-07-20T02:08:55 2022-02-01 111.58.77.158 voluptate_sed_sint@Skajo.com Kinsman Avenue 61
+2022-06-14T10:00:45 -349690738 32476403216500129.837 true 84 -7438 -4479 -1342593648 32767.53 -1.017541295853379E9 53464723428371155.899 2022-03-12 2022-02-02T13:44:46 2022-02-08 178.224.29.55 MargaretStanley@Twinder.edu Saint Paul Hill 86
+2022-07-17T12:06:46 -1183035245 45175105158261917.900 true 50 32753 -6817 1129687357 32767.525 6.83977389495487E8 90865788207515996.658 2022-12-02 2022-04-06T03:01:25 2022-06-25 36.121.121.59 est_qui_corporis@Brainbox.info Comanche Street 98
+2022-04-17T10:25:42 -2006471494 4142119437709967.790 false -68 13626 13999 2064760274 32767.498 8.67897806228493E8 5676096559725262.986 2022-12-16 2022-06-28T18:00:15 2022-03-23 29.50.242.117 MarilynRomero@Meemm.com Dunning Alley 53
+2022-03-11T19:39:11 2059621459 65571725069055468.712 true 28 29392 28017 495895095 32767.463 -6.31667614588921E8 13000911596646026.488 2022-10-09 2022-11-16T18:12:51 2022-10-16 177.125.29.161 kSanchez@Thoughtbeat.name Elmside Point 30
+2022-09-14T00:12:35 1220184058 9019805071295258.504 false 29 19107 -2808 389440903 32767.441 -8.69481459751087E8 82307710315546489.595 2022-02-10 2022-03-04T13:39:07 2022-03-12 6.78.18.222 6Robertson@Skynoodle.edu Jenna Court 8
+2022-07-23T01:42:47 -1856335607 36797980679486173.500 true 34 10190 13004 -377606691 32767.35 1.618143559024504E9 24314642946067219.289 2022-09-10 2022-06-10T06:52:54 2022-10-22 150.62.5.109 jRomero@Rhybox.info Sachtjen Drive 84
+2022-12-31T20:00:01 1658024718 51540230440208955.468 false -110 -19442 6042 -447004279 32767.307 -1.558000125151187E9 21675360843130030.892 2022-11-14 2022-06-26T14:02:51 2022-05-08 18.110.198.57 5Rose@Devbug.org Cherokee Parkway 48
+2022-11-06T18:35:01 1897557978 52787049966600263.166 true -45 2589 -2609 50007734 32767.264 8.0396261208888E7 33064805090486846.974 2022-12-26 2022-06-13T08:51:42 2022-03-29 65.174.60.242 et@Skinder.gov Loeprich Pass 52
+2022-10-15T13:11:53 -1497909968 27012952279549600.521 false -28 -12781 -26606 722420626 32767.158 -4.75277368579731E8 19593895174108654.977 2022-07-15 2022-07-07T07:51:43 2022-08-13 36.79.152.158 iDean@Jabberbean.info Goodland Circle 26
+2022-07-01T20:53:09 1248745923 24848911496818958.569 true -36 -15877 8202 -1451993096 32767.125 1.557614928545075E9 36745461578276620.586 2022-12-21 2022-03-30T16:29:29 2022-04-17 27.217.220.253 qFox@Fliptune.com Macpherson Road 35
+2022-08-20T18:58:39 -764816941 23696968649873.157 true 4 -29579 -10518 -1618315528 32766.848 2.46997485521595E8 3596523905488433.465 2022-01-27 2022-07-11T10:38:39 2022-09-14 255.5.162.121 ArthurDean@Skaboo.net Londonderry Place 98
+2022-08-18T23:31:02 -303249502 41222404113028818.193 true 59 -1042 -12995 328851185 32766.832 1.460692812883648E9 40337792162187.664 2022-10-18 2022-06-30T10:13:20 2022-09-21 145.15.191.95 4King@Fanoodle.org Derek Park 69
+2022-02-03T03:14:10 -1638231600 40273337117344981.355 true -104 21971 9106 -480668649 32766.648 -1.274022605370237E9 11266174902460852.644 2022-11-21 2022-09-06T07:19:29 2022-05-05 153.249.100.179 accusantium_et_voluptates@Aibox.mil Luster Circle 39
+2022-05-26T19:50:30 -178771063 66737064997984085.407 false -4 12436 -29145 406979373 32766.59 2.9066412262873E7 24458404583836435.310 2023-01-06 2022-02-04T00:40:21 2022-11-13 174.213.103.117 voluptatum@Devcast.com Dahle Pass 15
+2022-04-30T12:06:27 1046717849 72627986434926943.767 false 40 -9290 -19846 -1967897496 32766.408 -4.45127586899636E8 68745674857304603.848 2022-04-28 2023-01-04T00:48:51 2022-08-29 156.17.115.230 pariatur@Lazzy.com Glendale Park 56
+2022-03-10T12:56:28 -308190496 35899895852191727.300 true 46 -28411 19644 -1006156944 32766.365 1.798419471510469E9 71539937481829950.261 2022-07-09 2022-12-09T12:21:37 2022-10-30 150.74.242.207 cumque@Reallinks.mil Esch Junction 16
+2022-09-20T09:38:26 1271224400 37717294824782877.120 false -26 -17735 12387 135439250 32766.299 7.74548148382679E8 39865411029260070.183 2022-01-28 2022-06-11T04:27:44 2023-01-06 161.28.174.115 nesciunt_necessitatibus_ut@Skidoo.biz Messerschmidt Court 93
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_asc.out
new file mode 100644
index 0000000000..0786c353ed
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q08_double_asc --
+2022-03-10T18:42:24 -405123470 30524842082085362.905 true 26 24437 4297 354795119 -25761.59 -2.147482437676639E9 50575378749456234.868 2022-03-10 2022-05-18T01:05:45 2022-09-13 47.119.254.67 EmilyOrtiz@Innojam.net Stoughton Trail 78
+2022-08-08T06:35:44 -2012289867 45617452929508063.366 true -122 25912 -1856 -1742024386 -19357.436 -2.14748217408611E9 68319443496875372.242 2022-02-04 2022-09-03T23:05:27 2022-09-23 167.91.84.230 tenetur@Topicware.info Ronald Regan Parkway 48
+2022-11-01T02:03:25 -2040869063 61735959420070173.869 false -125 213 15786 984234332 -24888.938 -2.14747852680751E9 61624435405251776.949 2022-09-17 2022-04-30T12:11:50 2022-11-27 46.8.13.249 PatrickSpencer@Gabtype.edu School Park 50
+2022-03-22T14:21:15 1208235307 96766443104061067.216 false -26 24825 -8689 653919993 -9123.589 -2.14747585583476E9 99499821157588901.634 2022-08-27 2022-05-26T11:23:38 2022-09-09 213.118.149.191 RussellLittle@Skilith.mil North Lane 69
+2022-08-31T01:03:43 1543030331 21060798832666421.875 false -18 -640 -9108 -533892269 -9892.433 -2.147470382276245E9 79205585363517823.524 2022-05-23 2022-11-29T10:17:27 2022-05-24 21.2.251.252 SarahWeaver@Kwimbee.net Eliot Parkway 60
+2022-10-24T01:20:17 1728404501 61238282568646523.204 true 121 -10884 -2623 -520433238 -2531.246 -2.147469149301041E9 16927494567415021.299 2022-07-23 2022-04-24T22:56:47 2022-12-10 166.54.119.20 oKing@Jabbercube.com Knutson Crossing 24
+2022-08-24T09:56:25 1767976805 42604827030624254.664 false -123 23752 -13890 735050569 14621.793 -2.147462989813695E9 72927487236500898.421 2022-10-17 2022-10-14T20:30:48 2022-05-02 198.56.155.197 TimothyRobinson@Kwimbee.name East Point 3
+2022-10-23T23:07:39 -1995889486 96481041268303342.302 false -121 6012 -1965 2005454932 -3898.677 -2.147460972447545E9 57374890084831617.256 2022-08-08 2022-11-30T20:42:59 2022-08-12 145.178.228.193 suscipit_aliquam@Miboo.net Division Park 9
+2022-02-23T04:22:49 881631226 94602930294624568.738 true 121 -10808 -21127 -640203604 2886.5693 -2.147459826391465E9 30866240195387124.250 2022-07-23 2022-07-26T04:53:27 2022-03-11 183.164.104.224 aFord@Muxo.name Gina Trail 75
+2022-07-05T09:07:16 -375749426 35505781736306985.300 false -17 -8492 31858 -1875503799 -30491.041 -2.147454316996151E9 20036407418065005.612 2022-02-11 2022-05-08T22:26:37 2022-07-09 87.36.135.225 fLarson@Gigaclub.name Artisan Place 64
+2022-05-09T11:21:56 744168247 91736531098704944.738 false 100 3446 13719 1742463622 10450.202 -2.147450080574351E9 1777397163243433.240 2022-09-09 2022-01-20T06:02:31 2023-01-02 142.252.236.123 tFrazier@Geba.net Derek Place 7
+2022-06-13T09:37:54 880607708 56051979616913558.930 true 45 21251 20284 684694333 13335.993 -2.147447600027668E9 56704909797333381.900 2022-06-07 2022-09-24T08:22:58 2022-11-29 251.89.212.99 aSpencer@Skyble.edu Amoth Terrace 74
+2022-09-11T07:06:33 -1658533753 81393249943026065.254 false 47 -4202 -2877 454202975 -5924.0073 -2.147443564400919E9 13909108580868795.867 2022-09-15 2022-11-21T00:47:47 2022-11-08 146.190.118.89 NicoleWatson@Livetube.org Ryan Pass 36
+2022-06-15T08:48:01 -743216727 62655508944115419.579 false 119 1120 4099 -1037219689 17388.986 -2.147443170041909E9 40462312893491746.636 2022-05-03 2022-05-01T22:00:31 2022-07-31 65.23.172.93 StephanieHansen@Thoughtworks.info Red Cloud Alley 1
+2022-09-19T23:52:38 -490124641 83215815942254282.599 false -83 -5021 -26145 -203241250 -3014.7898 -2.147435767935103E9 24883142112718518.660 2022-05-09 2022-06-14T20:14:32 2022-03-14 137.6.5.34 JuliaDaniels@Izio.biz Lerdahl Point 49
+2022-04-15T18:12:20 -1476674200 76077621753438032.418 false -81 -17630 -10269 -268792458 13778.415 -2.147435208942339E9 93226194917360130.580 2022-07-02 2022-08-07T20:32:33 2022-02-06 195.140.76.121 qWhite@Ooba.org Maywood Junction 85
+2022-04-22T15:18:10 -373161437 10185796628713839.151 true 78 -20341 -3857 -965487650 3162.9028 -2.147426668518247E9 87660212947422082.248 2022-08-08 2022-07-26T22:40:14 2022-07-01 227.174.162.56 xFox@Centidel.net Kings Point 27
+2022-02-02T02:55:25 887338146 5852994288487202.801 false 18 -1110 -2915 -1973362361 12884.521 -2.147414306997674E9 58177080984258084.521 2022-04-12 2022-06-14T16:11:06 2022-06-14 194.10.208.88 asperiores_aut_nam@Eimbee.info Scofield Road 30
+2022-06-27T01:36:01 260022507 743933466293884.547 false -128 24594 -1774 1280236247 25504.85 -2.14741145881511E9 50419753384455671.508 2022-08-21 2022-02-20T08:53:48 2022-08-08 47.55.246.239 voluptatem@Flipstorm.info Burning Wood Terrace 31
+2022-05-08T04:59:26 1767178007 6136230207395435.673 false 10 6759 14677 1442964429 814.3629 -2.147407577546572E9 88192023490142365.694 2022-03-06 2022-03-22T20:48:47 2022-10-30 93.78.153.54 JoanDuncan@Quinu.info Helena Center 83
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_desc.out
new file mode 100644
index 0000000000..8260750686
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q08_double_desc --
+2022-12-29T21:44:26 -1901453444 6972130491285679.714 true -41 30904 -24569 775713590 9847.924 2.147477153306775E9 18887933329250990.563 2022-01-13 2022-02-22T18:46:35 2022-02-19 210.166.146.182 voluptatum@Zava.com Esch Parkway 0
+2022-02-20T13:20:26 603774063 10031075483039884.550 false -17 24299 -5828 -476157404 17167.95 2.147476799175778E9 61087522469466821.603 2022-05-09 2022-11-01T11:02:13 2022-08-04 119.189.18.178 StephanieHart@Browsecat.gov Lunder Center 51
+2022-04-01T02:13:12 -714596317 59040238131172211.256 false -5 8267 31786 -1226086125 -21627.693 2.147468982588477E9 54918077517454206.357 2022-11-27 2022-06-02T10:50:01 2022-05-27 181.233.37.54 nTucker@Realbridge.com Anderson Park 30
+2022-10-30T19:57:07 318494459 53122206704355399.609 true 18 14246 23967 -1292820840 12325.499 2.14746497311557E9 43745863329775500.490 2022-12-25 2022-10-02T21:28:33 2022-05-23 138.39.3.221 assumenda_aut_sed@Kazio.com Lakeland Parkway 26
+2022-08-26T04:30:04 -1017580911 73134490765858113.307 false 72 27006 -23952 1526696207 30609.816 2.147460658319948E9 78955888319979537.554 2022-04-29 2022-10-10T06:01:34 2022-06-04 136.152.216.121 hDean@Skynoodle.name Arkansas Terrace 20
+2022-12-26T20:59:12 -414860945 61168599630920854.600 false 115 283 -16515 121510438 -15174.003 2.147450667851302E9 82161872297771737.741 2022-12-19 2022-05-20T08:41:28 2022-12-20 180.254.29.2 odio_quia@Zoonder.biz Golf View Center 59
+2022-11-18T22:52:22 -727722977 89956947221100614.123 true -68 25258 16043 -1054357441 7078.5977 2.14743292335321E9 12249955471390332.374 2022-07-11 2022-08-04T22:33:31 2022-10-08 47.235.187.120 JoshuaPerry@Wordpedia.com Utah Avenue 54
+2022-03-11T20:17:23 953563840 69892845086489081.642 false 76 11843 2419 1413362882 32233.459 2.147432562021997E9 63085092039170869.321 2022-10-26 2022-05-08T10:23:32 2022-04-04 240.88.225.211 nemo@Rhycero.com Nova Court 10
+2022-09-07T07:35:38 1376216092 83819753605409270.940 false -121 24247 -24187 675804821 -20800.373 2.14743177926813E9 54374081283430912.995 2022-03-08 2022-05-16T23:30:23 2022-04-10 161.243.186.40 delectus_voluptas_aperiam@Tagtune.org Forest Run Plaza 25
+2022-09-04T03:43:28 -785451379 38108027258674830.609 false 37 6603 14897 408672726 -25067.922 2.147426985925759E9 94979755077430855.427 2022-12-27 2022-04-23T03:02 2022-02-07 203.203.153.47 iste_est@Thoughtstorm.org Superior Hill 0
+2022-11-13T18:40:31 -1834847947 94408615957889922.260 true 91 1792 -10013 -1481262619 136.31235 2.147421724471276E9 78587339836232130.857 2022-11-13 2022-10-10T09:11:53 2022-05-17 243.176.29.130 laboriosam_quasi_quos@Devshare.mil Schmedeman Road 28
+2022-12-16T09:20:02 -371885987 49650554866602497.370 true -64 -28281 -14560 905661693 -13961.722 2.147417387496636E9 92469965794419874.219 2022-10-29 2022-06-09T04:57:20 2022-10-26 206.2.225.250 mParker@Oyondu.com Dapin Avenue 28
+2022-06-15T16:56:51 318786654 19312280480540543.880 false -128 -20686 -8126 -1552841847 11839.364 2.147413172813562E9 41648836477421064.713 2022-07-14 2022-08-21T08:59:58 2022-09-23 5.195.160.79 uBarnes@Topdrive.edu Coolidge Way 33
+2022-08-09T07:40:01 -878937379 53857411133700231.500 false -106 8200 16814 -1880737224 -31797.973 2.147412744844992E9 75564725097441111.249 2022-01-19 2022-01-25T12:55:42 2022-03-17 107.150.26.3 eVasquez@Jabbercube.info Shoshone Circle 50
+2022-09-08T16:18:16 -1506689957 68351529092632845.532 false 8 18536 -2976 -183877855 11343.571 2.147399311893309E9 71012217344071727.370 2023-01-10 2022-10-09T08:21:53 2022-01-28 200.126.93.129 StevenGonzales@Skilith.net Eastwood Lane 56
+2022-12-24T07:43:42 -365827392 28417565408603064.442 false 28 -13958 -25865 690921161 -1557.4167 2.147391585487465E9 11894844023068530.736 2022-11-26 2022-07-21T16:17:14 2022-11-19 174.50.207.114 voluptas_ex_quibusdam@JumpXS.gov Tennessee Parkway 38
+2022-07-04T11:42:30 840320864 8454955674736884.949 false -107 -32128 29734 1693609531 -15432.139 2.147374650680583E9 74009074929680668.123 2022-09-07 2022-09-10T09:28:50 2022-08-06 237.78.243.35 BonnieMurray@Quinu.net Golf Course Terrace 1
+2022-01-20T14:09:12 1065362379 3956641329612931.282 false 54 14504 -18689 1723072084 -20047.71 2.147374402750129E9 32781601533828468.477 2022-12-26 2023-01-04T07:29:52 2022-10-21 64.182.181.153 7Richardson@Devpoint.biz Westridge Terrace 47
+2022-10-24T12:19:09 -411624765 39890706948753974.422 true 48 18524 31536 -1501617938 1917.4728 2.147374277357E9 46226364337403049.211 2022-04-08 2022-02-28T23:14:02 2022-04-19 231.224.150.46 PatriciaWebb@Tagchat.gov Golf Hill 78
+2022-10-01T14:17:44 -416214628 12066789381999898.187 true -105 18780 21173 -202772752 3968.7388 2.147372430138913E9 40350761596541333.603 2022-06-01 2022-06-20T20:45:14 2022-09-09 194.138.106.58 DianaAllen@Fivespan.biz Everett Pass 59
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_asc.out
new file mode 100644
index 0000000000..96810b6379
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q09_decimal_asc --
+2022-11-21T02:13:11 -2094463843 82013240745568720.901 true -126 -287 -6431 -990277862 8351.304 9.52050585850082E8 104274718933.432 2022-10-10 2022-05-07T07:44:30 2022-06-26 151.59.35.29 saepe_perferendis_ab@Yotz.edu Porter Plaza 40
+2022-03-23T21:01:42 63620993 18877219711981123.246 false -124 -27634 11605 -1570634768 18759.242 -8.53030323635455E8 238388965769.804 2022-02-09 2022-10-18T01:16:37 2022-09-22 166.200.198.197 qKelly@Einti.com Green Ridge Lane 56
+2022-01-23T17:20:35 772939954 79625029259661832.927 false 17 25509 -712 -54139136 17758.87 1.78211739312035E9 241226087670.720 2022-08-20 2022-03-17T23:05:52 2022-08-21 33.167.110.221 AndrewSims@Aimbo.net Stephen Park 32
+2022-09-27T19:14:53 269519612 33235860598493411.504 true -89 13926 10398 -546659434 26608.496 9.70142659013418E8 378676839453.902 2022-09-30 2022-10-24T14:04:16 2022-06-17 220.92.0.99 vChapman@Abata.com Dorton Hill 77
+2022-02-15T03:19:24 1004223908 86999570572123405.400 false 11 -13716 -23084 -385171186 27309.123 1.716578506914097E9 434372319510.908 2022-09-25 2022-09-02T06:06:56 2022-12-08 125.240.174.59 et_molestiae_non@Pixoboo.org Coleman Pass 49
+2022-10-13T19:00:54 -1620632531 3296721712805713.971 true 64 -5015 -29331 -807690206 15233.427 1.359906008175727E9 474043731872.732 2022-01-24 2022-06-27T02:26:22 2022-11-24 7.161.103.24 CarolCrawford@Fivebridge.edu Colorado Park 15
+2022-09-05T10:19:11 -109280563 40924992124640391.216 true 11 1205 -20248 -189384810 15941.971 1.155589209973932E9 658402189460.136 2022-06-14 2022-09-26T13:26:56 2022-02-03 156.11.79.235 2Ross@Jetpulse.mil Glendale Lane 58
+2022-10-18T19:22:21 -78343958 80953826781875982.688 true -90 -6042 26893 1689911978 -5118.9185 -6.43478737364875E8 885035886287.540 2022-09-27 2022-09-17T09:14:05 2022-02-17 76.215.214.71 nostrum_dicta_excepturi@Zoombox.name International Center 6
+2022-09-03T23:14:13 -1163677228 63984933812840887.410 true 46 -29000 17658 -2126469198 -11242.861 -1.380599417257768E9 1102989768080.759 2022-11-30 2022-09-22T14:46:47 2022-03-15 102.25.80.204 qui@Edgeify.org Bonner Crossing 40
+2022-06-27T11:28:34 1470915099 15993738623443003.311 false -54 24192 16174 1695169698 856.2539 -1.179340611439944E9 1192584436496.690 2022-08-14 2022-09-29T22:43:24 2022-04-14 144.180.163.119 ipsam@Wordify.net Randy Court 90
+2022-10-14T04:54:56 1009547889 22192081719878907.454 true 33 -3474 10616 1476451250 9865.36 -1.057024605749733E9 1307922323512.678 2022-02-06 2022-10-23T18:15:14 2022-04-25 25.8.135.230 ab_sint@Kare.info Brown Circle 90
+2022-09-20T09:13:40 696034893 60176335006203914.181 false -112 -27283 2207 -1099640075 -6205.9883 8.73004570867467E8 1364712051686.780 2022-08-05 2022-02-16T23:03:06 2022-09-29 8.73.82.32 qui_amet_sed@Demimbu.net Surrey Crossing 65
+2023-01-05T05:02:29 -1881690009 82692433157462219.355 true 123 -15988 -30951 -484056798 -6971.7705 -1.450082975919906E9 1546077432131.302 2022-06-13 2022-10-03T20:25:07 2022-07-02 0.247.223.33 CarolynBradley@Jabberbean.edu Grasskamp Road 39
+2022-12-03T00:39:22 -1869314153 91471053441982863.900 true 107 -17315 16251 1083714597 -522.2943 -1.344632809022432E9 1650345856597.424 2022-10-07 2022-12-02T15:02:22 2022-09-11 107.87.16.12 ArthurOlson@Browsezoom.net Merchant Plaza 68
+2022-12-11T02:53:55 76648457 19353454235864461.644 false 73 27396 -21583 -580821534 -11190.054 -1.643367278440527E9 1680327468670.480 2022-08-27 2022-05-30T07:30:49 2022-12-15 130.24.210.219 PamelaGordon@Cogidoo.edu Utah Park 40
+2022-09-03T16:18:03 -2030067917 73821097923517915.774 true -43 -19482 21813 -1298426450 18488.309 1.154939669212595E9 2128119976896.118 2022-05-03 2022-04-26T23:06:46 2022-03-18 226.235.187.38 laboriosam_accusamus_iste@Devify.biz Grayhawk Center 68
+2022-09-10T10:51:55 -110467611 97568616219333432.353 false 91 5750 -26891 1287314168 -30644.705 1.747664269464388E9 2189861255277.600 2022-05-05 2022-04-26T04:38:55 2022-10-01 21.110.66.170 omnis_ut_inventore@Meetz.org Pawling Street 52
+2022-08-07T10:31:28 67641154 91779882057472742.208 false -31 23732 -1370 1438330869 -11211.295 -1.217490499883765E9 2573316059081.415 2022-06-13 2022-06-04T19:47:14 2022-09-14 228.39.218.73 voluptatem_ab_quidem@Skimia.com Mayfield Trail 92
+2022-09-01T18:30:38 1246194234 22790783297462329.277 true -34 9417 5985 -737940949 15110.503 2.079840062685427E9 2701365024477.353 2022-12-11 2022-08-23T08:42:16 2022-07-17 30.50.249.229 rReyes@Feedbug.org Washington Circle 51
+2022-06-25T16:17:26 1069327136 40438284601243562.653 false 108 -11471 -7937 -1266148182 25716.775 1.179133008519111E9 2704806075959.329 2022-10-16 2022-12-28T20:15:22 2022-10-31 101.8.185.15 5Barnes@Yodoo.net Northridge Terrace 49
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_desc.out
new file mode 100644
index 0000000000..8aed9db075
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q09_decimal_desc --
+2022-02-08T17:09:22 -48778739 80013672506374964.175 false -104 -21630 20223 1753753753 11044.746 2.0486295517382E9 99999907302815431.463 2022-10-03 2022-03-03T02:57:55 2022-02-11 77.69.100.114 doloribus_labore_possimus@Topicstorm.org Paget Trail 37
+2023-01-10T07:23:51 1902847973 11854731116764143.883 false 3 19740 27573 1013255347 14831.712 1.407728698006076E9 99999825142998731.887 2022-06-20 2022-11-11T12:21:25 2022-07-29 210.105.147.152 JoycePowell@Ozu.edu Waubesa Court 18
+2022-06-02T06:09:09 1213684540 47131855708359167.528 false 42 19491 23518 -1344262688 -24247.63 1.198089740108392E9 99999691649048205.378 2022-12-28 2022-09-26T13:27:26 2022-02-23 109.77.118.88 JudyLittle@Dynazzy.net Green Ridge Center 66
+2022-08-16T23:08:20 -856766628 4699441330808714.534 false -2 -22018 -17776 -224328857 2318.4412 1.668053802644466E9 99999690569344852.757 2022-06-25 2022-06-05T09:48:15 2022-05-25 114.246.69.219 JenniferRay@Dynabox.biz Cascade Plaza 53
+2022-02-01T12:57:15 -771189588 73326124982233438.548 true 27 -21510 -1701 944304750 -23516.396 1.282086787685226E9 99999527862620834.260 2022-05-17 2022-02-28T19:27:18 2022-09-25 231.243.121.69 DanielCox@Agimba.com Havey Pass 12
+2022-01-31T02:48:49 1299358565 25906682705073769.881 false 16 29340 7115 1414075728 1121.1704 2.5768813823955E7 99999480488551022.370 2023-01-04 2022-08-07T00:14:20 2022-12-28 157.70.26.221 eCampbell@Demizz.info Mendota Trail 94
+2022-08-29T18:38:23 -1829957619 85764936027920089.444 false 108 21050 -24102 898524354 2950.0564 5.2627884713044E7 99999427697608819.875 2022-01-18 2022-12-28T02:19:52 2022-09-08 18.149.12.111 LillianWatson@Flashset.biz Bonner Crossing 10
+2022-03-06T04:28:17 -1269636186 86632186864138858.274 true -52 29201 -31216 -2008441711 -15075.176 1.991885690891815E9 99999353009708383.460 2022-04-28 2022-01-16T11:41:36 2022-07-04 79.170.36.184 JoyceCrawford@Demivee.name 1st Pass 35
+2022-01-24T12:21:24 -1233125274 41826205585929464.702 false -42 30950 18627 -1245545292 -23570.18 1.167376285421624E9 99999171140586231.458 2022-05-15 2022-02-03T10:45:35 2022-05-17 79.221.191.181 RobertHenry@Youspan.edu Namekagon Avenue 56
+2022-07-13T00:07:51 -2146282454 15708754671771196.309 true -120 -1603 -21307 -322123500 12998.556 -3.21255428700764E8 99999040341261239.986 2022-04-27 2022-06-14T10:46:04 2022-06-28 12.247.87.160 jSmith@Avaveo.edu Loftsgordon Park 13
+2022-02-24T05:51:55 -891068687 94201901147831645.849 false 100 -12535 27960 -351386551 31962.186 -1.117344705452739E9 99998894052756341.691 2022-10-15 2022-01-23T15:47:59 2022-12-27 214.103.101.167 fugit@Blogtag.info Londonderry Avenue 34
+2022-10-09T01:23:56 -3065303 82458962889574301.734 false 5 -14392 8963 21170466 31113.385 -9.51652551293124E8 99998881983973310.520 2022-09-06 2022-07-20T20:40:23 2022-04-30 204.208.183.176 GeraldMcdonald@JumpXS.gov Forest Place 30
+2022-05-06T08:15:30 515729994 20089459116854946.510 true 116 28655 19783 -11683504 23774.346 1.656190033684653E9 99998855004419177.993 2022-11-24 2022-10-25T13:26:48 2022-06-07 138.8.107.3 repellat@Wordtune.edu Carpenter Junction 31
+2022-03-16T21:47:01 -700924173 43597087835894757.488 true 115 -3371 -9369 -1781241348 -15935.006 -9.67698551989422E8 99998768537510278.178 2022-07-21 2023-01-07T01:56:26 2022-02-22 173.251.108.10 BillyPatterson@Youbridge.name Sugar Alley 77
+2022-01-21T01:53:56 405529197 61167166838010741.959 true -40 -31072 -25490 1292850334 -32196.783 -6.14483966690681E8 99998748853209208.254 2022-12-02 2022-03-19T12:53:35 2022-11-26 1.41.65.135 JimmyRichards@Skyble.name Clemons Court 95
+2022-10-16T23:15:34 -1458420761 44969884991550372.471 false -20 10877 5574 -1083190436 -29883.58 -6.0318331732583E8 99998717054111542.440 2022-09-21 2022-04-30T20:43:19 2022-07-31 159.31.214.125 2Williamson@Realbridge.com Birchwood Circle 86
+2022-01-19T08:12:26 1069420461 48641501549913926.379 true -88 -21207 -17949 -358989795 -23976.33 1.204454319052688E9 99998602099384240.852 2022-03-11 2022-07-29T16:08:44 2022-05-15 12.196.143.0 qui@Twitterbridge.com Dryden Park 91
+2022-01-22T15:02:50 -1712946627 88486850141625387.602 false -43 31026 31662 223964349 31242.354 -7.45960341584651E8 99998455443281923.303 2022-12-20 2022-04-02T13:51:17 2022-06-06 115.56.41.137 JaneFowler@Eimbee.com Stoughton Place 93
+2022-08-02T06:01:31 351046507 65769339050839139.461 false 58 7055 -26702 -802851458 -4760.95 -3.9827864019842E7 99998314621099249.720 2022-12-12 2022-10-13T15:05:51 2022-04-04 180.220.39.66 soluta@Flashpoint.biz Graceland Place 45
+2022-08-17T22:48:27 -565676017 85524665042635216.550 true -105 -19148 -18398 -936458606 2016.3842 9.437143901522E7 99998289681366107.356 2022-06-27 2022-03-01T09:12:42 2022-04-24 4.114.35.116 aut_hic@Flipopia.edu Crescent Oaks Center 46
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_asc.out
new file mode 100644
index 0000000000..854bcddedc
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q10_decimalv3_asc --
+2022-05-29T04:07:47 -789106469 224953913168.281 false -2 -20724 8844 -1245074969 -6347.4688 -1.215439687058768E9 28913011806406311.945 2022-12-10 2022-11-02T22:26:53 2022-09-28 148.14.110.116 KimberlyThomas@Tanoodle.info Fulton Plaza 22
+2022-05-21T08:37:29 715001192 295451347869.709 true 39 23629 -32754 -1823668862 -18180.234 -1.813637574700689E9 6456346804537335.538 2022-12-31 2022-12-27T20:24:33 2022-07-31 201.60.224.145 JohnnyFlores@Wordtune.info Loftsgordon Parkway 82
+2022-12-05T21:37:35 -160429213 545942280027.415 false 80 7436 -8846 687387519 24064.27 -2.132744818000418E9 83505318895222282.424 2022-08-19 2022-10-26T06:47:58 2022-05-18 81.13.195.129 BarbaraPierce@Tagcat.org West Park 22
+2022-09-18T07:21:01 -366369852 656084436389.326 false -9 3850 29335 464530994 13906.77 -1.994977344890222E9 2175505787912007.691 2022-07-22 2022-02-21T11:17:16 2022-10-23 155.170.179.115 animi_rerum@Trilia.com American Circle 20
+2022-06-18T17:34:02 -658208211 656428206744.592 false -48 27172 -26231 1983716950 1054.4502 9.54529071331357E8 59614133728718616.981 2022-09-17 2022-07-28T20:56:57 2022-12-28 110.249.164.90 xAlexander@Ainyx.gov Mandrake Pass 26
+2022-05-09T22:05:07 1115035313 666861267107.644 true 79 32766 9212 450171396 -1866.4689 7.77563839932363E8 90992477662136679.337 2022-12-13 2022-03-19T09:35:44 2023-01-02 218.227.189.124 suscipit@Trunyx.biz Sauthoff Hill 54
+2022-03-30T14:54:45 71063199 804031754534.881 true -26 -17233 23381 1325780104 -7717.424 1.84952175633689E9 91654833374919592.894 2022-02-08 2022-06-01T10:18:18 2023-01-07 207.134.2.218 StephanieHayes@Zoomlounge.net 7th Lane 31
+2022-08-22T14:09:55 1492965080 828460225722.464 true 8 -20890 7535 -73825703 9222.409 -1.444812642568396E9 41957274954652166.262 2022-05-21 2022-07-06T05:32:09 2022-11-05 27.246.116.114 4Harvey@Quatz.biz Kipling Park 43
+2022-12-21T20:40:42 -712876242 835143560344.531 false 119 12521 -1493 341763481 22953.76 6.03741368661214E8 38926544549455190.948 2022-01-12 2022-08-13T06:07:16 2022-01-13 140.156.80.20 DeborahRamirez@Jetwire.org Forest Pass 2
+2022-12-14T16:11:27 1377250237 861636208375.810 true 56 22180 -7637 -1747439805 21856.328 1.477063082563715E9 42594042587766210.946 2022-08-23 2022-06-14T23:50:21 2022-11-19 39.242.210.218 EricJohnson@Buzzster.com Golf Course Court 77
+2022-11-14T13:15:25 -1973752124 900270045103.661 true -8 1831 -20566 78273074 -30708.668 8.08196311683926E8 9289472022583529.807 2022-12-09 2022-04-02T05:11:10 2022-09-02 20.150.111.99 hRomero@Oyondu.net Moose Circle 64
+2022-04-08T13:35:18 800676046 952066991241.367 true 4 19011 -10345 486535128 7727.1616 8.66323042068133E8 90517464330331470.348 2022-11-29 2022-12-31T05:44:37 2022-07-22 105.23.253.228 pFernandez@Oyonder.name Magdeline Crossing 10
+2022-08-09T18:35:16 1952267990 1051051893998.771 false -53 -26987 -9039 -355033895 -21641.64 -8.23738655422749E8 19814816503611626.392 2022-06-01 2022-05-06T20:00:39 2022-06-16 22.199.142.108 JoyceCarroll@Jamia.com Anniversary Alley 79
+2022-12-31T20:52:26 -366788314 1284601191000.995 true -82 5337 -23707 1707369917 -1361.867 1.708340177834741E9 21377893310656745.228 2022-12-30 2022-06-27T16:04:45 2022-07-07 237.32.110.81 cum@Feedfire.info Main Junction 23
+2022-07-13T02:14:12 1789084898 1362561229786.168 true 60 3174 10131 2079254538 -19499.953 -1.045203028440303E9 7972412282094692.838 2022-08-14 2022-01-24T01:46:34 2022-07-29 75.194.81.39 KathyJohnson@Divape.com Reinke Alley 18
+2022-05-29T15:54:36 1608145109 1414473603522.946 true -85 -5774 28735 191621007 10726.853 -1.732467449211401E9 90327418585674894.350 2022-11-30 2022-03-23T22:18:15 2022-12-16 249.38.147.73 5Vasquez@Brainbox.edu Towne Alley 65
+2022-08-22T03:21:23 1415857152 1419028141544.445 true 10 -346 1694 -333578251 13900.476 -1.112134277678726E9 52007129676995076.853 2022-06-18 2022-11-06T09:37:38 2022-07-30 126.211.82.252 jSanders@Roomm.net Nelson Junction 84
+2022-07-21T23:46:31 335272384 1457107238489.783 true -43 -15944 -18320 1248150534 -484.68964 -7.84732813528091E8 51785776656453601.162 2022-11-20 2022-05-22T01:30:39 2022-10-05 113.237.137.137 aGordon@Gabtype.gov Kingsford Park 6
+2022-04-03T01:58:27 1110213845 1589727276392.832 false 66 -2716 -4346 1464096993 1479.1958 -3.79576519283935E8 42813791657086925.329 2022-07-25 2022-11-10T16:23:33 2022-06-07 82.229.218.235 doloremque_ullam@Mydo.net Mockingbird Trail 11
+2022-03-14T13:44:37 1784415930 1647996775734.968 true -33 3949 3308 -1497191255 21905.285 1.106241012693313E9 47579901407103912.628 2022-09-20 2023-01-02T23:46:26 2022-04-02 78.149.140.10 KimberlyGeorge@Flashset.net Forest Street 54
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_desc.out
new file mode 100644
index 0000000000..cc112dd1df
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q10_decimalv3_desc --
+2022-04-16T18:40:21 -1010214952 99999747825367559.824 false 52 8375 28995 1328062044 -5155.519 1.247576590267535E9 1095923614063639.584 2023-01-02 2022-02-03T03:36:12 2022-12-01 127.81.56.105 dRobinson@Bubblemix.com Sherman Road 0
+2022-09-23T11:43:36 -916474103 99999732640045963.240 true 47 -27745 13671 -945279221 12600.383 -1.641240639347924E9 81062820059332745.878 2022-05-24 2022-07-16T06:34:33 2022-05-29 176.97.43.237 tYoung@Skimia.com Charing Cross Park 77
+2022-01-14T06:11:43 1430545038 99999668905903753.800 false -37 29751 -32025 -1924214800 -17488.03 -1.906916102532119E9 1518199245825383.703 2022-05-26 2022-10-05T10:32:41 2022-06-03 41.34.214.184 tempore_ipsum@Kaymbo.net Porter Park 0
+2022-09-13T20:43:08 -1344408641 99999640320859162.916 false 70 1562 -15950 114167053 -21606.701 -1.278566458297833E9 57179008381468335.649 2022-02-27 2022-01-19T10:12:12 2022-08-13 43.137.12.5 JuliaStevens@Skalith.com Scoville Center 33
+2022-10-01T18:36:11 404652057 99999634230240441.246 false -72 22590 18587 1203355781 -17286.275 -3.36294130382289E8 52582933810361935.535 2022-07-15 2022-03-22T23:07:59 2022-10-29 226.204.6.102 ToddPalmer@Quimm.edu Colorado Drive 61
+2022-01-22T01:00:14 1534958901 99999425434743386.320 true -56 -2049 25348 -1467923070 22919.861 1.075822569370258E9 89288386125599355.178 2022-07-09 2022-05-07T16:43:16 2022-12-09 105.69.100.111 SharonHughes@Linkbridge.edu Macpherson Junction 44
+2022-12-18T02:18:01 -1774129340 99999239001172237.417 false -103 -13772 -16674 1914414398 4393.039 3.07730150126997E8 97847995016045403.360 2022-04-17 2022-12-17T10:49:30 2022-01-28 149.56.180.142 qui@Browsetype.name Dahle Place 35
+2022-11-05T06:58:13 744522189 99999173920040702.700 true 90 6622 -22730 -1085894753 22869.305 -2.04906230579109E9 3271938319169910.892 2022-10-18 2022-07-06T22:41:25 2022-05-27 107.161.10.23 amet_facere@Skidoo.net Ludington Road 93
+2022-11-23T16:56:58 950224824 99999072440532391.285 true 21 6888 -21489 626221868 13896.374 -8.39726839172374E8 4350218835152252.627 2022-01-13 2022-05-12T16:29:03 2022-04-02 43.21.14.100 sequi_molestiae@Zazio.com Bultman Alley 21
+2022-10-21T03:47:04 -489035542 99999041991592107.612 true -69 29414 10058 -1993314704 -31865.492 6.64789455492839E8 3544688816701520.657 2022-01-13 2022-06-29T07:54:47 2022-07-19 176.43.134.251 NicholasJordan@Trilia.gov Monterey Circle 42
+2022-06-27T18:25:29 1666278716 99999037068648323.555 true -25 2545 830 1934706209 20796.746 -1.225709884225744E9 95560165404082727.447 2022-10-09 2022-11-15T02:07:45 2022-03-25 120.254.105.82 praesentium_dignissimos@Fadeo.org Heffernan Park 78
+2022-01-22T16:03:13 2070967367 99999002507124942.581 false 50 27647 17350 1336110107 -6784.9307 -2.127600570389967E9 90368901623776618.789 2022-08-20 2022-02-06T08:26:17 2022-01-31 94.199.87.44 JohnnyOrtiz@Roomm.com Lukken Street 59
+2022-07-03T00:28:45 -334403295 99998844514984453.994 true -89 -15411 -31625 -573722982 -6336.6694 -1.183579017709985E9 5870087526645738.360 2022-06-15 2022-07-09T01:09:52 2022-11-29 22.104.128.110 dolorum@Meeveo.name Ramsey Terrace 82
+2022-02-21T16:38:33 -1679145705 99998811574612033.430 false -125 24463 -18640 2122053485 32360.127 -9.24309285036904E8 14377693673005046.550 2022-05-21 2022-12-27T05:06:39 2022-12-14 116.53.6.137 sapiente@Eimbee.name 4th Hill 73
+2022-06-25T18:59:37 -1535092205 99998803472203687.302 true 113 15993 31947 1237162395 26000.998 -1.541666114735052E9 83656441106578636.443 2022-04-12 2022-11-29T15:00:13 2022-12-03 235.182.155.40 in_fugiat_perferendis@Photobean.info Buell Plaza 78
+2022-02-23T08:05:32 -1185372022 99998723123158129.612 true -76 17823 16276 502635722 8045.3154 -1.383947363140137E9 63988461392414815.618 2022-06-25 2022-07-07T06:18:27 2022-07-10 44.194.194.46 RebeccaBrown@Jaloo.name Gale Avenue 92
+2022-05-04T11:24:41 -1922905302 99998568819864508.395 false 35 -27529 12453 135644899 -25303.123 -1.123671605866239E9 94034450353515393.270 2022-06-16 2022-10-11T15:24:07 2022-07-21 50.254.6.198 dMills@Skimia.gov Reindahl Plaza 44
+2022-07-16T11:02:22 683483771 99998312563274227.717 true -112 12875 -25206 -1438386774 4347.295 1.506470693807616E9 88643665771885132.584 2022-01-22 2022-03-06T12:09:32 2022-07-15 101.108.186.87 NormaKnight@LiveZ.biz Gale Center 35
+2022-06-17T22:08:14 -23445822 99998108790492690.570 true -31 25999 19375 234441053 -19584.082 -5.70783230876946E8 72814161415290058.825 2022-11-14 2022-12-08T18:38:37 2022-06-22 6.10.22.70 7Parker@Quimm.biz Waxwing Hill 93
+2022-07-06T10:08:54 -1712737615 99998036695606472.762 false 100 -31303 -22809 1377576722 22449.87 -1.437888446033773E9 35445448729929966.300 2022-09-16 2022-10-02T19:13:57 2022-12-19 4.93.160.191 EugeneWright@Fivespan.name Rieder Terrace 88
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_asc.out
new file mode 100644
index 0000000000..52240a50eb
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q11_date_asc --
+2022-04-25T18:08:03 -2136089243 36803235001158739.790 true 16 -19507 8330 -573416157 24291.943 -2.044079012439694E9 98823911702020758.323 2022-01-10 2022-02-06T21:24:14 2022-08-30 145.213.37.250 soluta_velit_sint@Centidel.org Atwood Drive 52
+2022-12-02T01:59:13 -2124085593 63319058192011694.255 true 114 -23385 13529 1355190506 -25249.451 -2.063695504681695E9 16213871536504510.983 2022-01-10 2022-06-16T07:18:01 2022-11-25 139.135.53.164 JoshuaPatterson@Riffpath.org Eagle Crest Point 20
+2022-08-20T19:47:43 -2118550490 58914727532485247.351 true -102 16807 1582 -961515504 27808.71 -5.49781788171066E8 58215663511753687.121 2022-01-10 2022-07-04T07:40:02 2022-08-15 95.142.162.117 qWatson@Innotype.com 6th Alley 76
+2022-11-05T22:07:52 -2115824485 24087808672011992.668 true 66 -10258 -18247 -129687083 -2207.829 -1.789678928809944E9 67455083593991945.328 2022-01-10 2022-10-02T03:03:19 2022-09-04 122.51.165.56 RobinDunn@Kimia.mil Blackbird Crossing 53
+2022-12-14T20:24:16 -2095967062 96507502027785313.709 true -77 -1046 3582 -258412188 -9147.349 1.099851670900486E9 98832230981550821.348 2022-01-10 2022-06-01T15:40:35 2022-12-30 65.95.22.198 2Armstrong@Yambee.gov John Wall Hill 33
+2022-08-18T18:43:10 -2092967033 84464451114820192.447 true -122 -29846 2096 -1502322884 10074.492 1.58406588921841E9 60354648484131640.262 2022-01-10 2022-11-18T19:13:06 2022-12-11 1.100.233.200 JonathanWheeler@Bubblemix.net Esker Alley 3
+2022-09-06T07:08:29 -2087897275 13014564554055456.834 false -11 -29639 24830 -864417043 -27362.47 -4.42142425714961E8 23301017897934618.914 2022-01-10 2022-07-06T21:01:52 2022-11-28 70.150.117.116 mRogers@Wikivu.org Lunder Trail 42
+2022-04-26T22:37:17 -2085227401 67883758725303394.951 true 125 24891 20485 1387822597 -29551.752 -7.51503927591174E8 83490924321421189.731 2022-01-10 2022-05-05T19:26:08 2022-12-28 231.37.55.38 8Carter@Feedmix.mil Logan Place 53
+2022-03-05T16:13:25 -2080027061 71674617947241266.630 true -100 -6485 1840 -683694166 24901.457 -8.76185833240946E8 48852235830078324.720 2022-01-10 2022-12-14T07:00:37 2022-07-02 196.168.27.195 FrankGilbert@Pixope.info Prentice Pass 87
+2022-12-14T12:13:24 -2077449691 16569341791761686.932 false -69 -8072 -32585 -605877345 -22103.316 -1.433425324070884E9 29997670481504283.395 2022-01-10 2022-03-01T01:15:43 2022-06-24 170.175.139.138 esse@Linklinks.info Warner Crossing 60
+2022-01-23T13:20:42 -2077437148 16828496110699534.790 true 70 1571 -3627 -1608684637 25449.088 3.52372438023482E8 9810271127104778.377 2022-01-10 2022-01-29T12:47:14 2022-06-05 114.93.129.117 totam_aliquam@Trunyx.name Mandrake Way 30
+2022-05-03T00:57:06 -2073518326 26610224448960906.375 false 50 14702 -1550 -1033108812 12473.847 -6.3161006583213E8 14436847231070161.109 2022-01-10 2022-05-18T02:31:56 2022-10-25 242.93.200.208 lCarter@Devpoint.com Maple Wood Hill 50
+2022-02-22T01:40:53 -2070345822 46152588533434926.209 true 18 -2180 15082 -1265186829 13151.707 1.2197607452317E8 56063508279381863.367 2022-01-10 2022-11-15T00:41:44 2022-06-16 132.56.247.63 assumenda_molestiae_culpa@Quamba.mil Kennedy Circle 29
+2022-03-04T04:24:27 -2064567991 21745766435033628.720 true 48 -16478 -29574 1895980983 -29204.008 -1.522171408921843E9 53672504337973221.511 2022-01-10 2022-11-13T17:18:30 2022-06-26 86.219.99.215 KarenDuncan@Quaxo.name Jay Terrace 2
+2022-07-24T21:30:48 -2064253439 4818893478016717.292 false 41 13891 -26496 -243810128 -8276.231 3.95595458403956E8 53860411271916852.861 2022-01-10 2022-03-15T21:53:31 2022-03-15 211.130.236.133 necessitatibus@Teklist.com Talisman Drive 6
+2022-06-02T17:00:37 -2059830502 94748615728602621.360 true -14 29076 -3863 24191520 -4271.069 -2.136208546119772E9 49579391641389305.412 2022-01-10 2022-09-29T13:33:55 2022-12-12 151.174.44.99 sHowell@Meembee.mil Roth Point 25
+2022-06-08T04:14:35 -2051444231 96764243000217184.938 true 48 -9530 -13569 1890413268 11796.022 1.731528150371074E9 24782330162456582.141 2022-01-10 2022-11-12T02:07:20 2022-09-08 233.214.208.252 consequatur_tempora@Jatri.gov Wayridge Park 12
+2022-01-22T16:22:33 -2050195325 56954426225924199.910 true -34 -4666 -31031 -1773849298 6089.9756 2.119721038034936E9 82394233604701364.314 2022-01-10 2022-09-17T07:21:37 2022-09-28 213.207.238.130 CharlesFernandez@Katz.name Larry Parkway 22
+2022-03-27T03:47:31 -2037093680 34198987134748818.265 true 75 4023 -11950 48896844 6940.73 3.35736744420993E8 25279482426826273.959 2022-01-10 2022-07-18T20:01:56 2022-07-05 7.223.96.201 RobinLee@Twitternation.name Fallview Park 71
+2022-01-25T05:40:54 -2035438927 92967735922682585.853 false 95 -20718 -7608 -1852418234 26781.89 4.1762320229463E7 40181738950406136.320 2022-01-10 2022-07-03T05:27:10 2022-06-01 124.195.54.27 BrianRuiz@Yotz.info Sullivan Alley 67
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_desc.out
new file mode 100644
index 0000000000..2e316daaf6
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q11_date_desc --
+2022-01-31T11:22:31 2147171064 62858433964902277.438 false -57 25710 27708 -1083150336 443.9486 -2.86423836710735E8 85659629515126497.597 2023-01-10 2022-06-09T08:55:06 2022-05-13 142.127.205.24 FrankRichards@Rhynyx.org Maryland Pass 95
+2022-08-27T09:33:31 2143837975 15528482914420443.722 true 106 6496 13483 1146883043 -1042.6069 -2.9330997096231E8 11851817078532709.757 2023-01-10 2022-03-22T23:50:14 2023-01-06 78.38.251.75 KathyBaker@Twitternation.mil Maple Wood Drive 50
+2022-01-30T16:44:23 2141031258 90746287993996784.734 false 68 21907 -24340 1016634638 -22198.287 8.79444680816074E8 37633204902327223.218 2023-01-10 2022-02-26T10:56:38 2022-12-04 183.154.16.27 omnis_atque@Meeveo.edu Shasta Park 17
+2022-04-05T21:48:27 2140833548 67442640969144301.905 true 55 28478 -17048 867393855 -25025.035 -9.95075167042897E8 44206615458639731.626 2023-01-10 2022-12-24T11:46:41 2022-04-17 106.217.219.71 enim@Lajo.mil Weeping Birch Road 81
+2022-05-17T14:48:09 2139995069 10404865114081238.644 true -22 8503 10624 -762172645 -7851.69 1.685778554095771E9 18603007844498247.868 2023-01-10 2022-09-14T23:22:02 2022-02-27 181.226.43.236 yWagner@Quaxo.org Roth Trail 13
+2022-11-25T08:47:45 2137120100 53722728973748238.915 true 94 -24023 31438 791788416 11250.101 -1.441002296547653E9 65644625864269869.686 2023-01-10 2022-11-10T15:42:24 2022-11-02 76.246.100.125 RoseBoyd@Twitterbridge.name Oakridge Avenue 9
+2022-07-07T00:59:18 2137003315 2036546008974432.125 true -74 -8433 -8954 1057327836 14379.353 1.40471556116768E9 18172191219156250.483 2023-01-10 2022-07-12T22:20:27 2022-05-28 212.144.76.161 JudithKing@Youtags.com Namekagon Terrace 73
+2022-04-26T06:08:12 2134428023 20161304298218160.210 false 123 14065 25356 1359592390 9587.823 -1.15126135682833E8 78673083734657014.345 2023-01-10 2022-07-01T20:49:36 2022-02-08 149.89.243.7 nemo@Quatz.edu Old Shore Hill 83
+2022-12-29T01:08:21 2132496397 81344161904122194.599 true 111 28680 2039 -1862191065 29829.01 -7488369.629529 96275743577510749.589 2023-01-10 2022-03-10T20:14:05 2022-05-09 105.76.158.197 nemo@Blognation.biz Messerschmidt Point 17
+2022-11-26T16:56:51 2129501608 11588200352101124.733 false 58 14120 7978 -477632016 -19722.633 1.467067408318817E9 8090648029524509.447 2023-01-10 2022-01-23T01:33:41 2022-05-11 45.99.69.225 vitae_perferendis@Zoombeat.edu Victoria Place 87
+2022-03-23T08:43:46 2128997181 93885083872972672.219 true -76 -13413 26861 370950669 -7662.348 9.12047677759944E8 55066796449309174.770 2023-01-10 2022-09-03T22:52:37 2022-06-09 27.108.222.24 PaulaJacobs@Mita.mil Calypso Street 14
+2022-04-28T23:53:25 2128535300 59246800045440032.570 true -99 25529 -30120 -1224121458 -7418.188 -1.018512456276405E9 51228092948506456.752 2023-01-10 2022-09-01T11:19:45 2023-01-01 71.136.249.113 6Bell@Feednation.info Badeau Road 79
+2022-03-18T06:53:23 2121445015 79540867691227756.246 false -127 27056 -23918 759270155 -11075.16 1.367452304525654E9 1390141744548898.180 2023-01-10 2022-10-06T15:29:25 2022-08-01 151.87.74.252 vChavez@Fivespan.edu Beilfuss Lane 37
+2022-02-12T22:20:36 2121438078 94782206362654537.496 false 89 27846 -18231 92285843 26871.3 1.255516596279802E9 8458006545663366.358 2023-01-10 2022-01-20T16:38:52 2022-06-03 114.128.6.31 CharlesStanley@Brainverse.edu Barby Pass 4
+2022-05-06T10:24:54 2120869348 75016020435886720.191 true -62 32018 8431 -1437099419 10780.735 1.82531394142749E9 92672086784133326.690 2023-01-10 2022-02-12T17:14:11 2022-10-28 211.242.199.137 LindaFowler@Gabtype.gov Northridge Court 93
+2022-01-16T16:20:16 2120473752 45663165388620626.133 false -47 -13694 32637 226880678 27021.426 -440841.716447 50890508670557705.960 2023-01-10 2022-12-12T05:16:18 2022-05-22 11.252.109.68 6Fowler@Devpulse.name Menomonie Pass 55
+2022-10-10T18:19:20 2118735163 16315734799016695.602 false -14 -13399 5620 805215789 -25128.734 1.247336639130183E9 94167533490062711.295 2023-01-10 2022-07-06T08:29:14 2022-10-30 204.19.86.157 8Sanders@Bluejam.info Kipling Crossing 12
+2022-01-15T16:23:04 2114915255 47602509254638265.972 false -31 8525 -1795 -1713145605 6742.736 -2.006715395135593E9 36708610439067521.928 2023-01-10 2022-02-16T17:36:14 2022-07-24 245.156.208.104 KeithBradley@Wikizz.net Anniversary Plaza 53
+2022-06-11T03:00:02 2113139730 97202104508737561.152 true 56 -26934 -1186 621184115 -25364.152 1.934541410109143E9 9320633621180118.342 2023-01-10 2022-05-03T21:15:45 2022-10-30 90.67.255.60 5Morrison@Bluezoom.org La Follette Crossing 53
+2022-05-16T08:48:33 2106444088 2780964013381426.234 false -83 -19795 23289 640756214 -10731.697 -1.625470197269475E9 60792557643844173.824 2023-01-10 2022-12-13T20:24:21 2022-11-30 30.76.33.224 consequatur@Yozio.com Duke Drive 96
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_asc.out
new file mode 100644
index 0000000000..38513fccf4
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q12_datetime_asc --
+2022-03-16T06:51:57 136659331 64395973718059954.328 false 104 -15824 30286 -1288345942 13452.328 2.013437229996864E9 52515748270989673.914 2022-04-14 2022-01-10T15:58:22 2022-11-28 79.233.179.146 RoseShaw@Reallinks.com Hansons Parkway 27
+2022-05-02T07:25:25 768464342 57190870707475100.282 true 73 -11287 -27016 2125223920 13369.397 -9.87914542455395E8 95927737281775565.136 2022-03-16 2022-01-10T15:58:31 2022-11-02 7.64.65.181 gHunter@LiveZ.net Oriole Circle 73
+2023-01-06T11:05:48 -1648142465 54677204030088082.409 true 79 21739 17305 1169224340 -4452.572 1.20081587170498E8 93022819774045829.230 2022-09-17 2022-01-10T15:59:05 2022-01-27 40.60.137.158 lWeaver@Voonyx.mil Nelson Point 82
+2022-11-20T07:12:24 1983361558 37796454160530349.938 false 12 31251 2064 284792847 22777.398 -1.473178599380819E9 8708970919680269.840 2022-02-21 2022-01-10T15:59:16 2022-07-08 120.102.132.244 sPowell@Thoughtbridge.org Rockefeller Pass 74
+2022-10-21T09:03:20 1885844901 73071962951227211.188 true -101 691 -23590 -1762405078 -21995.639 1.069765955025462E9 92762103346734638.819 2022-05-21 2022-01-10T15:59:35 2022-07-24 100.191.97.165 animi_nulla@Feedspan.edu Karstens Place 82
+2022-09-14T18:30:57 140768659 64741222367067744.400 false -128 -13755 -18262 262426471 21633.924 -5.31195483228335E8 56653641156549476.421 2022-02-10 2022-01-10T16:00:15 2022-07-27 116.146.1.140 KellyRobinson@Rhynoodle.name Ilene Court 30
+2022-02-06T14:37:49 521057052 59465139356192449.348 false 77 4836 21887 -1722331533 -22314.172 4.20100818339494E8 48480346882877531.917 2022-05-20 2022-01-10T16:00:30 2022-07-16 190.218.3.220 BettyAndrews@Dabjam.com Eagan Street 27
+2022-03-19T16:24:06 -326016194 40596598384439441.204 false 124 7383 -11847 -1343544935 23186.81 1.094967105220328E9 40999081648159066.827 2022-08-04 2022-01-10T16:00:37 2022-11-28 55.128.173.30 molestias_accusamus_ut@Centimia.net Sachtjen Plaza 24
+2022-01-20T08:42:12 1724747921 73809169266134389.891 true 3 -2180 -4863 1489565814 4529.6475 -5.44494140753884E8 18739735537324630.529 2022-08-25 2022-01-10T16:00:48 2022-02-07 162.67.16.171 RogerPatterson@Kwimbee.info Mayer Park 37
+2022-06-14T21:01:15 923399288 27419844037110652.150 true 79 -2357 -3287 -1690061360 1629.2401 4.98151886869095E8 48345363723307074.113 2022-09-17 2022-01-10T16:01:04 2022-03-05 37.53.114.66 jMoore@Tekfly.biz Coleman Drive 61
+2022-12-28T11:56:23 498557725 32440480483939584.697 false 66 13736 20225 1691617002 -28770.77 1.859059050176822E9 16973456685874873.530 2022-05-24 2022-01-10T16:01:45 2022-02-02 246.158.216.208 JudithRiley@Livetube.info Coleman Plaza 56
+2022-02-26T09:54:55 1362277550 75147328732864306.841 true -87 -24980 8626 761263433 -10682.875 1.204869422496459E9 6388839377342282.941 2022-03-06 2022-01-10T16:01:45 2023-01-02 91.24.148.99 BonnieWatkins@Youspan.mil Shelley Point 16
+2022-05-11T10:49:28 -1943845626 24482199120032665.120 true -126 11051 3393 -943421338 22719.35 9.8130093209596E8 43126263209608491.809 2022-04-24 2022-01-10T16:02:14 2022-04-29 23.103.245.11 iste_et@Chatterbridge.com Waxwing Pass 26
+2022-07-12T02:39:53 -1775850306 95934991241926225.524 true 72 -12304 22172 -525005035 2814.9053 1.180996237515648E9 87964064739140948.597 2022-07-28 2022-01-10T16:02:27 2022-06-12 42.18.241.169 quae_sed@Photofeed.info Buhler Place 9
+2022-11-21T00:05 1298448426 54092119712757010.886 false -41 -31180 10183 -745289014 11504.318 1.855337786519898E9 52962315651502772.909 2022-04-19 2022-01-10T16:02:54 2022-12-14 244.178.31.4 xRoss@Zoozzy.edu Longview Avenue 82
+2022-08-29T03:32:23 1215718088 43412176476359919.244 true -65 -29943 -759 -919029408 -17602.988 1.800776109984884E9 26525877105410978.684 2022-04-21 2022-01-10T16:03:31 2022-02-19 243.219.200.88 sunt_numquam@Skibox.name Hermina Court 83
+2022-03-23T15:16:01 1451235628 62176723050646167.536 true -40 -349 -14583 279870234 8201.707 6.49885206121071E8 89665151476675946.921 2022-06-15 2022-01-10T16:03:50 2022-10-25 135.163.50.172 TinaHart@Quaxo.mil Sunfield Hill 80
+2022-11-14T07:02:32 120232690 27699597717777080.850 false -18 -29068 -2539 995049806 2349.1514 9.50574861725708E8 67069277976863468.247 2022-08-24 2022-01-10T16:04:04 2022-04-28 101.14.179.42 mAndrews@Oyoloo.mil Blaine Plaza 65
+2022-06-03T22:36:14 -581460052 72734562394852711.410 false 75 -9696 3760 -2120607157 27925.836 1.892426389237949E9 1902718679437748.273 2022-01-25 2022-01-10T16:04:38 2022-04-14 42.184.181.140 ClarenceGarza@Oyoloo.edu Longview Pass 21
+2022-12-15T06:22:43 -1054071857 79920838378941619.402 false 98 22243 -6642 1544746333 25906.867 2.08388856967211E8 70193108754677521.215 2022-09-14 2022-01-10T16:06:10 2022-05-15 11.175.29.16 tRogers@Browsedrive.name Rowland Pass 2
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_desc.out
new file mode 100644
index 0000000000..583697e466
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q12_datetime_desc --
+2022-11-08T07:08:28 -1066005916 2711322022578576.820 true -25 -4830 -259 -1468142949 -15088.466 4.18529268033892E8 28789840661393982.630 2022-04-14 2023-01-10T15:58:19 2022-11-11 206.107.251.193 TammyMorrison@Edgeify.org Kingsford Junction 58
+2022-03-15T03:06:31 668254923 3782863113844868.873 true 69 20579 14896 145374625 -8449.486 1.018012378015139E9 52901779657013709.995 2022-12-10 2023-01-10T15:58:05 2022-07-15 153.174.252.249 AntonioBowman@Innojam.name Independence Point 44
+2022-10-14T13:35:15 2019994917 71657433427323725.194 false 96 -6782 25352 1873939398 24246.695 -1.754617292596912E9 61612550972100153.182 2022-02-06 2023-01-10T15:57:41 2022-11-24 60.0.162.255 KathyHanson@Vitz.info Schiller Way 80
+2022-05-29T01:48:58 1434871175 21362173204391739.292 false 14 9189 28370 1044101396 -4874.707 -3.7166526867238E7 52080969602253262.651 2022-08-22 2023-01-10T15:57:04 2022-04-13 188.199.23.151 ut_consequatur@Rhyzio.name Hooker Circle 22
+2022-09-01T10:07:13 1366406656 68465353279837169.200 true 81 21973 -6749 -2102012999 -30858.27 -9.351878342054E7 93886043582449574.701 2022-09-17 2023-01-10T15:55:43 2022-01-25 146.121.84.65 qui@Trilith.mil Cambridge Point 14
+2022-04-19T19:55:51 1703822649 51545907153704816.772 false 127 -22998 -8483 -1616142131 -19153.855 -5.82004175644415E8 74372372862774013.562 2022-07-15 2023-01-10T15:55:32 2022-03-03 243.188.73.192 oCooper@Talane.edu Del Mar Avenue 5
+2022-03-10T05:47:01 -1675630776 82003003039149538.999 false 1 -19409 -18103 -1372334528 -16445.648 2.018283835300718E9 88912041120172355.230 2022-03-23 2023-01-10T15:55:19 2022-08-21 251.168.233.153 RyanRice@Blogtag.name Twin Pines Street 33
+2022-03-21T13:59:43 2040107942 84217493695601697.997 false 109 -12972 -2179 -1491242267 16577.234 1.47922140614803E9 26567233446731867.734 2022-06-09 2023-01-10T15:55:09 2022-01-18 182.67.131.46 tempora_et@Tambee.edu Anzinger Parkway 25
+2022-10-24T15:39:22 -1459594378 52262794985491101.647 true -42 -22407 -22094 228960686 -9769.24 2.077062938838231E9 73030258438373197.120 2022-01-23 2023-01-10T15:53:24 2022-05-29 148.98.178.220 RuthWells@Flashpoint.info Warrior Pass 48
+2022-01-25T09:01:27 2035473225 66698749489987074.299 false 77 -5329 21752 1675425771 18688.0 -8.5648146144319E7 31526757185434628.845 2022-09-11 2023-01-10T15:53:05 2022-03-11 176.150.160.60 MarthaWallace@Dynabox.info Scofield Drive 5
+2022-09-18T07:22:57 -39577789 56077931809553335.543 false 78 18504 -31816 1181353725 8534.284 5.58103010379219E8 21874588065205497.669 2022-11-25 2023-01-10T15:52:22 2022-07-18 31.216.16.216 PaulKim@Meevee.gov Stoughton Street 58
+2022-12-10T00:07:24 113755357 64870506613049853.237 true 4 19833 9929 -2077553236 23880.182 1.110814616578153E9 78470595268731167.411 2022-08-18 2023-01-10T15:52:14 2022-11-17 175.195.211.143 MargaretFields@Dynava.edu Oak Valley Pass 70
+2022-02-21T22:57:51 -1637714937 81780395964777394.730 true -68 7890 4125 981797519 2002.7689 1.587789066765131E9 52717473500355786.612 2022-10-05 2023-01-10T15:52:03 2022-05-24 82.173.6.5 LouisNelson@Eare.info Pleasure Place 39
+2022-09-19T01:45:36 -1815567027 90437876600192763.460 true -67 450 -24660 1026693250 -13756.589 6.71783949837051E8 39013162201507383.364 2022-08-20 2023-01-10T15:51:56 2022-08-17 45.45.139.39 DorothyReid@Realblab.edu Shelley Court 61
+2022-12-16T01:48:46 -1620708820 79977863841506873.394 true 125 -23288 -31304 183634480 8690.287 1.089143087804835E9 88816216187143767.419 2022-03-05 2023-01-10T15:51:13 2022-02-27 113.65.179.131 RobinAustin@Photofeed.org Dorton Avenue 24
+2022-07-08T01:02:22 1861328091 30077669685454416.324 false 99 21673 -26343 -1739516645 8052.1733 -1.891426776824317E9 89945213768006513.891 2022-05-31 2023-01-10T15:50:27 2022-01-12 15.113.29.94 bJones@Oyope.com Jenifer Street 55
+2022-03-16T14:57:47 1144803378 80982813638697367.150 false -91 -27233 -18313 1663615911 -25966.441 7.22324706023479E8 18684410454219087.191 2022-02-24 2023-01-10T15:50:11 2022-08-26 196.194.98.204 tGreen@Twitterlist.net Dixon Junction 53
+2022-10-13T12:02:35 -1347487763 57812014428142349.468 false -120 24273 7900 164864749 -17766.543 -3.03169332525345E8 32350663418360499.179 2022-01-24 2023-01-10T15:50:11 2022-01-26 2.176.226.184 bHenderson@Zoozzy.net Transport Pass 76
+2022-02-13T03:55:11 1078801732 7733188757011073.353 true -7 13590 27006 -538765858 2454.2322 -1.033081914363393E9 50694939932448239.625 2022-04-01 2023-01-10T15:49:48 2022-10-21 236.201.98.40 quasi_corporis_quos@Gigashots.net Norway Maple Circle 26
+2022-11-22T03:28:58 -117977774 15359161559210533.516 true -111 9742 -32472 1092699613 -5584.0483 -2.109555631793559E9 74430333927005549.370 2022-07-18 2023-01-10T15:49:35 2022-05-02 129.113.4.194 FrankVasquez@Omba.com Dakota Pass 77
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_asc.out
new file mode 100644
index 0000000000..d389b3a8ad
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q13_datev2_asc --
+2022-07-12T11:41:01 -2146975814 41357500306060590.461 false 64 -17725 -30892 -785473015 5554.3315 -7.07670608707416E8 39550144162788220.422 2022-12-06 2022-08-10T22:15:25 2022-01-10 189.114.136.127 rerum@Gabtype.edu Shoshone Court 22
+2022-04-01T19:59:42 -2142080488 47635055176314981.257 false -17 20839 -680 333629779 2168.549 2.97777270977873E8 39473089553015086.260 2022-03-31 2022-08-03T13:46:23 2022-01-10 35.44.130.64 BrendaGonzales@Yodo.biz Loeprich Pass 80
+2022-06-04T21:42:24 -2140044769 7783475951196088.445 false 73 -17759 20687 -2049461130 26184.016 -3.90752727197558E8 31606054951248587.468 2022-08-10 2022-09-26T11:54:10 2022-01-10 159.173.238.32 yRay@Dynazzy.gov Ludington Parkway 0
+2022-07-10T05:40 -2138529278 60338362814142329.874 false 84 26203 -11182 -317752860 -5591.201 -1.404030078790996E9 20957356361655916.898 2022-09-30 2022-09-14T09:27:58 2022-01-10 109.87.105.1 odit_sint@Eadel.biz Ilene Plaza 68
+2022-01-16T07:18:33 -2135250531 9734301943706675.434 true -2 -4906 16201 -1473092149 13383.368 1.197528990381749E9 17062190276150723.367 2022-07-15 2022-03-28T02:55:12 2022-01-10 168.238.16.209 BonnieFranklin@Kanoodle.biz Graedel Drive 74
+2022-08-31T02:36:07 -2117185324 59743261011801800.413 false 33 17176 11096 53279997 29987.072 -2.58796461657595E8 75922041112654579.450 2022-02-21 2022-08-22T11:52:22 2022-01-10 66.171.17.35 voluptatem_quas_rerum@Kwideo.gov Debra Trail 15
+2022-10-12T16:35:38 -2111769499 45558916266306430.790 true 32 6235 10922 1175989093 -2964.8184 4.36215514885263E8 59308934930266657.983 2022-02-04 2022-07-31T21:42:10 2022-01-10 141.88.150.220 accusamus@Riffpedia.edu Debra Circle 31
+2022-09-09T17:09:01 -2103366732 37340056829809766.385 true -23 3249 25341 941263660 24186.512 -2.19436971727631E8 59068318153705580.563 2022-04-18 2023-01-02T14:14:22 2022-01-10 4.98.166.245 dolore_placeat_facilis@Kamba.info Anhalt Center 29
+2022-02-28T12:32:04 -2102850466 23727314888942662.978 true -108 -24289 -31921 -2097160101 22546.42 -1.897250159100898E9 35667126626131126.265 2022-08-04 2022-06-10T05:38:26 2022-01-10 214.251.78.45 MatthewHernandez@Gabvine.net Manley Road 46
+2022-06-02T00:31:51 -2087994185 89415047244778430.524 false -108 -13241 14965 -1616908029 -14109.911 -1.779065986959512E9 65136696039133182.221 2022-03-16 2022-05-21T23:55:35 2022-01-10 233.112.66.155 qui_et@Blogtags.net Northfield Crossing 26
+2022-11-18T07:06:44 -2086738248 75063615109283038.383 true -108 -21250 -20787 -604922324 15193.834 -1.582563961727976E9 38754951253821634.880 2023-01-01 2022-01-21T06:04:38 2022-01-10 151.171.203.34 bLong@Photobug.name Fair Oaks Place 0
+2022-05-03T01:54:18 -2084730743 55868258475185633.998 false 100 30892 11474 -1003384827 -16795.324 -2.66482900229458E8 38274861901008636.699 2022-09-02 2022-09-26T09:26:39 2022-01-10 87.215.82.226 RoyGreen@Twinte.mil Mallory Point 53
+2022-05-10T06:20:37 -2082829453 67978527071141443.272 true 22 -9868 -2879 765306321 13285.469 -6.48002527053794E8 32026976534152264.605 2022-02-12 2022-06-18T11:55:43 2022-01-10 153.116.25.151 fMiller@Wordpedia.biz Sachtjen Crossing 75
+2022-05-20T10:32:49 -2081347927 53313499951075075.438 false -89 21440 6030 1628630844 13481.725 1.718778818150949E9 53774595472737928.667 2022-09-29 2022-11-08T22:25:18 2022-01-10 29.245.30.231 jCunningham@Photojam.info Moulton Hill 98
+2022-05-01T01:32:24 -2076648723 6277927567128061.983 false 112 -29763 15730 -1235400235 -21089.047 -8.46344570919055E8 63347069568442763.160 2022-06-11 2022-03-20T18:01:32 2022-01-10 36.238.7.14 oRuiz@Jetpulse.com 6th Junction 51
+2022-06-10T05:24:56 -2070474524 62397553545384420.801 true 0 -18264 -23436 410485674 26833.127 -1.006575273291974E9 73586344131503717.119 2022-10-31 2022-06-02T14:12:06 2022-01-10 204.0.155.201 HaroldWatkins@Midel.info Fallview Plaza 25
+2022-10-19T08:28:58 -2063031871 76391457194248119.941 true 88 14442 -11164 -606747075 23782.432 -3.24091037086612E8 73301955948794481.479 2022-12-27 2022-08-19T17:38:23 2022-01-10 163.138.253.190 expedita_est@Lajo.org Katie Circle 65
+2022-02-20T22:02:18 -2062115605 15624283051576902.259 true 110 -793 -9570 -1779247391 -21120.338 1.691382449493783E9 70887384831826844.935 2022-01-15 2022-01-18T11:33:21 2022-01-10 2.233.188.36 rFord@Bubblemix.name School Road 87
+2022-10-11T06:43:36 -2059031173 91679904453987552.609 true 33 32398 15066 -1151066447 30360.873 -1.943948412332053E9 1060645175254625.275 2022-07-21 2022-03-31T08:11:10 2022-01-10 53.88.162.88 quo_at@Fivechat.com Johnson Park 81
+2022-05-13T02:41:37 -2056692155 75905320909210630.976 true -100 -6983 -21686 572017053 24283.582 -7.4428889320198E7 17363153585947227.962 2022-02-07 2022-10-16T00:13:27 2022-01-10 236.40.210.234 1Alvarez@Eadel.gov Sunfield Alley 55
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_desc.out
new file mode 100644
index 0000000000..c6ed31c73b
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q13_datev2_desc --
+2022-10-04T17:30:46 2143384637 92202795681145703.263 true -120 16077 4556 -405206580 5421.973 2.86547678151814E8 4602250727469436.685 2022-09-25 2022-04-28T10:55:02 2023-01-10 122.119.146.42 JuliaBaker@Bubblemix.name Dakota Pass 89
+2022-10-28T13:49:28 2142286124 7359872474738353.652 true 48 30597 32694 -1821570699 -5880.8228 -7.42137004235877E8 84071566806744952.316 2022-10-19 2023-01-01T23:13:06 2023-01-10 189.149.118.170 yWright@Edgepulse.com Carberry Court 48
+2023-01-03T00:04:15 2141665842 45088640814925845.600 true 8 -7817 -20159 -971735894 -20806.344 1.96902070987103E9 12752024591701115.548 2022-03-26 2022-12-09T03:56:29 2023-01-10 169.220.157.133 dOwens@Quire.com Bunker Hill Pass 19
+2022-06-14T10:36:55 2137993045 80947953368783118.235 false 75 19546 -7851 2055362901 19778.533 -7.02527423306826E8 1963404328664105.324 2022-10-30 2022-09-29T17:29:10 2023-01-10 108.20.56.201 suscipit_laboriosam_tempora@Thoughtstorm.gov Heath Court 14
+2022-04-28T02:56:24 2137140915 68568089336716561.481 false 19 -21407 -21269 -488834060 354.32346 1.659679012918404E9 17802003643825419.550 2022-06-08 2022-11-30T10:35:47 2023-01-10 36.192.27.252 inventore@Feedmix.com Towne Drive 54
+2022-05-25T19:29:35 2134670263 60901110455289230.329 true 87 7511 1623 1805984845 -22132.87 8.85485624873741E8 24506148630615884.248 2022-09-23 2022-06-25T08:34:02 2023-01-10 88.231.54.12 kReyes@Bubbletube.edu Pine View Trail 46
+2022-04-21T18:35:22 2134104264 34789385857509481.512 false -67 2573 16693 1005656644 22698.537 1.159611102532654E9 45158419238749204.911 2022-11-23 2022-12-29T21:07:46 2023-01-10 244.40.39.75 tBlack@Voonix.info Killdeer Lane 93
+2022-07-28T12:01:51 2133391808 75791318869626496.620 false 92 3163 -27594 -418861716 -6281.406 -7.11646101939523E8 77537132793987835.920 2022-04-08 2022-06-12T03:53:25 2023-01-10 62.120.54.15 MartinWhite@Twinte.com Nova Court 7
+2022-08-25T08:21:04 2127263930 28357699424870651.798 true -73 20106 24978 -1548870190 18499.852 1.020422023788034E9 87364955034963175.426 2022-06-01 2022-04-01T23:10:01 2023-01-10 218.96.227.9 sMendoza@Rhyzio.net Vidon Lane 70
+2022-08-04T22:02:12 2125253359 71901728808080343.385 true 47 -24924 14315 1584792761 613.7653 4.55688160011837E8 6591133412069812.190 2022-06-14 2022-05-05T21:03:48 2023-01-10 76.178.94.123 doloremque@Eabox.name Spenser Trail 70
+2022-11-08T06:45:31 2120885163 29857375301798851.444 true -113 -30907 -31300 -43503665 27946.63 -8.90713782977671E8 79480225718806594.791 2022-12-02 2022-12-16T15:44:04 2023-01-10 185.36.183.21 et@Mydeo.name Thompson Crossing 56
+2022-02-23T01:16:51 2119921657 63998521727981116.606 false -84 -17839 9838 -593999332 -15966.607 -2.063820459840978E9 75366678047526224.766 2022-10-17 2022-12-04T11:38:19 2023-01-10 191.255.22.49 JoeBaker@Youspan.mil Lake View Alley 57
+2022-11-10T05:41:45 2119040621 11899526568093727.358 false -20 11583 -2671 624208898 -5228.81 -2.78302970328152E8 17941386887897056.118 2022-11-18 2022-01-21T23:03:22 2023-01-10 100.11.32.199 velit_commodi_accusamus@Voomm.gov Iowa Plaza 44
+2022-12-08T21:07:26 2118241217 6301898336111519.330 true 86 -21286 11190 -472027739 31261.693 9.71565646697208E8 78027879960732674.917 2022-04-24 2022-10-11T14:09:56 2023-01-10 254.19.51.141 nobis@Quimm.org Prairieview Parkway 88
+2022-08-04T07:34:19 2117900648 52619835326601404.303 true -80 6293 -3660 -1563536431 -28754.547 -1.613773825190437E9 45450228907052547.544 2022-06-14 2022-04-24T18:27:20 2023-01-10 18.71.71.254 perspiciatis_itaque_minus@Fliptune.biz Farragut Terrace 25
+2022-09-11T23:56:26 2117248310 49165450310001614.880 false -82 -14164 15408 -686141402 17675.533 9.37875378624397E8 15765069107479361.861 2022-07-30 2022-02-09T02:25:16 2023-01-10 128.58.245.73 JohnMcdonald@BlogXS.mil Graedel Court 37
+2022-04-25T08:55:49 2115025714 52813901778078833.847 true -62 28035 -15952 2080110570 4264.9404 -8.20843484546934E8 74212342808885749.980 2022-04-07 2022-09-12T02:52:57 2023-01-10 196.155.151.65 kPayne@Avamba.mil Express Road 11
+2022-03-09T04:08:22 2114964742 70882243835620622.859 true -5 7314 -12565 -1935959664 24499.186 1.573856871514853E9 90048089418607254.991 2022-09-06 2022-08-06T15:43:49 2023-01-10 29.15.71.237 MildredRoss@Talane.edu Lakewood Gardens Drive 52
+2022-02-26T12:36:52 2114887007 84842748115180769.262 false 70 -28673 8252 -1427439640 6455.6455 1.69941556957551E9 23351052108667185.335 2022-08-15 2022-12-27T12:33:06 2023-01-10 28.155.71.249 eRyan@Geba.edu Clemons Hill 97
+2022-08-29T11:12:33 2112187773 52081198872407354.000 true -14 12024 17566 -590989675 -9049.307 7.4022969373203E8 14818930632155820.939 2022-07-23 2022-11-07T23:36:15 2023-01-10 239.219.190.193 iMorgan@Mybuzz.mil Butternut Junction 72
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_asc.out
new file mode 100644
index 0000000000..dfa79d1052
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q14_datetimev2_asc --
+2022-01-10T15:58:40 -387631717 50491596287709053.348 false 79 4132 -25325 1087461642 -628.5988 1.952250555808231E9 22831880007732095.345 2022-12-12 2022-11-24T11:12:14 2022-10-28 61.225.183.165 MargaretEdwards@Tekfly.name New Castle Circle 29
+2022-01-10T16:01:50 1875364866 98578317795671280.305 true -101 16317 -22682 493160211 6647.924 -4.118583450822E7 11785036705001142.200 2022-03-09 2022-08-17T01:28:36 2023-01-09 233.142.114.64 8Black@Twimbo.org Johnson Street 67
+2022-01-10T16:02:21 576563617 14170936804202410.552 true -83 -11275 -20051 -1104825272 -24694.344 2.45343925042296E8 83652505897808471.460 2022-04-20 2022-03-14T07:52:01 2022-07-03 127.62.73.237 JasonLittle@Skinder.mil Oak Valley Center 47
+2022-01-10T16:03:23 -1816395909 85944124623622546.668 true 69 6238 -19462 105883429 29650.547 1.240988083367038E9 88963236536078959.366 2022-06-11 2022-11-10T22:08:45 2022-07-25 91.168.156.5 RebeccaFields@Thoughtblab.edu Texas Terrace 64
+2022-01-10T16:04:31 -1064005566 80284431255136857.710 false 102 3479 -13921 644536622 5325.0425 1.596685981136262E9 10610183127825981.612 2022-04-25 2022-12-08T23:01:55 2022-08-11 149.216.36.0 ChristinaRodriguez@Youspan.biz Randy Circle 17
+2022-01-10T16:04:41 742992063 87315224836228918.795 false 71 19225 -32131 1626906818 32651.121 -1.632682384887526E9 60375695436836332.771 2022-11-05 2022-11-10T11:14:54 2022-06-11 97.5.232.212 sRivera@Zoomcast.mil Golf View Crossing 62
+2022-01-10T16:04:49 -744222108 64562066838726736.278 false 85 25637 -21148 -593493650 -11450.651 -1.167904321387118E9 32585085266732240.402 2022-09-10 2022-08-08T18:00:04 2022-11-03 54.143.193.60 vitae@Oyoloo.mil Ruskin Court 16
+2022-01-10T16:05:38 -1256679026 94632541519623071.590 false 7 -21444 -16013 -1439667661 2700.9944 -1.444617894945704E9 44853498876094960.297 2023-01-02 2022-08-27T03:37:26 2022-08-04 11.8.86.176 eFields@Gigabox.org Village Court 44
+2022-01-10T16:05:45 -733803005 42526411727465526.361 true -46 18193 15477 1838898287 15033.911 -7.68768505032434E8 88488171622590599.810 2022-12-21 2022-04-14T09:10:01 2022-11-01 238.124.55.15 yWard@Yakidoo.name Northport Pass 5
+2022-01-10T16:06:02 1769095688 95858385508825939.586 false -61 -24768 8981 -1811059535 26550.553 1.898948089429888E9 6302075696085095.930 2022-04-12 2022-05-06T18:56:26 2022-01-18 70.75.107.213 JacquelineRamirez@Edgetag.edu Schlimgen Way 58
+2022-01-10T16:06:40 -1623839913 49311124665541595.480 false 30 17239 5439 -1922469617 -23665.729 -1.88884989441398E8 45755156309522466.870 2022-04-03 2022-09-08T10:57:29 2022-05-25 249.98.251.14 KathleenWilliams@Fanoodle.mil Gerald Plaza 4
+2022-01-10T16:09:50 -1431870339 44264881470360983.805 false -40 -24105 -7389 -1002197417 20793.098 -1.295938018197165E9 10862309589738237.466 2022-08-18 2022-03-04T10:00:09 2022-04-17 71.24.67.176 9Meyer@Voomm.name Eliot Street 7
+2022-01-10T16:09:54 -626724778 97458644512885827.102 true -60 -8632 6288 -1920488824 -8787.745 -1.72476970658196E8 57901851298744604.934 2022-02-23 2022-06-25T08:32:30 2022-02-08 98.159.195.141 nPalmer@Blogspan.info Kennedy Avenue 90
+2022-01-10T16:10:07 -1473750556 2790815456820904.170 false 34 -24709 -16704 -351836436 9071.129 -1.830655735609612E9 38386913868571378.894 2022-03-13 2022-03-17T14:09:04 2022-02-17 83.206.190.20 EdwardRogers@Skinix.mil Bobwhite Road 69
+2022-01-10T16:10:59 -1123086736 51492832283400442.873 true -69 7857 29140 -1898153416 -10556.305 -1.77309875898539E9 60377727563550063.665 2022-09-19 2022-11-19T14:48:07 2022-08-07 207.113.20.129 nam@Gigaclub.info Crescent Oaks Crossing 79
+2022-01-10T16:11:51 -788430590 27555656427882512.659 true 34 10628 -16106 1894961333 4313.937 -5.1092627768235E7 71134698800701686.263 2022-02-22 2022-05-11T23:40:21 2022-04-11 179.160.110.61 quidem_dolores@Jetpulse.net Mesta Way 40
+2022-01-10T16:11:53 -515031918 81258071637598243.191 true -46 909 -17835 -560944317 24897.818 -9.6981475802878E8 68736411734897767.367 2022-06-04 2022-08-11T20:17:35 2022-06-03 145.225.78.240 2Ryan@Topiczoom.name Dawn Center 29
+2022-01-10T16:11:53 1906472648 30323570439371776.353 true -64 23204 -27723 1753599187 -28017.578 -8.7412093534361E7 34175877199258167.909 2023-01-07 2022-07-02T15:40:57 2022-10-09 60.230.5.23 asperiores_aut@Chatterpoint.name Summit Plaza 70
+2022-01-10T16:13:35 -1323249438 40281101252049750.461 false 69 -14005 -17375 488331620 6671.3335 4.03622966295354E8 69297743384305331.670 2022-12-24 2022-06-09T15:30:28 2022-02-19 127.36.89.221 sed_cumque_omnis@Ainyx.org Aberg Street 53
+2022-01-10T16:13:38 1028405269 61289821142114474.254 true 68 -31254 -2346 1789547553 22300.36 1.097286253842532E9 84787711042937558.513 2022-03-02 2022-03-21T19:39:21 2022-12-02 168.182.92.190 NormaRussell@InnoZ.edu Lawn Hill 18
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_desc.out
new file mode 100644
index 0000000000..1c1d772d60
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q14_datetimev2_desc --
+2023-01-10T15:54:54 530527963 27225608586195589.798 false -97 -2229 -9276 -658660963 -6392.991 1.070207632356559E9 51697377775165538.424 2022-06-06 2022-07-04T13:35:39 2023-01-08 34.201.94.216 RogerFerguson@Brainbox.net Calypso Street 87
+2023-01-10T15:54:33 -2064827646 91851991844064745.311 true -84 -4657 14877 715518221 26711.805 1.606809192182132E9 42538622852040097.670 2022-02-16 2022-01-30T01:00:10 2022-06-27 146.164.88.114 2Watkins@Photofeed.mil Hermina Plaza 42
+2023-01-10T15:54:23 2078632063 72019727709057736.800 false 27 22579 30242 -1616359267 1131.4033 -1.620026728921817E9 83034082469706378.876 2022-02-17 2022-07-29T02:43:05 2022-03-13 54.247.61.224 oButler@Oyope.mil Waywood Alley 96
+2023-01-10T15:53:53 1995718879 80009003816572842.344 false -126 12424 10489 -464770757 21452.365 -1.298753384191263E9 63761511886741335.861 2022-10-26 2022-05-09T15:24:24 2022-08-29 10.139.173.164 KathrynBurns@Lazz.biz Green Ridge Place 34
+2023-01-10T15:53:50 192433708 23048228277112759.704 false 88 11777 3887 1603276431 -13262.567 -1.915556868466225E9 34014441659017924.203 2022-07-19 2022-07-03T16:15:42 2022-09-01 179.71.154.133 oRyan@Buzzdog.name Laurel Center 85
+2023-01-10T15:53:42 -1932505194 63623448263670416.340 false 63 2032 -11874 -1399777322 16880.77 -1.519859996691444E9 56970527355985709.162 2022-06-14 2022-01-13T22:59:40 2022-07-25 38.233.171.77 zFrazier@Fadeo.com Fair Oaks Trail 76
+2023-01-10T15:53:21 -230367489 21196940057983146.102 false 25 29019 3243 -941111571 7400.8613 -1.851388483983088E9 226348102723553.824 2022-01-30 2022-11-05T19:15:47 2022-06-17 78.99.152.130 TimothyRodriguez@Skiba.gov Quincy Street 10
+2023-01-10T15:53:20 1586087269 33316929850521405.551 false 39 3457 31331 2099786888 9167.861 7.40817506739393E8 76135761346738557.500 2022-06-05 2022-10-27T15:56:34 2022-11-28 242.215.184.220 et_non@Skinte.com Boyd Way 92
+2023-01-10T15:53:13 -1745676531 21098746824407609.260 true -96 -3790 -18552 498576598 -21261.895 2.02833954475258E9 74412367636815540.338 2022-10-27 2022-04-27T10:34:32 2022-04-28 157.66.0.200 rFranklin@Skiptube.com Claremont Place 66
+2023-01-10T15:53:07 -2018705059 76350796289203640.329 true 98 23822 10317 1916911140 13203.572 9.2911973892668E7 12249279130142689.133 2022-07-14 2022-01-13T00:35:34 2023-01-08 202.202.55.60 ChrisWest@Janyx.net Spohn Court 64
+2023-01-10T15:53:05 -747816388 47572043970529301.102 true -70 -28179 13001 -721287450 -1172.9457 -1.3783788712626E7 27935674067996655.648 2022-04-14 2022-05-08T09:13:38 2022-05-17 41.98.48.113 dolorem_consequatur@Twimm.com Namekagon Drive 66
+2023-01-10T15:53:02 1608057881 85671925794548632.210 true -68 -15487 -12409 1598998546 14191.23 3.82595692387622E8 19897840121651746.140 2022-02-11 2022-01-23T10:11:49 2022-09-26 8.217.66.147 repudiandae@Oozz.info Bowman Lane 64
+2023-01-10T15:52:06 -1064508762 28439978402783179.370 false -111 -14000 23312 261566359 -5224.155 2.083079549441855E9 43245476996773941.738 2022-12-18 2022-06-07T15:47:03 2022-02-15 102.62.212.218 5Taylor@Eazzy.org Talisman Avenue 33
+2023-01-10T15:52:01 -641966300 75184464997965549.611 true -38 22410 -7360 -453267994 2730.9773 -1.493077666188507E9 31054867297987176.544 2022-02-01 2022-12-19T05:07:44 2022-10-28 21.153.120.86 nFranklin@Wikido.org Clemons Drive 16
+2023-01-10T15:51:30 -806554627 41776560302308166.469 true 9 -29912 6653 -1508039995 29528.578 4.97728171025548E8 73019312741185243.275 2022-12-21 2022-07-17T05:36:46 2022-08-26 84.148.159.64 id_fugiat@Leenti.mil Oneill Plaza 6
+2023-01-10T15:50:49 -1235902706 62702866242320144.501 true -79 -17549 -20797 1287125300 18818.393 -2.089314157103185E9 63536403364005197.721 2022-03-22 2022-05-19T04:04:46 2022-11-10 46.211.238.210 MarkGardner@Voolith.info Schmedeman Circle 63
+2023-01-10T15:50:10 1049919668 56484137302104819.546 false 21 -25562 -15584 -1531844516 1401.4991 8.60001496950306E8 46863118513399593.572 2022-08-26 2022-07-31T15:24:34 2022-07-13 198.143.122.50 mHernandez@Vidoo.name American Ash Lane 11
+2023-01-10T15:49:43 332882194 51484756427294065.321 false -71 7766 -14400 555986434 15951.512 -8.33659684687661E8 36795573298172542.285 2022-01-17 2022-08-07T18:57 2022-06-20 249.56.248.134 LoriPeterson@Oyonder.info Shopko Point 92
+2023-01-10T15:49:36 867743322 48034921398559420.240 true -98 27378 22309 442023125 28779.576 -1.12667442379089E9 98762307453210732.937 2022-05-02 2022-12-27T09:22:58 2022-12-23 253.53.23.10 yGonzales@Avamba.org Bellgrove Park 16
+2023-01-10T15:49:10 -1945221726 56823652649349950.258 true -88 -9812 -8994 -1463310929 -23013.854 3.46004724369729E8 51179538056668726.666 2022-04-10 2022-09-07T08:44:20 2022-12-20 194.237.171.255 TimothyKing@Jamia.info American Hill 32
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_asc.out
new file mode 100644
index 0000000000..bbdfbf0440
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q15_char_asc --
+2022-09-11T06:50:01 2061922250 1754132376561068.511 false -40 27258 -5928 1496737886 5772.6973 6.06076201086729E8 60015904398688265.304 2022-09-07 2022-11-23T12:57:47 2022-07-25 0.0.112.236 nHowell@Devpulse.info Jackson Avenue 67
+2022-08-07T19:06:07 -110183145 69972174390695974.576 true 100 -20151 -19882 -619054806 23015.803 -1.437034101778622E9 15432008675859507.489 2022-04-13 2022-09-30T18:38:26 2022-02-04 0.0.141.235 vero@Oyonder.gov Hazelcrest Way 45
+2022-02-05T11:27:35 -1736389557 31046413624968009.531 true -109 28986 14238 1987535150 -15644.225 1.451063217218461E9 49113860871835022.616 2022-08-12 2022-02-09T00:57 2022-01-15 0.0.147.179 exercitationem@Livetube.biz Ramsey Park 44
+2022-01-23T09:12:02 -373426246 42362793424784481.903 false 104 27194 -14878 740957837 5517.1963 2.39950583453862E8 52088711656772050.492 2022-03-03 2022-06-17T05:23:11 2022-06-10 0.0.158.180 JoshuaThompson@Pixope.info Chinook Terrace 80
+2022-10-12T06:39:01 1485033220 64471960948135748.330 true 8 15768 22426 -918020430 16532.443 -1.48369281225366E9 45550443706866425.980 2022-08-28 2022-05-16T20:10:46 2022-01-20 0.0.173.63 culpa_ut_omnis@Cogibox.mil Miller Drive 86
+2022-03-30T14:54:03 -839244895 99436850501846431.477 true 126 -17986 -28788 564690702 13945.036 -2.008353962471632E9 2868487869278653.559 2022-09-30 2022-09-15T16:17:33 2022-06-27 0.0.189.137 qBaker@Dynazzy.com Laurel Point 47
+2022-11-24T10:09:46 1621060662 55258277581265783.545 false 9 -1840 15145 -380506944 581.4438 -1.391258038688637E9 28635299784354798.894 2022-10-03 2022-10-22T15:41:50 2022-10-17 0.0.199.186 MarilynRogers@Gabtype.gov Crownhardt Hill 28
+2022-05-06T15:53:29 748383400 63420406170608204.417 true -36 -31267 7431 -1782698096 4226.3384 -1.083150366886749E9 8129207772663429.404 2022-11-10 2022-07-09T21:16:10 2022-02-01 0.0.20.37 fSullivan@Eire.edu Mcguire Road 99
+2022-04-22T09:12:14 1208486587 48994995597883814.209 true 2 -16828 28703 -74819671 -2158.284 -1.148517068916708E9 82590226618452760.477 2022-05-19 2022-05-10T20:24:46 2022-11-02 0.0.23.196 fuga_officiis_aliquid@Chatterbridge.name Trailsway Hill 92
+2022-01-20T01:49:14 -403720874 53433470277239324.415 false -8 -23044 -18910 -1472669446 28636.297 -5.00744090095746E8 22062650149414224.482 2022-01-26 2022-05-01T06:17:56 2022-07-26 0.0.241.109 MartinMitchell@Feedfish.edu Anzinger Crossing 18
+2022-12-07T15:28:04 -1690732746 27384295151729802.390 false 54 -8332 -8218 821665409 -10875.8 -3.03226791069825E8 20040395786878026.390 2022-01-14 2022-01-25T07:09:29 2022-09-18 0.0.6.219 non_nesciunt@Quamba.biz Dahle Point 18
+2022-11-29T01:10:19 -352131903 73581216486041728.733 true 50 13436 -5439 -860164339 29512.43 -5.5725064488281E7 95721473550833224.949 2022-04-02 2022-11-29T03:46:59 2022-10-31 0.0.64.30 sint@Buzzdog.mil Linden Junction 35
+2022-03-17T18:15:01 -1109053205 68713946547667189.783 false 18 4932 -31418 -2070957788 16692.02 1.39271842729734E9 70802595134660500.380 2022-04-12 2022-10-25T17:08:51 2022-06-29 0.0.68.92 qui_a_quos@Minyx.edu Oakridge Drive 93
+2022-03-21T21:29:42 367400850 56011302765065072.792 false 90 20941 2364 1369142817 -2850.9583 -1.073191087237996E9 64557232837889758.458 2022-07-01 2022-11-02T18:30:10 2022-11-10 0.0.93.170 9Mcdonald@Ntag.name Sundown Circle 80
+2022-11-20T18:10:51 698774384 55214482096451540.655 false 66 -11060 30241 -706655319 9563.255 1.711512546331549E9 86123581066112873.177 2022-02-18 2022-06-27T18:41:58 2022-06-07 0.1.106.158 FrancesHunter@Zoomzone.net Porter Junction 97
+2022-06-27T20:18:30 2042492551 58723281040536682.941 false 104 7699 16377 -1612800915 8224.908 -1.223988811139082E9 66259336731313525.998 2022-06-06 2022-09-12T02:10:29 2022-09-06 0.1.175.230 aut@Tazz.gov Independence Terrace 34
+2022-11-08T00:13:56 -1134542266 30015106421241075.831 false -27 -259 -4519 -313282257 16304.245 1.2280493397297E8 78408058298171417.803 2022-05-11 2022-11-30T09:44:48 2022-11-16 0.1.195.216 ShawnBennett@Jazzy.edu Myrtle Crossing 7
+2022-10-14T08:30:35 -504423350 72068073088516397.143 true 4 26889 27282 1595585863 28450.484 -1.660718820204285E9 39686973033625060.755 2022-10-25 2022-08-10T06:15:23 2022-12-06 0.1.220.203 HeatherBishop@Quinu.net Fallview Lane 0
+2022-06-27T13:14:40 -1327770544 17199335182798345.180 false -113 19955 28233 -355908019 16261.51 5.28572899087892E8 64030119903544942.626 2022-11-17 2022-11-10T12:47:05 2022-01-26 0.1.244.27 nihil@Skynoodle.name Florence Avenue 31
+2022-11-09T12:34:17 406939467 12193470696400113.320 false -83 -335 18246 1700773704 27185.422 -1.383589711089231E9 54710816599500355.989 2022-11-20 2022-08-10T16:22:33 2022-02-06 0.1.34.119 saepe_fugit@Gabtune.org Burning Wood Way 14
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_desc.out
new file mode 100644
index 0000000000..32ae34d57c
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q15_char_desc --
+2022-10-08T08:41:41 315413695 87402351967250684.928 true -11 9047 -16042 1297934047 -21483.018 -2.26702700070283E8 16104896194012429.274 2022-03-15 2022-04-22T07:07:30 2022-04-04 99.99.73.10 sBrown@Cogilith.com Butterfield Park 41
+2022-07-16T03:02:43 836879246 56801583459856893.830 true -23 -14592 -26122 496203717 1772.0596 1.185438524640771E9 20080170946700327.840 2022-10-01 2022-10-25T03:09:47 2022-09-01 99.99.65.2 tempora@Tagpad.gov Sutherland Street 77
+2022-12-06T02:30 1825355576 63227915060384469.762 false -49 -11509 31496 1348925826 -29811.771 1.555339546364234E9 36073525734273916.881 2022-07-21 2022-09-28T21:04:48 2022-04-15 99.99.52.107 6Woods@Jabbersphere.org Kim Way 98
+2022-09-13T02:26:26 154177324 22835870212258864.233 true 68 32655 26442 -560202813 3579.6008 1.255404269167506E9 38063662382836804.367 2022-11-29 2022-07-27T11:59:25 2022-01-12 99.99.42.106 et@Lazz.net Florence Alley 85
+2022-10-11T11:28:20 21936678 46478461969542333.380 false -117 8231 -21782 1139137663 10938.842 -1.057008120850436E9 21895162787971921.483 2022-03-14 2022-10-07T07:39:40 2022-05-25 99.99.32.22 vHarris@Realcube.net Eggendart Avenue 66
+2022-04-22T06:23:46 -1168970205 65417203213940735.724 false 79 12895 -28578 -831904083 -31004.512 1.432690821104434E9 97049703840275279.473 2022-03-09 2022-07-01T16:12:26 2022-10-18 99.99.251.179 PhilipWard@Oodoo.edu Kinsman Plaza 67
+2022-08-25T17:05:43 1161664534 16092016026315635.631 false -6 1466 -28789 2003513669 -7275.823 -1.352268570474401E9 63693907264007526.706 2022-08-13 2022-06-22T01:11:23 2022-01-31 99.99.25.187 hBell@Jabbercube.org Nancy Point 75
+2022-02-06T09:23:20 -1533516077 63146209740350464.773 true 73 -30843 -12729 -632464735 -24846.486 -1.557415605506909E9 60732582186708126.168 2022-09-20 2022-07-22T06:14:59 2022-08-07 99.99.232.59 wSpencer@Zazio.info Westport Lane 18
+2022-08-19T12:26:30 671564995 67846104265740508.611 false -40 -26244 -28252 624092585 -28578.262 6.76825147497824E8 61408724469676584.495 2022-02-04 2022-03-09T16:06:39 2022-06-29 99.99.185.180 xReed@Oozz.info Stang Terrace 0
+2022-11-26T17:10:27 487504607 29518437746859778.487 true -119 -29809 -26159 -105456031 1036.6146 -1.719819451468896E9 26867176777263708.699 2022-11-22 2022-11-07T18:36:22 2022-05-20 99.99.164.6 LisaOrtiz@Ozu.gov Waubesa Street 26
+2022-07-22T08:01:26 -462004515 66316712668660562.390 false -53 -32713 -16081 1430690796 -29099.066 -9.4342937285693E7 272598634884611.563 2022-05-05 2022-04-27T01:36:05 2022-11-07 99.99.153.30 veniam_est_fuga@DabZ.mil Mendota Center 41
+2022-08-23T03:13:09 1611917990 11686777916746799.747 true 0 -4621 2933 -1719636659 21074.697 2.21699064875878E8 53087198341020605.170 2022-11-19 2022-01-19T22:04:30 2022-11-26 99.99.131.135 temporibus_sint@Jabbersphere.org Loomis Lane 56
+2022-10-11T11:38:23 -2104470411 983928040161651.973 false 66 -23990 -8284 -967492502 -20395.6 1.75026400847612E9 86495489904533644.698 2022-03-17 2022-05-10T01:21:40 2022-06-24 99.99.110.39 ipsam@Snaptags.gov Dottie Drive 23
+2022-03-26T23:24:15 1933610720 15402010564132004.572 true 9 -5966 -29957 568244976 -17778.19 1.083495191384842E9 41175360255408185.797 2022-10-10 2022-06-21T17:10:40 2022-04-30 99.98.7.143 JohnPhillips@JumpXS.mil Northfield Street 40
+2022-03-03T23:08:50 -827053022 19774247748352723.496 false -38 -12917 14591 -1520961109 -8798.018 1.773274879550194E9 16894403904562058.880 2022-08-20 2022-09-15T19:15:57 2022-08-17 99.98.55.187 magni_distinctio@Latz.edu Sherman Point 80
+2022-03-27T04:34:26 1004878685 99389772778275988.194 false -65 9865 10316 -1634361062 17097.492 -5.06221481685881E8 85412879871181681.636 2022-12-04 2022-04-21T08:59 2022-02-05 99.98.35.34 fShaw@Dabtype.info Warrior Plaza 98
+2022-04-23T14:33:58 -257611424 14081308502706946.151 false -123 22434 7943 252761259 -28889.205 1.134490007284071E9 98097833124037540.937 2022-05-22 2022-01-22T11:57:33 2022-05-31 99.98.225.219 MatthewDixon@Quatz.biz Lillian Hill 6
+2022-12-17T17:28:26 -1539361515 66750608328000893.222 false 80 -17729 25445 -1419632228 -16896.219 -3.44039476377946E8 67871896371312643.741 2022-05-03 2022-05-07T23:46:47 2022-08-11 99.98.215.80 wWatson@Meevee.net Sheridan Parkway 58
+2023-01-08T18:22:36 -2031164725 60319854991159903.596 false 40 7355 31824 -570808911 -26422.096 -1.03572662369708E9 42766196239369804.410 2022-12-31 2022-08-11T19:20:57 2022-10-18 99.98.201.155 pMorris@Quimm.mil Fallview Terrace 18
+2022-09-03T22:11:39 -411129909 55812779586883865.724 true 104 15570 -26366 1539982848 13558.636 -1.417665566745042E9 12781487249997112.145 2022-05-09 2022-04-13T04:19:10 2022-12-21 99.98.160.119 necessitatibus_perferendis_mollitia@Miboo.edu Kedzie Crossing 94
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_asc.out
new file mode 100644
index 0000000000..9e523fa6f8
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q16_varchar_asc --
+2022-04-07T15:02:47 1797695104 84213740854143146.702 true -75 -104 -11439 2105972372 -15571.382 -3.13416812104635E8 66211621978377773.712 2022-02-10 2022-08-17T05:42:16 2022-02-17 99.37.174.165 0Adams@Avavee.gov Farragut Avenue 98
+2022-01-21T00:17:38 -958286252 57824727639993577.784 false -120 9252 15150 2121854656 21649.045 -1.483857694140935E9 65983807817182051.212 2022-06-04 2022-11-25T18:56:01 2022-12-06 104.173.194.209 0Adams@Babbleblab.org Heffernan Place 92
+2022-05-19T02:54:37 -1920641609 97451548289298816.795 false -97 5857 -17639 529426952 -4368.816 -8.34307056540495E8 46777988452739592.810 2022-06-25 2022-07-22T21:09:52 2022-12-20 233.87.159.216 0Adams@Blogtags.gov Nelson Court 83
+2022-08-23T02:25:56 -1468347723 70456065456224859.584 false -111 -28521 28470 -550203363 6653.323 -1.26180418760216E8 30956206602610132.137 2022-02-26 2022-05-01T18:51:48 2022-02-24 124.83.205.120 0Adams@Blogtags.net Weeping Birch Park 10
+2022-12-07T06:21:39 -720211049 49333586356906756.880 false -50 -30770 32057 186813977 21040.217 -6.58404593391288E8 60727264521358083.818 2022-11-20 2022-10-06T11:29:42 2022-03-16 179.60.104.122 0Adams@Centizu.biz La Follette Point 83
+2022-11-02T12:51:44 -947135330 2411433397927536.737 false -23 17847 26665 -43853619 -11561.912 -6.09321264357218E8 55701153208270371.240 2022-05-06 2022-05-13T07:24:18 2022-05-25 231.198.214.91 0Adams@Centizu.name Pleasure Point 91
+2022-01-12T18:16:02 -1459335612 6139998172032968.178 true 100 32113 -15771 -1588076150 -19139.355 -1.829078671770872E9 48521368446241192.527 2022-10-01 2022-11-22T13:39:29 2022-03-01 132.94.71.172 0Adams@Dabtype.mil Mockingbird Place 27
+2022-11-02T20:39:12 1254335929 97649938057988199.640 false 112 25192 -6487 1714503190 14583.035 4.95256485257821E8 19137653761507551.873 2022-10-15 2022-01-20T09:11:43 2023-01-02 145.224.235.215 0Adams@Demivee.biz Lakeland Street 84
+2022-10-01T06:05:06 1801908468 65701556117586573.477 false -11 -6066 26161 1928153315 -30342.908 -7.30091520636972E8 45312953546435208.950 2022-04-30 2022-09-21T11:49:18 2022-08-10 88.234.210.202 0Adams@Eayo.biz Sundown Terrace 96
+2022-07-05T20:54:31 -148076065 33301347986256707.665 true -30 17694 -16459 -261859686 748.5687 -1.768193158119264E9 13068923230186124.622 2022-11-14 2022-05-22T10:16:32 2022-03-20 105.250.160.250 0Adams@Eazzy.name Hudson Lane 63
+2022-05-14T11:59:17 -1770745436 8357011414103597.650 false -80 27808 15056 -449189586 -15391.033 1.463640500290254E9 13327585285006091.219 2022-10-11 2022-01-15T10:59:09 2022-07-17 173.31.173.101 0Adams@Eimbee.gov Cascade Way 78
+2022-06-14T16:23:28 326305693 204101120200419.182 true -67 30729 -22645 -743982796 -31949.08 1.97803703422932E8 62257931951431274.472 2022-02-26 2022-05-12T20:37:13 2022-11-24 121.78.49.147 0Adams@Fanoodle.biz Di Loreto Trail 83
+2022-07-31T16:06:44 1114355328 49111120280429020.687 false -3 -23037 15215 1903201717 -21974.174 2.103916341460758E9 50127971203500124.220 2022-06-24 2022-02-19T19:18:41 2022-09-06 246.147.88.176 0Adams@Feedfire.net Scott Plaza 47
+2022-04-13T10:15:19 186199696 54081990138712437.537 true -108 25437 18792 -1391744433 -20749.486 -1.125399054343154E9 23960515845960565.489 2022-02-26 2022-04-28T15:57:58 2022-12-14 50.44.53.188 0Adams@Feednation.mil Susan Pass 40
+2022-11-28T04:49:21 -915405460 57864712370072939.265 false -85 -13603 -13704 1738838557 3141.5361 -2.97652470613914E8 92253318844724875.743 2022-04-22 2022-10-12T10:28:20 2022-04-02 73.208.65.31 0Adams@Flashset.com Hovde Hill 25
+2022-10-15T08:00:06 -741106301 81560892839529258.188 true 67 22996 18256 -1184298400 18545.238 1.694037939410913E9 97006674633358758.300 2022-12-20 2022-04-09T20:40:15 2022-10-20 254.254.196.98 0Adams@Flipbug.com Katie Point 81
+2022-07-16T10:12:18 -1739034249 26339656191567982.300 true 63 -2896 -4146 -380406778 -18377.836 7.84313715126075E8 48482808327324600.685 2022-07-07 2022-02-17T07:44:31 2022-05-30 18.251.165.22 0Adams@Gevee.info Sherman Terrace 70
+2022-04-30T11:09:28 1034989059 738488906565712.547 false -19 5700 9871 -738030182 -19515.191 -1.083594064583577E9 17073301499600251.902 2022-09-19 2022-12-22T14:13:55 2022-05-12 58.21.141.10 0Adams@Jamia.org Gulseth Center 31
+2022-04-30T04:36:08 -1390930139 35460428483836996.940 false -71 18179 19935 804818547 9542.708 2.74460725522634E8 31567325872879436.445 2022-12-11 2022-09-02T08:37:43 2022-11-27 156.83.149.87 0Adams@Janyx.gov Holmberg Street 65
+2022-10-17T11:43:29 -673738377 91245669539822906.596 true 87 -833 7738 -1062114366 -12725.854 9.43055268902166E8 4892436008635635.900 2022-12-21 2022-02-17T03:42:39 2022-03-10 72.231.231.72 0Adams@Jetpulse.info Hudson Point 36
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_desc.out
new file mode 100644
index 0000000000..a4d7a1b2a2
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q16_varchar_desc --
+2022-02-14T20:02:32 2019660998 55904519836354353.576 false 48 -206 -13596 -1766766472 -20109.396 -1.814550838401074E9 36738629026567407.620 2022-08-14 2022-05-17T08:00:22 2022-09-02 82.50.188.139 zYoung@Zoovu.org Southridge Street 61
+2022-07-23T06:53:43 1659265921 9139328414562640.904 true 105 12042 8442 480642288 18212.434 1.612014975253071E9 88102591439342972.100 2022-04-07 2022-03-28T16:41:14 2022-06-15 155.113.194.128 zYoung@Zoomzone.biz Grayhawk Pass 31
+2022-12-06T01:22:58 -1745784945 83540556062899645.243 false 124 -26762 7919 -1035341289 16691.45 -2.069415625024853E9 54041227921821380.948 2022-10-07 2022-10-12T02:15:34 2022-11-12 125.131.195.30 zYoung@Zoomlounge.mil Colorado Court 11
+2022-01-22T11:56:20 -479842162 95698629984115168.828 true -6 -16750 9289 -708802434 14229.186 8.5574561107844E7 93561682246078815.634 2022-06-11 2022-03-21T15:17:25 2022-03-29 172.75.247.140 zYoung@Zoombox.edu Kinsman Center 19
+2022-01-17T01:23:40 777654849 45278827571542119.859 true -5 -7679 -22953 16025651 -4613.541 -2.42846385460306E8 97483452045750237.306 2022-11-22 2022-04-17T18:27:44 2022-09-09 184.6.134.120 zYoung@Yambee.name Westerfield Crossing 46
+2022-08-06T10:18:27 -760779777 26868460766500939.216 false 95 13887 25602 -583887194 -3448.5054 2.138515855115856E9 37163265296852857.422 2022-10-02 2022-06-12T23:04:11 2022-06-12 85.206.42.73 zYoung@Wikibox.com Prentice Trail 13
+2022-02-13T16:35:41 1863815904 96543754932550314.714 true -25 -10937 25627 857866364 26096.742 1.90183660005557E8 31524755859798316.256 2022-06-21 2022-04-21T01:33:02 2022-07-02 88.99.133.147 zYoung@Vinder.org Canary Parkway 91
+2022-03-08T18:24:22 1254569160 80594090908020998.259 true -16 -13154 -28240 403222972 16686.61 -1.841377578067562E9 24510591458871527.248 2022-01-16 2022-10-17T19:46:19 2022-08-03 228.150.118.114 zYoung@Thoughtstorm.edu 4th Alley 74
+2022-05-19T14:15:50 -1197424578 45338212877606335.505 true -106 -18713 -14604 214175844 -3836.9036 3.9589229240208E7 16960757975659393.635 2022-11-14 2022-11-12T15:25:34 2022-07-11 217.139.233.131 zYoung@Thoughtbridge.mil Continental Drive 67
+2022-10-01T07:25:51 -1790889154 17703206212211138.234 true -40 31641 -25862 -1404707906 17343.885 1.737692320515817E9 53286004790989688.316 2022-07-27 2022-12-18T17:53:45 2022-09-29 94.170.177.234 zYoung@Skippad.net Charing Cross Center 52
+2022-01-24T17:25:20 -173107591 17487145059280950.480 true 60 22867 1052 -1409233094 -13404.633 -2.007737794671291E9 21642190053674066.564 2022-09-05 2022-10-14T12:56:17 2022-09-21 99.250.199.1 zYoung@Skipfire.edu Westridge Park 76
+2022-08-12T07:54:47 -2010582449 14360639605714550.978 true -56 14452 31524 -1047322258 4297.5596 8.145848157256E7 86993882380386051.986 2022-05-24 2022-11-02T08:52:45 2022-12-20 120.48.217.151 zYoung@Skinix.gov Jenifer Trail 28
+2023-01-03T23:15:04 725748224 88133313515558712.623 true -128 -31831 3182 1293378306 -14287.929 -1.985905340225478E9 71383661629105444.358 2022-11-29 2022-09-09T08:37:51 2022-01-20 18.164.94.137 zYoung@Skinder.gov Utah Hill 49
+2022-06-12T17:09:21 -905799624 18880042539531098.275 true -108 -24818 -24568 -1948006796 31817.932 -1.029835834870436E9 41086919080271309.256 2022-02-26 2022-11-13T19:40:45 2022-05-02 73.170.53.26 zYoung@Skimia.info Ronald Regan Road 49
+2022-02-20T02:50:44 -185110644 59552996290687282.400 false 117 -24002 -20806 -1038995074 14082.866 -1.921400240189578E9 78346053662501348.604 2022-07-15 2022-08-12T19:45:12 2022-08-18 241.111.54.249 zYoung@Rhycero.info Graedel Street 59
+2022-10-30T09:03:23 65392670 30356364161196306.520 true -48 22867 -5527 -1126401313 21589.85 -5.7482620780016E8 48592779402668399.669 2022-04-11 2022-05-19T21:26:49 2022-03-04 45.108.243.171 zYoung@Realbridge.biz Michigan Trail 16
+2022-09-15T05:03:12 -1800346257 49621957955099644.862 false -44 -23721 -16271 -1292692094 30569.791 -1.767617706908059E9 10447827669552088.565 2022-04-08 2022-07-16T17:41:06 2022-10-28 238.237.183.93 zYoung@Quinu.biz Crest Line Alley 29
+2022-06-05T08:57:17 718634291 76046921382683024.570 false 100 4563 -3620 -365945168 -23038.889 -1.095987274354548E9 27228007073316839.814 2022-07-13 2022-06-02T02:47:42 2022-06-18 131.175.168.11 zYoung@Quimm.name Cordelia Plaza 64
+2022-01-25T21:33:50 -265423504 57813067390186827.587 true -37 13813 11564 1262073599 3595.745 1.51725892560408E8 49243869281888627.621 2022-10-02 2022-08-02T11:03:01 2022-02-17 236.31.247.40 zYoung@Quatz.name East Center 51
+2022-08-30T07:23:47 1745631368 143626455306392.438 false 3 11152 23332 1775459731 1700.391 -1.04266610682783E9 89305210055280091.734 2022-06-04 2022-06-16T19:46:02 2022-08-16 131.249.239.87 zYoung@Oyoyo.biz Stuart Park 73
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_asc.out
new file mode 100644
index 0000000000..c48c72841b
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q17_string_asc --
+2022-05-04T12:36:15 -1627101797 89644326556158513.379 false 7 -6579 -4583 -1654417357 27475.512 -7.72179757635776E8 5106404149572992.768 2022-10-08 2022-10-23T21:29:23 2022-11-22 203.19.103.240 VictorMyers@Realbridge.mil 1st Alley 12
+2022-12-05T18:43:08 1750833797 34872247060725414.103 false 74 -23326 15941 891145292 -5566.2886 6.4382361116976E7 52189184506203487.310 2022-03-06 2023-01-09T20:39:13 2022-04-26 143.232.171.53 nobis@Browsecat.mil 1st Alley 13
+2022-01-13T00:52:13 -864425143 16604520726130112.540 true -12 15806 -20284 -1233425583 6070.7563 -1.687605190786361E9 93797407399565913.962 2022-06-12 2022-09-12T07:57:08 2022-05-20 132.111.222.23 zFrazier@Vinte.gov 1st Alley 15
+2022-05-30T05:06:41 -487765455 85156661075679181.191 true 116 19545 24523 -744291975 14334.146 -1.370426800828882E9 24415617793165219.823 2022-11-22 2022-12-02T10:41:46 2022-05-13 227.128.59.245 dolorem_maxime@Plajo.name 1st Alley 16
+2022-03-01T00:39:57 1293233069 66535740915975078.367 true 101 -11983 22518 1720627422 -1102.1978 -1.5211350824911E7 61032815302357696.530 2022-08-13 2022-02-15T13:12:26 2022-10-05 252.11.32.94 rDay@Dabshots.net 1st Alley 16
+2022-07-29T03:10:35 2002724802 66897979016479933.675 true 14 7586 -30868 1763447185 -23086.096 1.85638128615846E8 24041567062979912.765 2022-06-15 2022-04-22T07:16:02 2022-12-08 68.176.214.175 BettyWarren@Browsecat.edu 1st Alley 18
+2022-09-28T18:08:16 -766929243 52482249297349333.699 true 42 4139 -22365 561391544 -19803.291 -1.065853626171658E9 15610738818188781.565 2022-07-01 2022-03-31T07:09:51 2022-01-13 223.83.173.58 possimus_et@Minyx.mil 1st Alley 19
+2022-01-11T01:13:25 140324916 15916441852690239.231 false -93 4940 -29817 -1600969036 4689.1763 -2.06639748964639E9 51555626034242289.996 2022-04-04 2022-01-13T20:12:48 2022-05-04 252.64.86.251 eum_expedita_molestias@Feedbug.edu 1st Alley 19
+2022-02-13T14:33:28 -92138496 32641466394086614.649 true 85 18149 18969 1496123550 1554.6405 -2.86568393056742E8 40045618626472403.297 2022-12-18 2022-04-28T21:13:46 2022-02-24 69.238.217.1 sit_doloremque_quidem@Podcat.name 1st Alley 2
+2022-11-16T04:01:03 -1953153949 59107956519203663.641 false 70 13772 -3666 794516042 30508.299 -3.6696945276336E8 24271391813829958.167 2022-06-09 2022-02-12T20:25:46 2022-01-29 211.200.144.103 quae@Mybuzz.com 1st Alley 23
+2022-09-04T09:34:12 1331727343 10731295967421040.309 true 106 -31165 29111 1878010588 23252.588 -1.231731682067512E9 80664184950286523.256 2022-09-08 2022-08-16T16:35:28 2022-01-25 240.54.161.78 mHoward@Teklist.info 1st Alley 25
+2022-03-20T23:04:57 64676326 15981739244075342.717 true -46 -16521 -22293 -1602922021 15013.503 9.42511173939751E8 27773242362015829.371 2022-10-26 2022-04-12T06:46:28 2022-11-21 52.176.134.155 voluptatem@Skynoodle.mil 1st Alley 26
+2022-09-30T14:24:20 1353141153 23553265743374278.450 true 112 8609 13724 883070966 -25159.037 -2.140929160065219E9 23406056908281689.749 2022-08-25 2022-12-05T14:00:56 2022-08-12 39.131.108.169 tLarson@Jabberbean.com 1st Alley 26
+2022-06-07T23:55:47 1499825638 61330784035771336.193 true -105 7183 -28526 -1607553214 12269.968 -1.761041511613938E9 42798595719558090.580 2022-05-17 2022-08-20T20:21:55 2022-04-03 196.44.104.55 ClarenceNelson@Voonyx.org 1st Alley 26
+2022-02-28T06:38:23 1151877578 58742070671324246.252 false 107 1019 22572 996484353 -9232.662 -8.04361595870219E8 77889185630116813.498 2022-11-30 2023-01-02T04:34:16 2022-04-01 74.199.167.167 MichelleStewart@Eire.name 1st Alley 27
+2022-08-29T15:21:22 451804115 35143558808840530.861 false -40 -9632 21176 1696491377 -12843.192 3.79427988057741E8 15638281725428596.745 2022-05-13 2022-02-19T10:00:08 2022-03-31 161.16.206.176 EmilyTorres@Wikizz.info 1st Alley 29
+2022-10-01T16:32:50 -416573763 53800078998086841.650 false -122 -31053 -8072 -96380668 -22764.047 -1.359660555702382E9 19869290518855525.928 2022-07-16 2022-12-22T21:49:30 2022-10-11 143.68.82.222 0Warren@Dabtype.com 1st Alley 3
+2022-05-03T18:21:10 -1973158190 17155322170144469.269 false 117 -17762 20701 -1241485587 -24601.283 6.72091766154775E8 54548642673501144.185 2022-03-01 2022-11-21T05:16:50 2022-10-22 64.143.247.4 JohnRiley@Skajo.mil 1st Alley 30
+2022-06-25T05:22:10 1504641832 46265893863186851.662 false -37 -2518 -2859 -308301378 17676.936 -1.800508497969299E9 54361167905408506.274 2022-03-23 2022-04-03T07:18:06 2022-01-11 94.218.6.31 rem_occaecati@Npath.net 1st Alley 31
+2022-10-21T19:12:29 -1969397161 83480590743076696.507 true -101 -27798 -21430 1096940579 5275.2524 1.36416645484735E8 29219757547674036.584 2022-02-21 2022-07-02T17:46:09 2022-07-28 87.176.129.84 ArthurJenkins@Twimm.net 1st Alley 33
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_desc.out
new file mode 100644
index 0000000000..8229e1888b
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique1_nonkey_topn_q17_string_desc --
+2022-04-22T12:09:06 -2099239257 68427975603194356.948 true 63 -11603 3603 215943754 -20036.201 4.20506006996905E8 79486202597669846.661 2022-10-16 2022-06-11T18:46:40 2022-02-07 107.130.185.130 TammyRoss@Pixoboo.gov Westridge Way 96
+2022-04-18T10:48:43 314894420 2098173440227552.250 false -13 -21521 20792 391302757 -26360.688 -2.130985315271908E9 21030644542468258.957 2022-09-01 2022-01-20T09:09:35 2022-08-31 198.171.156.31 RandyDiaz@Yakijo.mil Westridge Way 95
+2022-05-27T21:08:53 -1897423790 84310229524119763.590 false 42 -26805 3875 375837646 -13273.37 6.9697487758171E8 42884975833855223.353 2022-07-14 2022-08-15T18:14:46 2022-11-01 70.151.162.7 nobis@Pixoboo.com Westridge Way 95
+2022-12-07T23:08:20 -365199063 34845826481852959.468 true -8 29043 -17756 61604339 -14375.166 1.132912438548864E9 82889461616174859.743 2022-10-02 2022-01-24T14:16:52 2022-01-14 174.51.38.80 LarrySmith@Roombo.net Westridge Way 94
+2022-10-06T14:19:54 620394269 80295423676735577.609 false 57 17148 -713 -595208350 14440.632 -4.16626631409584E8 49563225865731116.263 2022-08-14 2022-05-21T08:57:32 2022-08-09 219.175.201.6 CherylBrown@Blogspan.gov Westridge Way 91
+2022-04-27T07:23:22 74622799 65660071267706921.327 true 46 -20041 -25147 1731721011 -5553.182 1.138268469627672E9 47073624330727067.681 2022-11-03 2022-03-18T22:31:21 2022-01-17 8.96.132.28 6Wallace@Kayveo.info Westridge Way 91
+2022-11-19T08:16:56 330605379 47139795015533125.459 false 66 4914 -5871 -676471521 -20194.97 1.02628849302948E9 48101486995500295.358 2022-08-19 2022-08-27T09:31:33 2022-10-29 240.88.201.114 quia@Twitterbeat.net Westridge Way 90
+2022-03-11T15:03:41 70154103 5270698736150700.302 false 65 -3132 25334 -1714376369 -19339.865 -1.757875633009279E9 78923550065287892.761 2022-09-13 2022-02-19T12:54:16 2022-05-20 146.114.119.163 7Lee@Jabberstorm.biz Westridge Way 9
+2022-09-25T17:02:16 1771425675 11360144073035110.860 false -37 -31048 7539 299951714 17394.299 4902695.642423 18550221340526293.213 2022-04-19 2022-01-26T21:15:21 2022-01-17 90.111.218.36 uGarcia@LiveZ.gov Westridge Way 89
+2022-04-22T22:56:40 -146034629 15123111098081104.340 true 1 -29290 23259 -792220741 -16748.357 -4.39889132616518E8 7675275209982281.850 2022-03-28 2022-01-17T07:31:19 2022-11-13 162.122.150.229 et@Chatterpoint.mil Westridge Way 89
+2022-10-29T05:22:13 -900428298 56007378700458463.351 true 88 -5452 20614 740440588 23007.346 -1.662857591934437E9 877863554691558.898 2022-07-07 2022-12-19T21:38:45 2022-10-29 3.167.101.33 rerum_aut_dolores@Oyonder.edu Westridge Way 89
+2022-12-24T20:54:18 -1519565861 22571648105451090.654 false 62 -11190 29625 818425899 20055.523 -1.561890863176794E9 22076739850886636.520 2022-05-30 2022-10-08T04:45:40 2022-05-05 147.80.140.38 yGonzalez@DabZ.name Westridge Way 89
+2022-11-19T00:17:54 -1295454768 29969096078554471.481 false -67 -5097 -15138 -972205738 20271.934 -1.800836466541678E9 38544426212096088.530 2022-06-21 2022-09-20T15:56:01 2022-10-19 23.81.121.178 ex@Twitterbeat.biz Westridge Way 87
+2023-01-10T12:21:52 -1689662597 65230640004270083.875 true 31 12180 -6122 2001417237 -13576.946 9.21989416750725E8 65669183802887664.711 2022-06-26 2022-06-10T03:12:46 2022-11-03 197.82.90.185 similique_suscipit_debitis@Rhybox.edu Westridge Way 87
+2022-03-16T10:21:57 -1267821738 62312436470384583.290 true 17 29317 27364 -1256756498 26649.877 -3.25197861948544E8 56386698141704941.483 2022-05-31 2022-12-24T12:04:06 2022-03-17 62.179.6.11 cHicks@Wikizz.info Westridge Way 86
+2022-05-11T20:44:46 -2021819558 6695578893767881.911 false 35 -23474 4358 -1105824380 18573.38 1.922391897886631E9 57744065520145976.231 2022-04-11 2022-07-10T18:02:20 2022-05-24 80.237.166.177 iAlvarez@Tagopia.com Westridge Way 86
+2022-08-30T10:57:06 1332889445 1042711916750383.473 false -100 25858 -851 1058738313 -26333.469 1.920784533754478E9 54698007295776299.290 2022-08-20 2022-04-26T10:09:36 2023-01-01 146.171.143.208 LawrenceBrooks@Ntag.com Westridge Way 80
+2022-12-12T08:01:09 -1475233551 53233051136435203.685 false 67 -20298 12904 42003257 -1733.4249 1.291079052928937E9 99906662946434400.570 2022-01-20 2022-08-18T04:15 2022-08-16 226.137.150.145 8Carpenter@Blogtag.com Westridge Way 80
+2022-05-27T03:41:43 2022813179 96854679979479728.502 true 24 31559 -3815 -1927482006 6423.038 -1.99428251937564E8 47736023841899638.552 2022-09-18 2022-09-16T10:33:40 2022-04-16 10.230.38.117 StevenSimpson@Voomm.gov Westridge Way 8
+2022-09-10T20:38:29 -1997486447 28102352307302453.552 true 1 25701 -5014 -99345622 4059.546 -1.74320200146372E8 93568203003475872.662 2022-03-03 2023-01-06T22:36:20 2022-02-28 136.24.182.227 debitis@Buzzdog.gov Westridge Way 78
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_asc.out
new file mode 100644
index 0000000000..e8f362b854
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q01_bool_asc --
+2022-06-13T07:08:23 -2147483358 16697470310045199.514 false 0 21661 27910 50137345 -31890.162 2.5182778747432E8 8892361240908133.332 2022-03-29 2022-05-06T07:35:41 2022-02-20 86.198.4.14 tHarrison@Yotz.edu Ohio Terrace 97
+2022-07-16T17:14:43 -2147480317 10126355674710455.926 false -106 25720 2137 -1044710620 19297.592 -4.6721094672452E7 74446297684183183.297 2022-02-12 2022-02-10T22:47:34 2022-08-24 176.57.174.210 2Jacobs@Oloo.edu Sunfield Pass 74
+2022-03-12T18:09:32 -2147474804 5170475614524523.563 false 81 -17173 20232 1094003829 -21709.188 -1.487469632520682E9 37494213942760235.318 2022-03-29 2022-07-02T11:19:41 2022-07-14 222.252.244.150 at_non@Feedbug.biz Division Parkway 27
+2022-02-07T15:19:07 -2147474201 49303092715634273.638 false -39 -17552 22077 819770754 3815.9624 -3.07788874880729E8 22473676566411893.142 2022-02-17 2022-07-22T02:13:31 2022-07-02 176.107.188.43 ipsa@Photobug.org Algoma Center 6
+2022-11-04T19:40:54 -2147468104 27727896561928356.763 false 82 28127 -16794 953496574 -2973.964 1.538181391859708E9 55664064661456781.100 2022-07-30 2022-04-25T14:47:28 2022-12-25 93.64.145.202 SarahOliver@Topicblab.net Shopko Alley 97
+2022-09-02T05:05:13 -2147464684 52641288250964188.795 false 114 -15050 4397 1467965089 24381.705 -6.7825676777073E7 89275295308566490.932 2022-11-01 2022-06-23T04:06:05 2022-09-30 30.43.252.68 lDiaz@Kwideo.info Quincy Road 30
+2022-06-20T17:19:49 -2147452176 42963905746019101.945 false -85 -5897 -29349 1525786458 13439.43 1.580339430307399E9 4315552136410587.989 2022-01-19 2022-01-30T20:58:15 2023-01-02 204.35.13.187 DonaldOwens@Gabvine.com Continental Crossing 89
+2022-05-02T20:24:54 -2147449203 26373576153379339.703 false 100 5626 10817 -1071291634 -32229.045 -3.63129015178875E8 12284411005290507.833 2022-11-01 2022-05-13T23:57:47 2022-06-29 142.56.17.46 9Price@Fliptune.net Monument Hill 80
+2022-12-12T15:38:03 -2147447412 11774006348685852.217 false -128 -12502 18730 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 2022-06-13 2022-06-08T00:10:42 2022-01-19 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+2022-09-09T18:14:23 -2147445583 48715652698659874.382 false -106 -18847 28383 -249047381 -25610.389 -1.172353483917956E9 29809461999773154.513 2022-10-04 2022-03-22T06:00:02 2022-11-08 86.232.2.134 odio_distinctio@Einti.com Mallory Place 2
+2022-09-11T03:05:51 -2147440231 34028908311454481.592 false -98 3388 -7469 -520983933 10625.003 2.03995201402268E9 3462857055462597.650 2022-01-26 2022-11-01T00:41:21 2022-08-16 129.54.117.50 amet_ea@Quimba.name Butternut Alley 71
+2022-03-04T17:56:58 -2147429509 89258793731621871.659 false 126 26815 -11284 -688010171 27046.46 -5.27072353971484E8 66247237013637477.644 2022-10-01 2022-09-08T08:07:23 2022-07-21 8.115.159.161 AnthonyGriffin@Katz.edu Fordem Plaza 6
+2022-12-02T03:44:10 -2147429313 61886285781136168.806 false 110 23694 10888 2044460430 15311.488 1.375307496401204E9 53151235042978489.270 2022-08-11 2022-10-20T13:09:41 2022-05-13 193.174.176.52 JoyceChavez@Eayo.com Bay Place 92
+2022-01-24T23:50:40 -2147426673 89764720990212770.220 false 14 -1228 32445 -1925449184 32501.54 -2.39912871351486E8 55348475727816727.866 2022-12-10 2022-01-16T21:35:19 2022-04-12 18.231.153.73 8Clark@Kare.info Manley Place 39
+2022-02-27T06:18:59 -2147394395 14678495134516321.939 false 26 -30748 7400 1258683172 -27487.441 4.33082826182803E8 45348180393347858.264 2022-04-09 2022-10-04T18:07:27 2022-04-13 144.218.112.167 BrandonHart@Gigabox.gov Lakewood Hill 77
+2022-10-15T02:27:14 -2147383849 57756485700967354.947 false 52 2101 27388 -511873914 13334.803 1.406773860292186E9 93516878967509776.434 2022-06-04 2022-05-10T05:58:30 2022-04-10 151.25.124.55 bGutierrez@Realcube.gov Bultman Pass 95
+2022-09-12T03:34:38 -2147383439 29228393040815920.274 false -67 -11231 -2125 -1738258888 28451.842 -4.49988538175004E8 28398963940839059.717 2022-12-01 2022-06-16T08:26:30 2022-03-19 140.243.38.93 rBell@Youbridge.info Dovetail Terrace 51
+2022-06-16T12:08:56 -2147369442 95280790050572342.278 false -24 -21797 -23643 -789601264 -29951.023 -1.094422939727163E9 83680832437281060.324 2022-12-30 2022-10-09T06:30:35 2022-06-23 65.65.41.22 NicoleBlack@Vitz.com Marcy Avenue 83
+2022-09-14T05:20:55 -2147360972 34160135921220642.561 false -70 -29980 14978 -1782596577 22961.69 -1.458730846514128E9 71947137678798367.780 2022-05-02 2022-12-28T23:38:41 2022-12-10 192.115.131.183 quaerat_rem@Voolia.gov Sachtjen Road 56
+2022-08-07T09:34:26 -2147356155 10694832387001448.166 false -99 -31982 15642 2037570311 -28052.602 -1.251616108720754E9 56934260571029675.510 2022-12-23 2022-09-02T08:08:49 2022-05-30 156.238.169.183 animi_quidem@Eidel.net Springview Plaza 31
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_desc.out
new file mode 100644
index 0000000000..23c8afca95
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q01_bool_desc --
+2022-01-28T07:05:42 2147473376 45825484466840064.118 true -23 -15598 -10213 -794130865 25225.979 -1.060667482169878E9 19712527510160101.667 2022-08-23 2022-09-07T09:37:41 2022-06-06 199.195.172.243 BenjaminGreene@Devify.org Hoffman Road 93
+2022-10-26T15:14:11 2147467668 17196762472988513.310 true -5 28431 -17708 -947082776 26115.467 -1.064859020746046E9 12851908920109725.570 2022-12-17 2022-11-09T06:13:10 2022-05-22 14.249.104.252 qMarshall@Yamia.mil Schurz Junction 33
+2022-05-18T22:01:25 2147447138 50480005137427111.177 true 28 16452 -30571 -2075189185 22385.588 -3.55214861990496E8 11932816216934343.652 2022-08-23 2022-10-21T03:38:58 2022-10-21 234.3.203.12 CarlMurphy@Wikivu.biz Northport Way 26
+2022-07-11T06:10:41 2147446227 39942552524190612.962 true -65 -22474 14929 1989464327 9511.273 5.86654785560309E8 79596075449045726.816 2022-11-07 2022-06-21T12:58:35 2022-11-24 19.107.68.34 tSanders@Jaxnation.biz Farragut Point 44
+2022-06-13T04:42:29 2147444078 80627252554457775.754 true 91 -17156 8627 1521831153 11225.079 2.09693779861494E8 8183865884308683.425 2022-11-08 2022-04-03T00:29:22 2022-03-20 233.68.240.228 3Martinez@Browsedrive.info Donald Crossing 7
+2022-07-10T04:17:41 2147434485 1432088841386171.665 true 28 22783 -31955 -940172357 12963.05 -1.015348724865612E9 21415159800393256.390 2022-09-01 2022-09-17T21:00:35 2022-04-11 234.6.225.52 MelissaHenry@Realpoint.biz Bultman Court 97
+2022-03-26T23:37:01 2147432357 56924709102413625.675 true -111 24610 -30943 -1776521623 -7130.226 -5.00592536993921E8 16271114464316416.681 2022-03-24 2022-01-23T12:31:45 2022-05-28 58.48.43.183 ChrisJacobs@Buzzster.name Leroy Pass 32
+2022-08-24T06:52:46 2147425822 33378418596041889.584 true -17 -3026 29468 -1873981318 25636.371 6.43280347073812E8 90354184407027392.172 2022-06-28 2022-02-24T12:47:51 2022-10-15 97.226.248.251 qRussell@Cogilith.name Kings Place 83
+2022-05-04T22:35:17 2147425482 6517881695345385.105 true -1 -17372 20231 635029396 -19429.021 6.56125881323546E8 7165704130056347.115 2022-06-13 2022-12-05T18:10:15 2022-12-05 243.50.186.81 ErnestFlores@Thoughtbridge.com Dixon Court 53
+2022-07-05T21:37:51 2147419311 28290293258808439.134 true 26 16950 8811 1233278399 -103.00702 1.520246238447387E9 88652736846204706.947 2022-03-10 2022-08-07T15:58:44 2022-05-23 133.108.194.1 DeniseRamos@Shufflebeat.net Mifflin Junction 55
+2022-08-09T07:43:48 2147375954 28228200342554508.463 true 15 -29566 3184 1446182442 27525.846 -1.443946518312972E9 17957789229933477.747 2022-10-04 2022-01-26T03:41:36 2022-11-04 119.180.253.71 beatae@Gigazoom.mil Warbler Center 96
+2022-05-28T17:02:01 2147373423 1637907410895731.258 true -96 10681 20459 1339500570 -11608.654 -3.93375885580383E8 36042489765482544.378 2022-03-13 2022-03-12T22:06:49 2022-02-06 44.122.107.86 JaneMorgan@Meembee.gov Washington Plaza 39
+2022-07-06T16:00:59 2147368042 29068106840796910.714 true 27 -13477 11315 231988388 18722.197 7.36279137148427E8 9745163628451074.185 2022-11-23 2022-08-02T08:01:28 2022-06-14 135.125.99.160 vLittle@Lajo.com Weeping Birch Plaza 51
+2022-01-28T17:36:34 2147361419 66235090663479853.137 true -51 15176 -9717 281926529 -28998.344 1.014652450168952E9 64008372108259969.509 2022-01-14 2022-01-16T14:56:11 2022-03-01 25.158.126.209 LauraCrawford@Rooxo.mil Muir Circle 73
+2022-01-18T01:55:01 2147361117 1344175823772476.813 true -66 3884 -6259 942799387 -31530.1 9.7573614242114E7 79407496412683634.664 2022-01-20 2022-10-12T06:08:47 2022-07-14 9.97.60.8 0Brooks@Avamba.info Golden Leaf Pass 69
+2022-10-27T20:30:25 2147356019 92590184406014430.471 true 36 11194 12156 -436138908 -28744.945 4.20634527634209E8 4496968200996145.117 2022-12-16 2022-08-12T22:39:19 2022-04-03 7.109.111.0 non_et@Vitz.info Gerald Alley 31
+2022-07-30T21:15:19 2147355776 7961742472373102.406 true -19 27852 21157 -1872018283 26782.947 1.38643630286072E8 29573321742106989.137 2022-06-08 2022-06-12T19:28:07 2022-10-19 246.25.242.131 3Gardner@Flashspan.edu International Terrace 11
+2022-11-26T19:49:17 2147352335 80764280990878997.426 true 2 -29308 29440 921017929 11988.182 8.24736685451722E8 9835279556807483.866 2022-04-25 2022-06-27T00:38:47 2022-07-19 125.250.128.104 gCarter@Vimbo.mil Butternut Pass 36
+2023-01-03T05:22:23 2147349942 84133377525592228.154 true 31 5348 12735 1083196085 -11532.327 -5.88257975589088E8 16614091336559109.461 2022-02-18 2022-01-22T00:13:52 2022-12-22 150.74.85.3 ChrisGibson@Plajo.biz Brentwood Road 76
+2022-11-28T17:14:43 2147325698 9725750329249688.208 true 65 -13772 14606 -1653013708 10253.94 -1.966317816086957E9 53022579230034648.990 2022-12-04 2022-11-01T04:09:20 2022-02-23 241.217.119.108 dolore_dolore_minima@Babblestorm.info Division Junction 1
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_asc.out
new file mode 100644
index 0000000000..da87b012f0
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q02_tinyint_asc --
+2022-12-12T15:38:03 -2147447412 11774006348685852.217 false -128 -12502 18730 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 2022-06-13 2022-06-08T00:10:42 2022-01-19 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+2022-04-24T22:05:46 -2146517454 36311076627234901.358 true -128 -22452 -14112 2016812833 24896.398 4.06916902991652E8 42981217181930845.261 2022-08-29 2022-04-25T13:41:59 2022-08-06 140.151.153.118 eum_et@Voolith.name Nelson Court 46
+2022-12-07T02:49:40 -2146383485 68235552816386779.452 true -128 -11548 -29603 -634395390 -7073.377 -7.68698044932161E8 4477021624885860.622 2022-02-07 2022-04-14T02:32:34 2022-04-01 68.237.107.196 FrancesMurphy@Devpulse.net Sunbrook Place 35
+2022-12-24T14:42:35 -2146302732 79346435402101036.467 false -128 149 31577 -1844257832 -3185.0405 2.96757621404148E8 87013852077324124.120 2022-06-08 2022-03-27T07:02:24 2022-10-27 138.41.52.222 HeatherHughes@Fiveclub.mil Canary Hill 71
+2022-10-14T00:03:27 -2146230291 517350648331859.492 false -128 -772 28354 -851990365 -3025.3677 8.914648206465E8 88767996189732717.439 2022-12-03 2022-02-03T11:15:21 2022-09-24 204.159.146.7 3Castillo@Voomm.name Butterfield Crossing 58
+2022-02-27T01:18:43 -2145242920 36121188588273373.792 true -128 20305 7765 -1406700789 28185.135 1.011412369524311E9 70890772755517481.741 2022-05-26 2022-08-28T00:15 2022-09-09 170.118.120.118 error_quod@Omba.net Acker Crossing 89
+2022-11-13T04:26:03 -2145042412 40720927210509700.191 true -128 -20704 13443 -1612284457 11655.705 -6.74023449159679E8 93066083013275096.593 2022-07-24 2022-11-03T12:43:02 2022-11-20 122.205.223.77 necessitatibus_dolores_occaecati@Buzzdog.biz Oxford Junction 82
+2022-07-02T07:37:49 -2143600625 77711255526118300.368 true -128 18771 -13026 -1470090009 25352.48 7.7020202702841E8 89861418696597024.483 2022-10-06 2022-08-14T04:40:05 2022-12-21 119.129.178.24 RalphBurns@Gabcube.name Chinook Court 92
+2022-09-20T14:03:04 -2142870012 62010864745188472.197 true -128 -1261 19837 537699650 821.9667 1.746494221685806E9 70002709673606159.105 2022-08-07 2022-10-21T21:02:25 2022-05-20 179.5.49.90 GaryGray@Jetpulse.edu Prairieview Avenue 47
+2022-01-24T13:44:04 -2141311933 77413615069452766.268 false -128 19118 19844 921662575 -30874.328 -1.224064709848546E9 4675428570248306.858 2022-03-09 2022-09-13T07:44:14 2022-04-12 156.137.202.188 fRyan@Meembee.info Manley Hill 20
+2022-02-23T09:24:34 -2141063827 39689077505421124.774 false -128 -4462 25348 729060759 -31897.695 1.316675872124587E9 20498623232495251.952 2022-09-04 2022-05-31T04:25:17 2022-03-29 56.20.87.143 bSchmidt@Bubblemix.name Florence Alley 28
+2022-08-23T09:13:13 -2140912431 24445083223357943.966 false -128 -2686 14641 -694682404 -31831.951 1.62533515482917E9 31642914907686595.842 2022-04-06 2022-02-12T04:03:02 2022-12-15 179.84.233.58 AaronHernandez@Edgeblab.biz Sugar Way 75
+2022-02-25T06:06:04 -2139719603 34020993937610437.535 true -128 3009 20609 -435886806 -21041.531 -1.41310418994296E8 35427782671909779.468 2022-02-28 2022-04-21T15:47:53 2022-12-24 139.122.157.188 VictorJacobs@Meezzy.com Oneill Junction 43
+2022-03-26T15:48:26 -2138931467 52391890161369595.151 false -128 -18390 23767 -262837238 -22577.486 -1.490521422086689E9 97704075077274232.100 2022-07-07 2022-10-14T09:57:51 2022-06-05 176.70.158.217 cTucker@Avaveo.biz Park Meadow Park 68
+2022-02-06T04:17:35 -2137048270 18645616274997858.913 false -128 -11578 -7374 -909723995 2713.552 9.34755336010703E8 32227498333012689.836 2022-07-10 2022-07-18T16:03:06 2022-07-11 249.62.70.159 dSanchez@Innojam.info Sauthoff Plaza 86
+2022-03-07T07:50:29 -2133385864 77263944859469027.463 true -128 -30898 -18992 -1384734562 26367.035 -1.7441791444587E7 1620225450243695.193 2022-03-17 2022-05-13T21:30:33 2022-07-07 43.4.221.31 excepturi_quisquam@Babbleopia.biz Melby Drive 18
+2022-12-02T11:09:29 -2131124298 58016775974959372.644 false -128 11302 -17011 -1520545869 28195.58 -1.267177164917066E9 9268277470355006.598 2022-06-08 2022-12-02T04:01:27 2022-07-27 245.220.83.56 voluptas_eos_quia@Livetube.net Mifflin Plaza 23
+2022-12-14T09:48:35 -2130128972 71953147938406859.267 false -128 -16295 28847 -1477634 27222.605 -2.50371264958583E8 34751068014238389.637 2022-09-15 2022-11-19T18:38:25 2022-06-20 113.163.2.198 EugeneBrooks@Browsedrive.edu Dapin Street 87
+2022-06-29T16:54:51 -2130037027 88593476121695838.846 true -128 9305 27545 -2031448951 -17447.258 -1.183373898413665E9 23881983327618442.587 2022-12-24 2022-09-04T00:12:15 2022-12-31 204.83.18.163 AnnieTorres@Centimia.mil Fremont Pass 1
+2022-04-01T23:24:17 -2129826379 24176223511074859.400 false -128 30476 7571 -678483885 22552.55 2.085865685457981E9 6544553689920437.248 2022-01-31 2022-04-17T08:58:46 2022-03-14 126.137.222.175 facere_possimus@Eidel.edu Service Circle 91
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_desc.out
new file mode 100644
index 0000000000..c571f04b5a
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q02_tinyint_desc --
+2022-09-12T11:47:54 2147067132 52955030802767286.752 true 127 4967 11609 -1399650990 -29449.205 -1.62998021558943E8 12940444810371045.566 2022-10-07 2022-06-17T14:22:24 2022-10-11 102.164.240.244 HaroldGriffin@Thoughtstorm.com Memorial Terrace 67
+2022-10-13T01:07:24 2146616991 7881710570035405.645 false 127 -8310 -9628 -1045940332 -9868.593 1.570376206014117E9 29862310132486517.984 2022-04-27 2022-01-26T15:22:21 2022-11-06 252.44.56.210 dolore_ipsam@Cogibox.name Kenwood Court 17
+2022-10-09T12:50:32 2146539105 48546657665862541.114 true 127 -23802 -15504 1920811802 23855.672 -6.7041068215823E7 25606948646015411.717 2022-03-27 2023-01-09T10:38:45 2022-02-25 164.8.208.66 EugeneGeorge@Yadel.info Russell Junction 49
+2022-09-05T12:35:15 2146288022 94206548442916014.435 true 127 -23754 20466 -1565751463 14044.293 -2.045105873679679E9 41258855366086887.670 2022-08-24 2022-02-05T17:22:14 2022-09-24 101.221.40.1 GaryFields@Oyoba.mil Pawling Road 71
+2022-10-27T05:42:51 2146282810 16587476823913378.895 false 127 12125 13339 2144421638 17975.88 -1.912929853100911E9 56863526261225533.488 2022-06-10 2022-07-03T14:45:55 2023-01-04 180.188.87.76 HowardHernandez@Rooxo.biz Southridge Center 12
+2022-07-18T11:27:11 2146034217 36405916908128864.366 true 127 24781 -9222 -1212067295 26735.014 7.5911512329467E7 17070022842490123.148 2022-06-23 2022-03-13T19:32:04 2022-01-11 80.112.172.234 5Willis@Trudeo.gov Pawling Alley 70
+2022-11-12T04:03:03 2144971954 81541079225570430.860 true 127 -23152 1281 74566817 2629.9456 9.11553052098868E8 32978858990532311.500 2022-02-19 2022-12-21T07:52:55 2022-12-31 199.239.239.245 ShawnCunningham@Edgeify.biz Pond Parkway 14
+2022-09-24T08:14:42 2142982526 96528647242192769.710 true 127 25971 -32041 -1473310209 -31937.684 -2.066106047153405E9 28025089093469027.810 2022-09-16 2022-04-12T16:38:54 2022-08-18 46.151.35.20 illum_autem@Photospace.mil Pennsylvania Alley 4
+2022-06-23T05:40:32 2141608036 52618762564347867.369 false 127 13993 1464 420468240 -6237.7544 -1.3893797190184E8 94298643645110404.749 2022-12-05 2023-01-08T12:28:46 2022-04-12 223.96.180.107 rMorales@Realpoint.info Maple Parkway 70
+2022-09-07T22:29:59 2141468385 83403386069815682.239 false 127 -27414 28878 2017251881 -25077.691 1.59341412858189E9 62561054747145086.239 2022-09-26 2022-09-21T08:30:32 2022-12-29 15.225.104.165 KathleenDixon@Thoughtworks.biz Truax Way 37
+2022-03-09T21:11:15 2139414696 55270957107015844.569 true 127 3426 -17915 -7938806 22177.371 1.957310526612257E9 61811486828069184.807 2022-08-14 2022-06-03T03:12:25 2022-07-02 146.212.91.113 minima@Fadeo.name Graedel Trail 17
+2022-09-24T13:46:08 2139269475 32941261583844339.834 false 127 25889 -18628 -900521062 17133.07 -2.128282228949938E9 18133239196112731.325 2022-11-21 2022-11-20T20:12:42 2022-10-20 14.108.137.209 6Harrison@Eire.name Bluejay Trail 46
+2022-07-18T23:51:34 2138414995 80121675104398429.440 true 127 -11553 18672 371595905 -21799.115 7.41315579318121E8 3981673451938226.659 2022-09-05 2022-06-19T20:09:40 2022-04-25 131.231.149.73 et_ut_quo@Eidel.org Starling Court 32
+2022-09-04T14:19:02 2138277710 56389933193020366.845 false 127 15802 -8735 550097059 7686.7285 6.26661332666768E8 95797220270167390.846 2022-11-20 2022-12-07T17:46:43 2022-04-07 155.146.230.211 CarlosCarpenter@Ozu.biz Barby Court 11
+2022-02-02T12:50:51 2138245427 66405514090062978.699 false 127 -9580 12555 -489666078 -9201.424 -9.33785719496523E8 41716831478894306.408 2022-09-05 2022-06-20T09:36:33 2022-10-24 193.103.46.78 1Henry@Edgepulse.net Schlimgen Avenue 24
+2022-03-01T13:23:21 2137510590 80342039923187416.806 false 127 -32046 25676 119627160 -4462.3394 1.497579302954467E9 98344974016851549.825 2022-03-15 2022-09-19T00:34:47 2022-06-25 26.56.35.92 tBoyd@Rhybox.net Dwight Street 96
+2022-02-07T22:45:39 2137094268 31182921503667828.398 false 127 -14814 11699 -304553362 21947.398 -1.39028562355098E9 47028155576424101.208 2022-05-24 2022-11-28T13:51:06 2022-01-11 92.179.166.80 MargaretCooper@Meemm.gov Oak Point 56
+2022-05-19T03:03:26 2136672917 3926011027229543.660 false 127 -9703 -19183 -1216951175 -20778.127 6.81057487643244E8 76001639232703921.350 2022-11-02 2022-12-05T22:08:49 2022-03-02 20.142.229.220 eligendi@Twiyo.com Southridge Court 85
+2022-03-16T23:42 2136647169 90405154064863253.406 true 127 3775 17404 358534230 19361.938 1.140613254765717E9 10234364020739859.302 2022-12-18 2022-05-03T14:28:15 2022-12-08 116.97.128.59 zCole@Trilia.name Continental Terrace 23
+2022-10-21T07:22:35 2135014707 75730450425528137.800 false 127 25724 -9662 1824856223 31940.584 9.24879496113318E8 42669376082239422.968 2022-10-27 2022-06-24T13:56:05 2022-11-07 21.253.217.6 VirginiaJames@Oba.edu Moland Court 56
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_asc.out
new file mode 100644
index 0000000000..71eaad57e9
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q03_smallint_asc --
+2022-11-11T18:36:07 -2119181910 94635764902337719.587 false 9 -32768 -21447 -397700359 8544.816 8.42565878027755E8 4094297227123464.119 2022-10-30 2022-03-03T18:49:12 2022-07-28 89.85.158.113 expedita@Dabvine.org Schurz Point 86
+2022-05-29T08:39:24 -1772659910 21736833643914977.474 false 90 -32768 -18778 -1538078533 32518.29 1.839297758005148E9 8025233121771129.982 2022-07-26 2022-05-09T08:39:41 2022-08-01 121.249.9.41 yHanson@LiveZ.gov Arizona Road 39
+2022-05-04T20:07:58 -1666166714 3962173432088222.445 false 71 -32768 4632 1883461151 -30630.502 -8.5079006807073E8 53571183342198399.700 2022-05-05 2022-12-14T16:47:29 2022-10-28 232.16.80.219 est@Skyble.biz Oak Valley Point 2
+2022-08-05T18:03:44 -894847791 79816115052757123.810 true -3 -32768 28801 1255173066 202.17188 -1.474409948411377E9 3158312006873245.853 2022-04-16 2022-04-03T22:46:48 2022-11-25 126.55.0.220 8Kennedy@Fanoodle.name Southridge Hill 60
+2022-07-23T19:06:36 -612930133 47014660443866476.232 true -61 -32768 -22666 -1178658838 -28884.086 1.11103948397087E8 80042788253782204.498 2022-04-20 2022-03-01T22:23:27 2022-09-19 22.192.94.124 MildredRobinson@Devshare.edu Westport Pass 49
+2022-02-27T11:08:01 -573443804 88074988987401774.411 false -115 -32768 11929 -2016424421 29634.79 -2.18478165703325E8 12703696687710822.643 2022-08-15 2022-09-04T12:01:35 2022-10-01 84.50.196.143 autem_tempora_est@Browsetype.name Saint Paul Way 89
+2022-09-22T13:11:04 -561278478 74730986624403222.314 false -69 -32768 -16693 -759611463 21118.123 1.667026581303165E9 2956123704992284.781 2023-01-05 2022-02-27T11:59:07 2022-10-14 167.22.70.149 sJohnson@Bubbletube.name Summit Center 21
+2022-03-19T23:50:29 -375081698 47131568808788018.212 true 66 -32768 20928 -745557940 -18539.678 -1.40295670471318E9 97736016154408847.117 2022-08-19 2022-11-19T22:31:35 2022-12-19 223.197.134.245 MarilynMitchell@Gevee.info North Park 58
+2022-03-17T02:46:27 145301727 68906855503494742.331 false -101 -32768 -13729 778326569 -21269.486 1.604892898933131E9 20775250579937603.453 2022-01-18 2022-08-26T02:15:34 2022-07-12 15.126.62.157 8Ryan@Buzzshare.org Southridge Crossing 57
+2022-12-04T12:03:05 379694752 21184279894375388.370 true -51 -32768 -21837 953289513 1709.1425 9.43268787230081E8 15994775827042591.220 2022-08-08 2022-02-22T12:42:20 2022-03-19 166.24.100.153 xPrice@Eire.mil Scott Avenue 24
+2022-05-24T00:51:56 393425067 64456854851162701.200 false 63 -32768 -32408 -1635483986 -28936.332 -1.085881992618776E9 36803042446327799.658 2022-09-07 2022-03-25T23:19:36 2022-02-22 58.107.119.127 RebeccaEdwards@Browsecat.com Northwestern Alley 6
+2022-03-27T16:04:51 830069116 57613139135938777.187 true 126 -32768 -10729 2103092395 29968.945 1.639990989663357E9 59005793503222374.208 2022-05-10 2022-09-09T07:30:25 2022-02-07 112.14.223.193 tDaniels@Kazio.mil American Alley 35
+2022-11-10T21:43:27 1140193466 82831592007803346.142 true -121 -32768 14986 -1219445196 -29587.404 -5.32522576898622E8 76851400354416509.617 2022-10-21 2022-07-28T19:01:49 2022-03-30 187.21.28.160 1Green@Thoughtsphere.info Manitowish Parkway 21
+2022-04-08T23:28:30 1193667351 70550050881757088.893 true -110 -32768 -29595 -1191722621 -28450.025 1.807240652717508E9 89756525150809703.472 2022-05-08 2022-05-10T18:22:23 2022-01-28 238.187.41.156 sWheeler@Brainlounge.net Chive Park 49
+2022-06-05T02:25:39 1278185126 59887577210052257.857 true -93 -32768 23276 819897081 -27640.775 -1.343836015081554E9 1325037666391987.251 2022-09-12 2022-04-14T01:33:59 2022-03-28 60.161.98.109 RaymondLewis@Skibox.mil Pankratz Drive 84
+2022-07-06T12:06:05 1504265399 79531626414884406.312 false -6 -32768 9477 -205821866 -5769.2314 -8.26175747976332E8 6993548111617615.667 2022-08-10 2022-09-09T18:30:35 2022-04-30 68.51.54.193 wHenry@Aimbo.edu Veith Center 45
+2022-08-29T19:24:26 1544459161 75707175342781346.106 false -13 -32768 21957 -1773993625 18035.14 -1.030924547303447E9 92724336835089908.357 2022-04-10 2022-06-07T18:20:13 2022-05-27 208.148.214.190 maxime_quidem@Shuffletag.info Express Trail 61
+2022-03-29T02:05:08 1663741632 70464541385762238.753 false 53 -32768 1239 -1893520603 14750.256 1.411475653420637E9 4567372818900016.238 2022-08-06 2022-06-06T09:28:37 2023-01-05 36.64.144.72 AaronWest@Dynazzy.edu Jenna Hill 75
+2022-05-11T20:00:03 1858358065 22960893441577020.907 false 92 -32768 27889 -1689270915 17365.418 -2.035031502327624E9 68912075638025607.120 2022-08-11 2022-01-20T21:32:33 2023-01-08 169.187.30.86 PhyllisHoward@Oyoba.com Cherokee Alley 50
+2022-07-08T09:53:55 1884553032 23729748825156743.750 false 106 -32768 -6025 -200563489 30379.486 1.336059195210369E9 32158999009020847.504 2022-07-25 2022-07-12T05:55:10 2022-07-31 118.64.20.102 zCarr@Skalith.com Caliangt Way 64
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_desc.out
new file mode 100644
index 0000000000..13e4867887
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q03_smallint_desc --
+2022-12-03T04:12:36 1678560897 78263512868717237.334 false 87 32767 21441 1556232486 9959.018 1.560810265595625E9 53367707717244888.172 2022-10-14 2022-05-30T15:56:43 2022-09-13 61.118.67.174 fHernandez@Gigazoom.net Harbort Plaza 74
+2022-09-01T10:32:27 1516239965 54004301963415238.688 false -103 32767 -32345 -1959086052 -9526.442 1.368417829727535E9 59529746584863408.273 2022-03-18 2022-03-17T21:04:28 2022-11-27 112.9.110.220 sapiente_et@Wordtune.com Del Mar Alley 14
+2022-10-04T15:45:06 1444824980 23715281033213564.754 false -60 32767 -13200 1953979294 -13759.598 4.36756893815203E8 74289852103116884.548 2022-11-30 2022-12-08T16:19:44 2022-04-08 177.5.37.239 JoanWard@Jaloo.org Hudson Drive 72
+2022-04-25T13:05:07 1215121536 78115061843119221.123 false -39 32767 26516 -1500040018 18335.352 1.316773570462298E9 23999652729376863.467 2022-04-28 2022-03-20T09:23:07 2023-01-05 69.61.76.149 yHoward@Bluezoom.org Dunning Junction 81
+2022-08-14T13:26:56 849037708 31486374249394627.990 true -75 32767 -17558 587123427 -4247.6797 2.14502216256895E9 64375063060958299.247 2022-02-14 2022-07-27T20:09:32 2022-05-26 4.135.73.142 ut_dicta_reiciendis@Kaymbo.org Tony Terrace 18
+2022-06-16T06:04:54 676346698 64406411256628519.146 true -120 32767 13260 410411161 -5488.7783 2.142165802160835E9 15442903026737808.173 2022-12-09 2022-06-10T13:10:41 2022-11-20 3.240.90.12 sint@Topicstorm.mil Ryan Crossing 40
+2022-01-29T12:08:27 270262401 73421324604106832.546 true -46 32767 24735 -906217398 12946.995 5.41332101656695E8 97295895998092890.998 2022-04-22 2022-05-15T14:03:58 2022-09-11 153.23.200.191 ut_quod_at@Cogilith.info Macpherson Street 42
+2022-12-20T08:33:10 -453799527 1609414000539010.600 true 29 32767 20152 -944621837 -10862.854 2.1202667278816E7 38553894693583118.368 2022-09-09 2022-12-20T21:20:42 2022-04-11 153.12.224.226 CarolynMitchell@Ailane.edu Fordem Terrace 17
+2022-06-06T13:59:23 -485021625 65215899088499149.343 true -36 32767 110 1326710722 -15452.647 1.712244760219285E9 54985116338987826.693 2022-07-20 2022-04-01T23:42:43 2022-05-19 72.62.79.250 bFrazier@Blogtag.info Raven Place 15
+2022-07-17T06:31:17 -764873455 12937614675175936.291 false 53 32767 -29442 1072161671 28272.633 -1.984372369420127E9 36404274389736129.849 2022-11-25 2022-02-08T07:54:49 2022-09-18 161.155.111.69 facilis_voluptates@Youtags.name Almo Crossing 53
+2022-03-09T17:02:55 -1541436852 47783666261750053.846 true 38 32767 22638 244031682 31381.406 -1.24899826345357E8 80101741223666579.290 2022-01-27 2022-05-31T14:28:14 2022-06-18 245.151.64.68 5Duncan@Riffwire.info Loomis Park 59
+2022-09-24T13:30:50 -1843658789 21382968659216707.283 false 92 32767 16634 -1709129926 -29226.172 2.54394965271565E8 13439705918528964.604 2022-06-17 2022-05-13T21:20:39 2022-10-05 81.233.60.195 CherylBrooks@Kwideo.gov Manitowish Court 27
+2022-10-21T10:42:13 -1922279700 79171403893470668.461 false 40 32767 -8714 -1068042024 -31981.738 1.872934727916913E9 42784764695752210.645 2023-01-07 2022-06-02T23:27:58 2022-06-06 121.88.192.83 qui_aut_enim@Meejo.gov Logan Center 7
+2022-04-07T17:10:59 2047945442 35392804656997541.850 false -92 32766 20312 -973812323 -15728.488 -5.8402730971289E8 36805974594534434.619 2022-04-17 2022-04-16T07:09:32 2022-03-02 209.36.134.255 mBrown@Minyx.info Debra Terrace 19
+2022-02-08T21:03:59 1801338708 85359521530662573.619 false 64 32766 20369 -438205059 23985.758 -1.145449603692417E9 8285652611887586.485 2022-07-25 2022-07-16T22:58:45 2022-06-21 203.254.103.210 ArthurGonzalez@Realpoint.biz Oak Pass 68
+2022-04-01T02:26:38 1756277047 22565414784695921.250 true 78 32766 12887 190327578 22342.154 -5.98004048152577E8 7306868138616339.579 2022-02-13 2022-09-21T12:25:19 2022-10-05 188.143.228.103 exercitationem@Blogpad.edu Onsgard Junction 89
+2022-11-17T12:08:38 1519769949 61531324239017326.290 false 47 32766 -10929 1601858125 14056.325 1.532909781459057E9 74738228295173840.308 2022-12-02 2022-09-12T05:04:34 2022-06-05 43.114.219.1 StevenMitchell@Oozz.gov Miller Place 22
+2022-05-09T22:05:07 1115035313 666861267107.644 true 79 32766 9212 450171396 -1866.4689 7.77563839932363E8 90992477662136679.337 2022-12-13 2022-03-19T09:35:44 2023-01-02 218.227.189.124 suscipit@Trunyx.biz Sauthoff Hill 54
+2022-09-21T17:39:24 835121496 16261714214835321.379 true -53 32766 24600 1799461459 -7978.5894 1.61916308072381E9 49740940016941499.836 2022-05-29 2022-12-19T05:26:22 2022-05-05 192.12.165.182 JohnnyCole@Babbleblab.com Bunker Hill Avenue 47
+2022-04-24T14:01:52 693350452 58547572369398935.574 true 115 32766 -29000 1804011300 27503.322 1.541716030386427E9 38398874365459315.998 2022-08-12 2022-03-06T12:02:41 2022-07-29 29.234.237.236 TheresaThomas@Flipbug.biz Sachs Center 98
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_asc.out
new file mode 100644
index 0000000000..ac2b033e03
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q04_int_asc --
+2022-07-07T21:54:18 -2120733118 99987866980043755.800 true -58 21277 -32768 -1316677093 28088.38 1.115136612586051E9 2364850569062051.836 2022-04-18 2022-06-07T08:10:38 2022-05-11 84.210.182.140 laudantium_dolorem@DabZ.edu Sauthoff Road 1
+2022-07-07T21:05:36 -1903035708 79838626915225705.915 false 78 29 -32768 -517391953 -21292.13 1.336659715432206E9 82639136682635162.808 2022-11-26 2023-01-01T23:45:07 2022-03-18 23.39.113.132 ut@Brainlounge.net Brown Lane 73
+2022-12-01T13:00:03 -1502344793 7739319881715713.769 true -30 -13315 -32768 1035625019 -9074.537 -1.375730749351314E9 4509729191622434.232 2022-07-04 2022-02-21T23:54:51 2022-06-18 51.85.36.73 voluptas_et@Gigashots.info Village Place 54
+2022-04-02T13:59:42 -1249563481 25793286891144450.357 true -37 -18567 -32768 -209145436 20378.133 1.928345967460078E9 41432280276950618.638 2022-10-27 2022-01-30T04:30:56 2022-06-26 13.180.193.75 BenjaminSullivan@Yakidoo.com Anzinger Parkway 73
+2022-08-10T06:54:08 -1047509451 93870904411793291.772 true 27 -25069 -32768 -458727865 12787.854 1.023346475883571E9 35609833305491315.248 2022-05-27 2022-10-24T12:18:54 2022-08-22 100.74.206.16 dGreen@Zoozzy.org Upham Terrace 12
+2022-08-24T21:26:51 -1009584686 82997961698597105.800 true -94 -10973 -32768 -1247987750 -6420.7715 -1.154210842239973E9 427012722987017.972 2023-01-02 2022-05-24T06:40:37 2022-08-31 46.113.95.140 dolor_et@Dabtype.org Talmadge Terrace 93
+2022-06-27T08:58 -681728365 69518569749382164.510 true -9 6876 -32768 -1435371922 13394.644 7.34503660987504E8 52834354694219144.950 2022-03-12 2022-05-22T08:08:32 2022-07-08 133.88.101.209 hWatkins@Yodel.net Village Road 61
+2022-07-04T09:21:34 -407869610 44421550103074848.341 true 99 -6977 -32768 374288810 19392.492 1.3126169728449E8 71408716144006001.764 2022-01-24 2022-12-29T01:53:56 2022-11-06 238.188.218.213 nDay@Voonix.edu Norway Maple Lane 36
+2022-02-24T13:07:31 -129132199 29458096786879531.580 false -4 -20635 -32768 1033655858 21715.297 -7.54058346736829E8 95161363430606469.721 2022-02-04 2022-06-21T16:33:53 2022-10-24 248.169.15.230 lHall@Flashspan.gov Florence Trail 22
+2022-05-09T04:26:15 857697236 68028597663670515.123 false 28 28325 -32768 -47389999 -23293.6 1.275376606739085E9 3134649734681167.894 2022-09-01 2022-08-25T18:38:59 2022-09-17 171.107.129.4 TheresaGutierrez@Devify.biz Blaine Trail 90
+2022-10-18T20:45:15 1024239356 77200808830411345.553 false -5 20973 -32768 -954961445 10491.175 1.341381155702512E9 35911990125854291.712 2022-09-23 2022-12-23T22:00:22 2022-03-12 98.201.72.10 fDunn@Fivespan.org Coleman Crossing 67
+2022-06-05T10:30:30 1104090010 58796999828858368.722 false -10 12370 -32768 755194185 -16738.787 1.307386947167164E9 24312160338609669.522 2022-07-02 2022-11-01T03:38:28 2022-02-15 159.69.88.128 iure_nesciunt_voluptates@Dynabox.edu Larry Alley 39
+2022-03-09T02:48:28 1267495803 76819740367836335.444 false -60 -8694 -32768 -358529373 -6907.075 1.47274930258069E9 66847365669609031.157 2022-07-21 2022-05-20T01:41:24 2022-05-19 70.110.202.114 7Hernandez@Babbleblab.edu Twin Pines Place 55
+2022-06-12T19:01:56 1768680570 86304150812719249.660 false 23 12019 -32768 1037057674 -28341.41 -1.387592834682792E9 61999802022591109.158 2022-03-02 2022-02-24T07:00:46 2022-02-24 1.34.159.115 IrenePierce@Dablist.org Crescent Oaks Pass 99
+2022-02-14T20:41:46 2039358007 72249645328554877.980 false -41 8509 -32768 -1456067092 25266.559 2.030338532394684E9 78742588047728422.952 2022-05-16 2022-06-28T11:34:18 2022-01-12 59.81.108.106 consequuntur_inventore@Edgetag.name Glacier Hill Road 13
+2022-06-16T17:25:25 -1491663265 92341119506055736.630 true 35 23857 -32767 -1872209135 -23958.512 1.557031147242115E9 36680505639263456.400 2022-07-11 2022-02-05T00:08:30 2022-12-19 157.229.39.177 voluptas_earum_aut@Eayo.gov Waxwing Drive 31
+2022-08-21T05:56:17 -1207015343 1151857603920162.560 true 86 -10131 -32767 49692912 -28471.277 7.63516943282041E8 98104061235416014.815 2022-09-13 2022-08-31T09:00:17 2022-06-28 126.180.238.9 zJames@InnoZ.edu Cardinal Hill 16
+2022-02-16T16:05:29 -1145194166 52422077162919646.913 true -115 8257 -32767 1312281596 -27755.525 3.86726461334295E8 44099774217953217.896 2022-04-20 2022-11-18T17:04:17 2022-03-07 189.103.26.171 BrianRobinson@Quimm.net Lukken Park 58
+2022-12-05T13:53:27 -1129343965 12435233240700717.533 false -70 27672 -32767 438109108 5640.3486 -2.094277754194657E9 79632329522874968.103 2022-09-01 2022-08-31T14:08:30 2022-07-20 116.151.106.28 hDean@Twitterwire.name Northview Avenue 78
+2022-01-29T00:50:31 -1056246287 32792455115584086.957 true -5 -21700 -32767 682848989 -8755.646 3.8361190595868E7 73635997870057025.649 2022-03-12 2022-06-21T02:56:39 2022-07-12 150.75.99.137 LoriHernandez@Skipfire.org South Junction 91
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_desc.out
new file mode 100644
index 0000000000..5722683e97
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q04_int_desc --
+2022-08-10T12:50:03 1888116922 8768513323897507.592 false 89 20914 32767 1029418657 -17939.033 -1.903101775754356E9 99369207633318231.438 2022-12-27 2022-07-19T02:25:13 2022-10-17 118.14.237.254 architecto_consequatur_ratione@Plajo.com 6th Plaza 21
+2022-10-28T16:20:35 1753279192 26345129549082063.665 true -80 -27354 32767 1647985131 -6298.85 -1.0099842728928E8 73151402356517623.689 2022-07-06 2022-04-11T13:29:26 2022-10-14 17.135.232.84 LouisHill@Jabbersphere.edu 5th Crossing 77
+2022-07-09T08:42:19 696741380 88816479023759266.396 false 28 -810 32767 -503228152 -2033.0967 1.283612783887132E9 23560155062530607.449 2022-07-04 2022-01-16T01:51:12 2022-04-25 242.21.240.41 qui_molestias_sit@Twimm.edu School Way 39
+2022-04-29T14:52:37 538602653 80209164909064212.965 true 41 2824 32767 623318514 -90.34033 1.652544048058129E9 6278079706749755.145 2022-11-20 2022-04-28T16:31:42 2022-07-07 26.120.45.167 EdwardGilbert@Realpoint.edu Chinook Point 18
+2022-10-10T11:30:38 -43570738 33950598159842941.991 true -93 -22754 32767 228365884 -12285.596 1.072148305961583E9 40385648446590087.908 2022-10-17 2022-05-21T00:05:59 2022-12-02 180.210.2.61 vel_porro@Devcast.com Ridgeview Lane 29
+2022-12-15T08:25:51 -685985077 34867175910609485.940 false -46 15505 32767 1069243549 22190.662 1.465829004826134E9 94315647872734731.908 2022-07-05 2022-11-07T22:34:03 2022-03-17 164.89.83.128 3Peterson@Ozu.edu Sutteridge Hill 29
+2022-07-23T15:42:08 -693959934 3532747518626402.670 true 90 -27833 32767 402481406 -12022.679 3.20633431835798E8 13878558879578976.858 2022-01-31 2022-05-11T00:08:57 2022-04-20 105.178.67.122 adipisci@Meembee.edu Maple Junction 57
+2022-03-04T01:38:22 -1103551683 20765387673237390.730 false -95 -23968 32767 573511873 -4560.8164 -1.612783058153555E9 75476565259401372.959 2022-01-25 2022-12-07T07:56 2022-12-29 234.188.87.33 bRoss@Wikibox.name Forest Place 70
+2022-10-19T22:21:20 -1422824838 10273762521063911.978 true -33 23628 32767 1377740827 6697.8125 -3.20776843199587E8 87270405671531592.941 2022-03-01 2022-06-17T23:50:57 2022-07-11 87.210.226.137 AndrewRichards@Quatz.mil Magdeline Hill 2
+2022-12-25T19:18:30 -1800188877 56797235723096309.823 false 5 29573 32767 1250889188 3222.5032 7.59123194761978E8 38132941604652656.707 2022-11-30 2022-02-20T20:31:38 2022-03-06 81.3.160.15 CarolynMoreno@Twitterbeat.org Walton Park 0
+2022-04-03T00:16:30 -1881570490 90040616641745625.691 true -68 11611 32767 -832750635 15422.077 -1.008890733534576E9 61740717634381831.350 2022-09-11 2022-12-02T05:15:13 2022-02-26 37.77.240.236 ut@Realfire.info Southridge Crossing 2
+2022-11-04T23:13:59 -1961333255 82565493020808350.827 false 79 -32572 32767 -564816125 -19275.254 -8.56043163982228E8 31317454682606080.715 2022-03-01 2022-10-01T09:47:08 2022-08-20 128.227.27.151 ThomasPalmer@Skynoodle.mil Sunnyside Court 22
+2022-04-21T05:42:34 -1983542492 79069368837730231.108 true 37 -16507 32767 -2079663849 3108.9314 -7.02990221574151E8 95289208283784171.498 2022-09-04 2022-06-09T09:02:11 2022-03-24 199.138.101.12 magnam_odit@Mybuzz.org Lake View Park 87
+2022-10-05T19:18:01 -2052264650 78424390200285140.477 true 59 1764 32767 -1578947731 11197.878 1.40143850979203E8 56495401490046518.286 2022-11-11 2022-01-15T07:58:06 2022-04-02 71.247.208.219 oBanks@Kwideo.biz Heffernan Circle 14
+2022-05-13T00:48:07 -2112183148 27284911861750304.908 true 13 -14685 32767 -992170175 -8207.334 -1.667568460711954E9 39868154097191057.561 2022-09-03 2023-01-06T07:18:34 2022-09-26 68.254.153.214 wSanchez@Mydo.net Shasta Plaza 37
+2022-08-23T01:47:29 1733753204 46175547965371997.896 true 23 -21333 32766 -872139105 10232.654 7084307.228661 55581520919805163.310 2022-03-11 2022-03-25T15:33:56 2022-03-04 163.25.37.85 JaniceMendoza@Tagpad.biz Atwood Parkway 95
+2022-08-04T17:14:23 1453791862 77641367384062160.957 true 46 17496 32766 1556963309 -1303.7205 1.96424427370409E8 98209234373345503.606 2022-05-29 2022-12-06T12:21:05 2022-06-03 102.132.7.251 qui@Browsezoom.org Arrowood Lane 18
+2022-08-10T03:05:16 1246797667 71996802156521651.643 true 50 -31477 32766 -1808899886 -20132.887 -2.17433200722871E8 94532041589761841.578 2022-12-30 2022-08-16T00:43:25 2022-10-26 46.162.166.232 MartinCampbell@Realbuzz.org Blue Bill Park Drive 18
+2022-01-22T21:51:12 1092104347 22457349947009384.351 true -36 17554 32766 -1768138005 3526.0737 -1.092995250003986E9 19695739333265998.991 2022-10-25 2022-03-23T04:18:20 2022-05-26 181.78.226.237 2Barnes@Yakitri.name Claremont Drive 27
+2022-08-03T13:55:56 641788466 7328522000342647.719 false -50 8592 32766 1350609753 -18208.885 -6.40295431186389E8 33177060653065518.611 2022-07-08 2022-01-25T03:02:51 2022-09-14 199.182.62.95 nesciunt_ipsum@Skyble.info Maryland Parkway 8
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_asc.out
new file mode 100644
index 0000000000..2c99f4e833
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q05_bigint_asc --
+2022-06-13T07:08:23 -2147483358 16697470310045199.514 false 0 21661 27910 50137345 -31890.162 2.5182778747432E8 8892361240908133.332 2022-03-29 2022-05-06T07:35:41 2022-02-20 86.198.4.14 tHarrison@Yotz.edu Ohio Terrace 97
+2022-07-16T17:14:43 -2147480317 10126355674710455.926 false -106 25720 2137 -1044710620 19297.592 -4.6721094672452E7 74446297684183183.297 2022-02-12 2022-02-10T22:47:34 2022-08-24 176.57.174.210 2Jacobs@Oloo.edu Sunfield Pass 74
+2022-05-02T04:24:15 -2147477545 41444040735473920.151 true -64 -5005 21145 -429303067 12734.948 -4.6851297091213E8 53125989849165374.107 2022-02-02 2022-03-05T11:14:22 2022-10-18 147.133.227.47 rem_explicabo@Yozio.org Brown Road 85
+2022-03-12T18:09:32 -2147474804 5170475614524523.563 false 81 -17173 20232 1094003829 -21709.188 -1.487469632520682E9 37494213942760235.318 2022-03-29 2022-07-02T11:19:41 2022-07-14 222.252.244.150 at_non@Feedbug.biz Division Parkway 27
+2022-02-07T15:19:07 -2147474201 49303092715634273.638 false -39 -17552 22077 819770754 3815.9624 -3.07788874880729E8 22473676566411893.142 2022-02-17 2022-07-22T02:13:31 2022-07-02 176.107.188.43 ipsa@Photobug.org Algoma Center 6
+2022-11-04T19:40:54 -2147468104 27727896561928356.763 false 82 28127 -16794 953496574 -2973.964 1.538181391859708E9 55664064661456781.100 2022-07-30 2022-04-25T14:47:28 2022-12-25 93.64.145.202 SarahOliver@Topicblab.net Shopko Alley 97
+2022-09-02T05:05:13 -2147464684 52641288250964188.795 false 114 -15050 4397 1467965089 24381.705 -6.7825676777073E7 89275295308566490.932 2022-11-01 2022-06-23T04:06:05 2022-09-30 30.43.252.68 lDiaz@Kwideo.info Quincy Road 30
+2022-01-12T10:31:19 -2147455527 29099557100349011.625 true 69 5585 4327 -285779226 -21540.486 1.835808603850457E9 54187873992172620.878 2022-11-15 2022-06-04T18:07:03 2022-03-06 251.57.239.161 KathrynGrant@Jatri.com Talmadge Terrace 31
+2022-06-20T17:19:49 -2147452176 42963905746019101.945 false -85 -5897 -29349 1525786458 13439.43 1.580339430307399E9 4315552136410587.989 2022-01-19 2022-01-30T20:58:15 2023-01-02 204.35.13.187 DonaldOwens@Gabvine.com Continental Crossing 89
+2022-07-28T16:57:11 -2147449255 78090412186437460.598 true -12 30216 -6175 -612488037 4770.788 3.41784111819403E8 66010364586901704.721 2022-05-05 2022-06-17T21:16:21 2022-07-30 116.207.187.0 zMartinez@Jabberstorm.net Pawling Terrace 74
+2022-05-02T20:24:54 -2147449203 26373576153379339.703 false 100 5626 10817 -1071291634 -32229.045 -3.63129015178875E8 12284411005290507.833 2022-11-01 2022-05-13T23:57:47 2022-06-29 142.56.17.46 9Price@Fliptune.net Monument Hill 80
+2022-01-28T08:36:26 -2147448019 67591684441602394.918 true -61 7766 22532 -609849098 -27249.846 9.29542497341581E8 39481914812189670.121 2022-08-16 2022-09-20T13:43:17 2022-12-10 108.177.1.120 maiores_possimus_dolores@Tagopia.name Mitchell Terrace 22
+2022-12-12T15:38:03 -2147447412 11774006348685852.217 false -128 -12502 18730 -1730915686 6874.3896 -1.807581927505605E9 50303855444947555.171 2022-06-13 2022-06-08T00:10:42 2022-01-19 119.107.251.190 gCook@Zoozzy.biz Thackeray Pass 47
+2022-09-09T18:14:23 -2147445583 48715652698659874.382 false -106 -18847 28383 -249047381 -25610.389 -1.172353483917956E9 29809461999773154.513 2022-10-04 2022-03-22T06:00:02 2022-11-08 86.232.2.134 odio_distinctio@Einti.com Mallory Place 2
+2022-09-11T03:05:51 -2147440231 34028908311454481.592 false -98 3388 -7469 -520983933 10625.003 2.03995201402268E9 3462857055462597.650 2022-01-26 2022-11-01T00:41:21 2022-08-16 129.54.117.50 amet_ea@Quimba.name Butternut Alley 71
+2022-03-12T15:32:48 -2147436000 30763183670763392.566 true 38 29989 -15212 -2059345979 -15143.42 1.652582093181943E9 59619727495487524.575 2022-04-07 2022-12-26T02:46:25 2022-05-15 188.148.220.97 tenetur_cupiditate@Meemm.name Doe Crossing Avenue 8
+2022-03-04T17:56:58 -2147429509 89258793731621871.659 false 126 26815 -11284 -688010171 27046.46 -5.27072353971484E8 66247237013637477.644 2022-10-01 2022-09-08T08:07:23 2022-07-21 8.115.159.161 AnthonyGriffin@Katz.edu Fordem Plaza 6
+2022-12-02T03:44:10 -2147429313 61886285781136168.806 false 110 23694 10888 2044460430 15311.488 1.375307496401204E9 53151235042978489.270 2022-08-11 2022-10-20T13:09:41 2022-05-13 193.174.176.52 JoyceChavez@Eayo.com Bay Place 92
+2022-01-24T23:50:40 -2147426673 89764720990212770.220 false 14 -1228 32445 -1925449184 32501.54 -2.39912871351486E8 55348475727816727.866 2022-12-10 2022-01-16T21:35:19 2022-04-12 18.231.153.73 8Clark@Kare.info Manley Place 39
+2022-07-25T03:06:25 -2147421318 24287700579137232.797 true 105 6251 -6812 1436392860 11044.398 5.72113383114619E8 72488255457463303.173 2022-01-22 2022-07-02T17:44:40 2022-02-01 215.68.120.190 AmyKnight@Jatri.gov Morning Alley 47
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_desc.out
new file mode 100644
index 0000000000..893b3cdc95
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q05_bigint_desc --
+2022-11-06T20:45:23 2147476415 79015094907713747.951 false -107 5853 32354 1813108632 -31056.639 -1.124844835680021E9 40135874837185031.606 2022-02-21 2022-02-26T03:23:29 2022-02-17 97.85.179.247 BarbaraGonzales@Talane.net Logan Junction 65
+2022-01-28T07:05:42 2147473376 45825484466840064.118 true -23 -15598 -10213 -794130865 25225.979 -1.060667482169878E9 19712527510160101.667 2022-08-23 2022-09-07T09:37:41 2022-06-06 199.195.172.243 BenjaminGreene@Devify.org Hoffman Road 93
+2022-09-09T11:15:36 2147472006 26658958117089694.950 false 91 21995 -28829 1921853977 -9326.696 -1.865361821014336E9 40145011496472182.350 2022-03-15 2022-07-07T10:12:05 2022-01-25 24.129.28.35 uGreen@Avavee.edu School Drive 93
+2022-10-26T15:14:11 2147467668 17196762472988513.310 true -5 28431 -17708 -947082776 26115.467 -1.064859020746046E9 12851908920109725.570 2022-12-17 2022-11-09T06:13:10 2022-05-22 14.249.104.252 qMarshall@Yamia.mil Schurz Junction 33
+2022-08-02T13:11:26 2147466395 14160522214564153.767 false -35 5963 26203 1370349994 -10364.076 4.63808372886602E8 89497971198029168.922 2023-01-06 2022-06-16T16:39:52 2022-03-02 3.186.137.109 ScottPerkins@Edgewire.org Tennessee Terrace 33
+2022-05-18T22:01:25 2147447138 50480005137427111.177 true 28 16452 -30571 -2075189185 22385.588 -3.55214861990496E8 11932816216934343.652 2022-08-23 2022-10-21T03:38:58 2022-10-21 234.3.203.12 CarlMurphy@Wikivu.biz Northport Way 26
+2022-07-11T06:10:41 2147446227 39942552524190612.962 true -65 -22474 14929 1989464327 9511.273 5.86654785560309E8 79596075449045726.816 2022-11-07 2022-06-21T12:58:35 2022-11-24 19.107.68.34 tSanders@Jaxnation.biz Farragut Point 44
+2022-06-13T04:42:29 2147444078 80627252554457775.754 true 91 -17156 8627 1521831153 11225.079 2.09693779861494E8 8183865884308683.425 2022-11-08 2022-04-03T00:29:22 2022-03-20 233.68.240.228 3Martinez@Browsedrive.info Donald Crossing 7
+2022-07-12T23:46:35 2147438346 21307779971435471.232 false -9 -13506 -28486 -32114689 -3217.3818 1.872555303307973E9 73436580521307978.373 2022-03-18 2022-08-16T14:54:57 2022-10-01 204.85.217.82 et_modi_ut@Feedfire.gov Portage Junction 14
+2022-07-10T04:17:41 2147434485 1432088841386171.665 true 28 22783 -31955 -940172357 12963.05 -1.015348724865612E9 21415159800393256.390 2022-09-01 2022-09-17T21:00:35 2022-04-11 234.6.225.52 MelissaHenry@Realpoint.biz Bultman Court 97
+2022-03-26T23:37:01 2147432357 56924709102413625.675 true -111 24610 -30943 -1776521623 -7130.226 -5.00592536993921E8 16271114464316416.681 2022-03-24 2022-01-23T12:31:45 2022-05-28 58.48.43.183 ChrisJacobs@Buzzster.name Leroy Pass 32
+2022-08-24T06:52:46 2147425822 33378418596041889.584 true -17 -3026 29468 -1873981318 25636.371 6.43280347073812E8 90354184407027392.172 2022-06-28 2022-02-24T12:47:51 2022-10-15 97.226.248.251 qRussell@Cogilith.name Kings Place 83
+2022-05-04T22:35:17 2147425482 6517881695345385.105 true -1 -17372 20231 635029396 -19429.021 6.56125881323546E8 7165704130056347.115 2022-06-13 2022-12-05T18:10:15 2022-12-05 243.50.186.81 ErnestFlores@Thoughtbridge.com Dixon Court 53
+2022-06-03T22:53:31 2147424135 28644420545888776.933 false 40 -26116 -3291 306086353 26600.498 -9.60218756607374E8 40720938996818932.750 2022-02-13 2022-06-12T16:28:59 2022-10-15 168.234.102.40 GloriaAustin@Geba.biz Towne Pass 41
+2022-07-05T21:37:51 2147419311 28290293258808439.134 true 26 16950 8811 1233278399 -103.00702 1.520246238447387E9 88652736846204706.947 2022-03-10 2022-08-07T15:58:44 2022-05-23 133.108.194.1 DeniseRamos@Shufflebeat.net Mifflin Junction 55
+2022-08-27T13:18:38 2147398708 51773242262469907.285 false 29 -289 26743 -1393968680 11646.462 1.957852164380779E9 85909529735007926.735 2022-02-22 2022-08-12T18:11:59 2022-07-08 234.138.112.197 qui_sed_illum@Meedoo.org Muir Street 54
+2022-02-11T11:21:58 2147392850 57804265792541730.362 false -127 -23408 25721 -1101220500 2316.0918 -6.35043706494339E8 35840155922867023.289 2022-07-10 2022-06-26T10:41:26 2022-09-19 144.119.210.60 quia_ut@Gabcube.info Gateway Center 79
+2022-07-21T23:53:47 2147386878 30764594265766461.896 false -60 -8721 -22051 1711980281 -29701.404 1.849181274536084E9 83609670760129800.710 2022-09-16 2022-11-15T00:38:24 2022-06-14 246.45.68.181 fHunt@Eire.edu Scoville Road 95
+2022-08-16T10:03:56 2147383369 72879775219031581.449 false 22 -22449 1772 170772797 27267.404 2.83215517915306E8 66999108327070808.155 2022-12-17 2022-10-21T08:42:32 2022-04-01 121.224.155.131 molestiae@Eadel.info Mayfield Avenue 56
+2022-08-09T07:43:48 2147375954 28228200342554508.463 true 15 -29566 3184 1446182442 27525.846 -1.443946518312972E9 17957789229933477.747 2022-10-04 2022-01-26T03:41:36 2022-11-04 119.180.253.71 beatae@Gigazoom.mil Warbler Center 96
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_asc.out
new file mode 100644
index 0000000000..6db1cf2d4e
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q06_largeint_asc --
+2022-12-04T06:22:57 -246711478 84654501521416796.390 false -103 -18113 19389 -2147482973 14880.098 -1.523112342164441E9 21878190873933476.500 2022-09-25 2022-04-07T18:05:54 2022-05-30 20.199.205.220 aLynch@Skipfire.mil Di Loreto Road 30
+2022-11-30T20:02:35 1303195728 96061793274819565.143 true -100 12686 9445 -2147477373 -272.6262 -1.337520506414394E9 99863726797306412.976 2022-07-29 2022-05-10T11:59:21 2022-06-05 116.199.111.187 oLynch@Skipstorm.biz La Follette Plaza 69
+2022-03-21T12:40:58 1766740169 58314620472932457.796 false -34 11103 24685 -2147470250 -21601.188 1.276817809965177E9 44606525392375639.351 2022-06-03 2022-12-07T09:41:05 2022-06-20 89.87.243.146 5Mcdonald@Edgeblab.biz Messerschmidt Park 66
+2022-05-28T16:26:13 269572186 75567480714706601.281 false 64 18423 15956 -2147468067 3118.419 1.14080614906741E9 97285517234959003.152 2022-04-25 2022-03-06T00:36:03 2022-10-25 67.67.254.248 quibusdam@Thoughtstorm.edu Banding Place 66
+2022-12-19T03:11:53 368664399 3856321685307290.500 false 55 -8418 23923 -2147463607 31785.799 -1.504358530434769E9 27357840533120346.393 2022-02-08 2022-05-30T02:56:16 2022-04-22 133.61.35.110 placeat@Realcube.com Hagan Junction 54
+2022-09-04T10:29:29 505158832 89258531165302642.352 false -2 26698 -29551 -2147460661 31994.326 -4.74098431981176E8 3099285301222708.927 2022-07-16 2022-03-15T12:56:56 2023-01-01 195.12.29.188 eFerguson@Devbug.gov Hovde Drive 86
+2022-11-24T15:17:28 -1274411366 36273428103740588.470 false 61 -2478 28518 -2147460092 5253.492 1.017796579773484E9 18578574573465258.900 2022-12-27 2022-06-20T02:17:02 2022-12-24 227.83.220.48 soluta_excepturi_voluptatem@Kwinu.com Autumn Leaf Parkway 8
+2022-02-25T13:09:10 1490273478 28860967798783963.919 true 5 3415 -10554 -2147456557 26398.396 -1.225803954377621E9 14411424230518932.655 2022-04-16 2022-07-19T17:48:55 2022-02-21 233.151.111.62 bFranklin@Dazzlesphere.info La Follette Parkway 9
+2022-11-25T03:24:41 1730057638 50526728974898764.444 true -21 -15927 -26670 -2147455128 -6386.3496 -1.241704346224951E9 37568557666081895.982 2022-06-17 2022-08-29T17:34:03 2022-04-06 75.238.221.73 AmandaJenkins@Zoonder.edu Ridge Oak Drive 89
+2022-09-15T01:11:08 2021945645 17740170857018755.373 false -7 9373 9553 -2147444846 -30542.957 -1.872565612753137E9 67600428727997910.476 2022-02-01 2022-05-07T11:25:46 2022-10-22 158.88.108.223 rWard@Eayo.com School Point 37
+2022-10-10T06:44:51 226924829 3593445574299269.961 true 122 26618 -2154 -2147436212 -25458.258 -2.084037938361169E9 73840033676088294.277 2022-10-03 2022-11-03T06:21:14 2022-02-23 37.232.120.223 necessitatibus@Tanoodle.name Dayton Terrace 36
+2022-05-04T14:48:45 -1213650127 19845163495939085.178 false 124 -16334 -18785 -2147434245 -28859.63 -4.26520567613069E8 51651176782949307.366 2022-10-07 2022-06-07T14:03:31 2022-09-16 177.86.31.32 JeffreyAlvarez@Eire.mil Springview Alley 12
+2022-12-05T23:31:47 2006293223 80010595377329795.785 false 120 -28127 -11779 -2147430826 16500.771 1.944697050616735E9 32098443507824497.353 2022-12-11 2022-04-02T10:03:31 2022-07-11 143.39.158.253 nulla_culpa@Edgeblab.gov Lakewood Point 85
+2022-11-27T07:30:34 1874606984 16920471508203112.408 false 113 -22035 -25464 -2147430552 -28138.596 -1.228214561951064E9 83072574392637665.579 2022-12-29 2022-06-02T05:20 2022-11-20 96.95.209.35 LoriAlexander@Jaxnation.mil Butternut Street 30
+2022-09-04T11:30:07 -356943580 37063782312262520.329 true 98 26068 32563 -2147429517 -27552.44 -1.682020011894294E9 22119933110158544.773 2022-01-31 2022-02-21T00:09:01 2022-08-22 155.217.45.197 PhillipRichards@Devbug.biz Warner Court 62
+2022-01-16T02:22:46 142063602 39444397208179062.259 true -71 7717 32637 -2147428986 -29604.64 -1.358212623780673E9 44149938348576967.404 2022-06-14 2022-12-13T17:57:07 2022-10-26 27.237.247.100 5Cox@Thoughtblab.biz Green Parkway 52
+2022-03-27T01:06:41 100350310 2429621132701832.504 false -27 -27878 12495 -2147423561 -7305.504 1.666994499841093E9 72834442231694344.686 2022-04-11 2022-06-07T09:36:46 2022-05-14 88.177.123.59 MaryColeman@Jaxworks.info Dunning Court 47
+2022-03-18T11:33:26 1142814905 37567364131794579.150 true -96 -13298 18670 -2147420684 7109.774 -1.469514153557711E9 9700567439687183.354 2022-10-17 2022-06-10T04:55:02 2022-08-01 229.78.241.213 kOwens@Skalith.edu Milwaukee Hill 99
+2022-09-05T08:20:12 1240124884 57484486337212427.249 true 27 19583 4124 -2147418398 4085.9597 2.124100330596222E9 29941035414366039.852 2022-03-27 2022-08-12T18:06:12 2022-07-22 225.255.60.232 tRomero@Jamia.gov Bashford Hill 14
+2022-07-15T07:14:59 -869403442 46336475426741737.925 true -79 -23899 8551 -2147416198 11694.44 2.060779514945475E9 21456006682378061.440 2022-12-15 2022-08-02T21:07:51 2022-07-10 150.253.89.219 EricCunningham@Chatterpoint.info Cambridge Avenue 42
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_desc.out
new file mode 100644
index 0000000000..51676b6541
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q06_largeint_desc --
+2022-05-05T14:11:29 -254043651 92989254691730246.428 true 20 -12236 -22730 2147477970 32652.574 1.81252995854517E9 45443105341951463.379 2022-01-26 2022-09-27T09:14:03 2022-05-10 203.241.115.245 ToddWilliamson@Mita.net Independence Court 1
+2022-12-06T15:36 -1817842795 47268237300520155.430 true -54 -7307 -13351 2147475104 22036.732 1.49289066483237E9 91576671268310880.960 2022-09-22 2022-04-01T09:40:47 2022-03-08 12.208.19.233 wSimmons@Wikizz.info Oakridge Road 57
+2022-02-03T04:23:27 2110351806 18096615419125373.807 true 44 20850 31485 2147467308 14726.297 -2.116799679040196E9 50421976480155985.787 2022-12-17 2022-08-08T17:58:18 2022-11-12 202.103.10.99 officiis_et_omnis@Vimbo.gov Hoepker Alley 16
+2022-11-24T15:54:28 -463532063 65141640514860949.237 false -48 -13750 14822 2147462906 29250.246 -9.53329295044577E8 74125400250152591.764 2022-06-12 2022-11-04T16:42:21 2022-11-11 80.218.178.26 adipisci_beatae@Rhyloo.name Elka Terrace 59
+2022-12-15T04:57:02 -578378367 9720688031613570.665 false 94 1429 -19545 2147461759 15314.816 1.269180209779099E9 83514287335752076.410 2022-11-15 2022-08-23T18:34:37 2022-07-21 107.8.55.199 et_maiores_quod@Wikibox.mil Ryan Alley 1
+2022-06-06T13:08:23 176699102 97998705376490694.780 true -74 31309 -28430 2147453103 20794.389 1.676245213092824E9 30594542911506047.728 2022-05-06 2022-11-17T08:21:06 2022-01-11 57.76.60.111 6James@Skajo.com Burrows Crossing 79
+2022-11-11T16:14:36 -494447345 323181627092381.347 false 79 -6825 -18855 2147452974 -16348.068 7.98768657350112E8 75472366136429688.190 2023-01-02 2022-08-18T21:48:34 2022-02-15 165.10.182.59 dolorum@Devpulse.com Artisan Drive 2
+2022-04-08T21:30:16 -1478316915 60063426612015703.618 false 39 -3895 -26200 2147450430 9825.488 -1.41916821735485E9 77032754816718293.492 2022-03-30 2023-01-10T03:23:18 2022-01-30 37.118.147.31 non_veniam_iste@Innojam.info Fremont Circle 28
+2022-09-28T21:25:05 764874444 60109810009473038.185 true -20 1408 29473 2147448236 -32209.44 9.48479975322217E8 25919373179366574.603 2022-04-12 2022-09-10T02:45:29 2022-04-05 166.120.223.31 ErnestStevens@Skynoodle.org Old Shore Point 26
+2022-10-14T05:20:52 1595935241 27902839053795843.897 false 9 -21127 22822 2147441159 -17789.01 1.50715349820349E9 10022854468513820.850 2022-02-02 2022-08-21T12:07:07 2022-07-25 61.42.208.133 eos_accusamus_quasi@Fivespan.edu Ryan Avenue 35
+2022-11-28T07:01:50 1640272994 52127613480719973.480 true -79 -16021 -20610 2147434231 343.96222 1.36827702016383E8 93580208061798478.635 2022-08-03 2022-09-22T11:54:33 2022-06-12 50.238.208.223 2Johnson@Jetpulse.org Sherman Crossing 22
+2022-06-07T22:06:39 1219569626 47463517184600068.589 true 102 30657 -27866 2147430546 -30624.21 -1.57475059644786E8 98252031839665903.857 2022-12-22 2022-06-01T22:23:01 2022-03-29 13.185.213.79 vGonzales@Demimbu.com Delladonna Court 45
+2022-03-31T14:14:09 1703854096 37888586206164868.780 true 17 -9679 -4552 2147430153 20638.639 -8.49761147089966E8 62923240861759445.150 2022-09-14 2022-07-13T10:43:50 2022-07-30 51.117.123.126 sPeterson@Tagopia.info Goodland Plaza 70
+2022-02-27T10:05:57 692279612 15843459443851354.245 false -32 -12615 3567 2147429935 2580.702 -7.9936447504658E8 58662040384094405.250 2022-10-31 2022-09-30T09:15:34 2022-11-25 45.202.7.82 2Woods@Twimbo.net Kenwood Way 84
+2022-12-18T13:06:53 -267286656 13195275906866189.194 true -59 3154 3597 2147422236 -32265.494 -1.17224805061347E9 11810409337999823.603 2022-08-27 2022-12-01T07:30:24 2022-04-07 55.111.10.106 bCarpenter@Nlounge.name Barnett Terrace 3
+2022-04-18T19:06:02 1932199506 11843733083881423.758 false 121 -2722 -29211 2147420268 25321.805 -8.8706405191796E8 79625987451182569.849 2022-06-22 2022-04-01T04:02:20 2022-03-30 74.191.151.221 6Watkins@Fatz.com 3rd Plaza 10
+2022-12-15T05:20:03 223905557 85929696615604319.578 false -73 -23617 -618 2147418766 -23098.146 3.75672820015594E8 79759186335411663.445 2022-05-11 2022-07-23T13:40:35 2022-12-08 58.193.16.232 nWhite@Meejo.com Ludington Street 21
+2022-04-12T18:54:42 629183294 21260739465078612.550 true 9 -32697 -18977 2147415722 -14578.275 1.140790249811087E9 54442471810989683.166 2022-04-18 2022-01-17T05:05:50 2022-11-17 190.92.79.131 nostrum_necessitatibus_perferendis@Brainbox.biz Dunning Lane 50
+2022-07-22T01:56:01 -912865425 76030009831914932.956 true -27 933 -16029 2147415689 18758.906 1.477874145025536E9 50513806382172699.667 2022-08-01 2022-04-13T22:52:56 2022-03-22 198.123.234.245 beatae_porro_earum@Fadeo.mil Miller Avenue 63
+2023-01-03T18:46 935786761 13241289963707582.793 false 118 26620 16970 2147412302 -19167.205 -1.04699334862877E8 99005295897018148.356 2022-01-19 2022-04-29T16:15:57 2022-12-10 174.28.24.125 dicta@Topicblab.edu Acker Avenue 52
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_asc.out
new file mode 100644
index 0000000000..1d70c5e7f5
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q07_float_asc --
+2022-07-24T00:47:48 904239531 33565969037066895.718 true 52 19155 -17843 -870063950 -32767.988 -8.48448360999358E8 66639118858001777.565 2022-03-01 2022-01-28T19:07:42 2022-05-31 187.21.149.194 JesseVasquez@Oyoyo.org Cherokee Alley 22
+2022-02-12T22:26:31 2108790490 86676668827760441.915 true -75 -22704 -19474 613611806 -32767.787 1.644913013099952E9 31375202450831669.536 2022-12-15 2022-11-29T17:28:16 2022-02-09 2.164.27.215 ut_voluptate_nostrum@Realfire.mil Sutteridge Court 77
+2022-02-16T00:16:30 -175996605 43041167243007063.975 true -12 29739 -3935 -1932953359 -32767.746 -2.074393977727773E9 64318533569881963.437 2022-09-27 2022-08-02T16:47:36 2022-05-08 31.199.136.214 RalphGraham@Voolith.mil Lighthouse Bay Center 8
+2022-06-28T16:18:39 -1729238049 14902567026287623.608 false 7 4996 -16429 1936002549 -32767.72 -1.972391364003938E9 29191167190453912.182 2022-05-21 2022-11-14T15:52:20 2022-10-25 103.139.73.137 JustinCarpenter@Einti.biz Twin Pines Parkway 83
+2022-07-10T03:32:07 322457889 83017026184485620.890 true 101 10659 24047 1340057814 -32767.707 -9.08730451038922E8 20006513970590562.630 2022-01-11 2022-12-02T22:17:10 2022-09-30 151.249.119.32 eum@Skivee.mil Hanson Park 43
+2022-07-13T00:55:01 19840994 47712155853010152.649 true 122 14088 20384 -343237821 -32767.684 -5.77925471856236E8 64616761541007404.300 2022-10-18 2022-09-22T12:16:47 2022-07-12 146.145.128.31 7Kim@Kwinu.mil Dryden Plaza 18
+2022-03-30T03:28:42 1348539021 64429861037880761.570 true 111 -27347 21390 1803141201 -32767.668 -7.92723412691912E8 18940294349435889.299 2022-08-31 2022-10-24T00:10:45 2022-11-12 5.92.88.123 quas@Kimia.name Northport Circle 28
+2022-09-30T07:57:09 -2087749504 35974515412216284.768 false -56 26332 16149 -1918451952 -32767.629 1.505657067710979E9 14125801984329646.132 2022-12-29 2022-12-23T09:43:14 2022-08-27 178.38.96.116 sed_velit_velit@Skaboo.name Di Loreto Point 60
+2022-06-13T04:20:21 -412116091 14704466008982914.593 true 31 3670 16698 -1176087665 -32767.58 9.96148449354842E8 2331543756766195.399 2022-03-05 2022-11-12T19:54:38 2022-02-18 253.140.247.58 RubyOrtiz@Yotz.net Kingsford Crossing 31
+2022-07-03T02:38:25 -1885965822 18809384744155126.992 false -54 19220 5741 40929511 -32767.557 1.897494615946867E9 60705295259854870.426 2022-10-11 2022-04-07T05:42:40 2022-11-02 135.82.1.27 6Frazier@Agimba.com Dapin Hill 10
+2022-12-28T12:27:58 2144982721 34151648280765961.556 true -113 15003 -16225 1537538725 -32767.49 -1.036707525400561E9 62094645821469413.892 2022-09-16 2022-07-27T06:59:26 2022-10-09 219.3.222.122 aliquam_optio@Linkbuzz.name Delaware Park 68
+2022-05-20T01:20:46 855210976 40439533526429101.994 true -109 20072 -13887 572793058 -32767.479 -9.95966842673598E8 10518058910752436.100 2022-10-21 2022-08-06T03:23:51 2022-05-21 64.172.124.211 quasi_sed@Linkbridge.biz Russell Park 40
+2022-02-02T01:21:18 415683678 49547346495865901.946 false 53 2404 23197 1824160959 -32767.453 -2.039937903393366E9 67542038172891692.347 2022-07-29 2022-05-31T18:16 2022-01-11 232.113.214.41 7Kelly@Kanoodle.mil Ludington Park 17
+2022-12-13T19:11:50 -1790026203 3006589949410236.238 false -77 7967 17077 -290248005 -32767.354 -9.28722235122386E8 24631351662980061.994 2022-06-12 2022-03-03T03:10:23 2022-04-04 131.226.158.250 NancyReed@Tagchat.mil Moulton Place 40
+2022-10-03T23:47:27 -1096721480 38168021051635209.280 true 28 21242 29443 -1278081844 -32767.334 6.35216208676209E8 70115031022976032.272 2022-06-29 2022-04-20T19:27 2022-03-11 5.1.22.237 oThomas@Devpulse.com Hoard Terrace 92
+2022-02-13T04:02:10 -1856473613 58977472424341523.150 true 48 -2077 24889 -552848396 -32767.33 1.084642554354116E9 67110277205429974.534 2022-05-12 2022-02-11T18:55:06 2022-04-08 219.197.188.140 quis_distinctio_ut@Realbuzz.com Utah Street 22
+2022-04-15T16:27:31 -49252508 13217520985568169.130 true -71 -15126 14471 -1729837304 -32767.291 1.420844360079393E9 33440706532871170.910 2022-09-09 2022-10-30T01:15:15 2022-05-20 1.200.56.211 LillianLawson@Vinder.org Bluejay Lane 62
+2022-12-20T00:56:18 180234905 66788060212625427.800 false -67 30913 14670 1441689123 -32767.148 1.486941962798543E9 28309713375130051.380 2022-07-17 2022-12-07T06:20:09 2022-07-27 91.214.19.50 7Elliott@BlogXS.info Nova Alley 59
+2022-09-15T23:02:14 1295918703 60804256677594169.934 true -69 -24133 -30961 -582139753 -32767.148 9.25359500606945E8 60393934721443505.647 2023-01-06 2022-02-26T05:59:38 2022-07-12 120.166.54.251 PhyllisHansen@BlogXS.name Butterfield Junction 82
+2022-10-27T17:15:41 -499854500 38741293912690690.322 false -79 -1558 -25539 851517119 -32766.943 1.413894336107252E9 58594526725832285.190 2022-07-01 2022-01-29T20:31:19 2022-04-30 120.118.142.155 DianeHicks@Eabox.biz Redwing Street 99
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_desc.out
new file mode 100644
index 0000000000..5d3641adde
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q07_float_desc --
+2022-05-01T22:47:40 -1823175604 26844134249385819.791 false -29 -30329 1822 -1358168511 32767.928 2.009688291575429E9 17771168838097809.431 2022-07-16 2022-09-27T15:50:52 2022-05-11 238.180.194.241 illo_odio_doloribus@Edgeify.com Anhalt Park 64
+2022-12-22T02:25:34 191948397 54405155782334714.669 true -104 8926 15485 -498481413 32767.89 5.6676607501201E7 21068783695616905.925 2022-12-29 2022-10-10T18:16:59 2022-10-30 232.100.143.255 lStone@Agimba.gov Hovde Junction 64
+2022-12-26T10:05:45 1283692793 74203772188095329.182 false -90 15635 -15276 233117712 32767.844 9.99261833045144E8 15327922014220167.461 2022-08-23 2022-07-20T02:08:55 2022-02-01 111.58.77.158 voluptate_sed_sint@Skajo.com Kinsman Avenue 61
+2022-06-14T10:00:45 -349690738 32476403216500129.837 true 84 -7438 -4479 -1342593648 32767.53 -1.017541295853379E9 53464723428371155.899 2022-03-12 2022-02-02T13:44:46 2022-02-08 178.224.29.55 MargaretStanley@Twinder.edu Saint Paul Hill 86
+2022-07-17T12:06:46 -1183035245 45175105158261917.900 true 50 32753 -6817 1129687357 32767.525 6.83977389495487E8 90865788207515996.658 2022-12-02 2022-04-06T03:01:25 2022-06-25 36.121.121.59 est_qui_corporis@Brainbox.info Comanche Street 98
+2022-04-17T10:25:42 -2006471494 4142119437709967.790 false -68 13626 13999 2064760274 32767.498 8.67897806228493E8 5676096559725262.986 2022-12-16 2022-06-28T18:00:15 2022-03-23 29.50.242.117 MarilynRomero@Meemm.com Dunning Alley 53
+2022-03-11T19:39:11 2059621459 65571725069055468.712 true 28 29392 28017 495895095 32767.463 -6.31667614588921E8 13000911596646026.488 2022-10-09 2022-11-16T18:12:51 2022-10-16 177.125.29.161 kSanchez@Thoughtbeat.name Elmside Point 30
+2022-09-14T00:12:35 1220184058 9019805071295258.504 false 29 19107 -2808 389440903 32767.441 -8.69481459751087E8 82307710315546489.595 2022-02-10 2022-03-04T13:39:07 2022-03-12 6.78.18.222 6Robertson@Skynoodle.edu Jenna Court 8
+2022-07-23T01:42:47 -1856335607 36797980679486173.500 true 34 10190 13004 -377606691 32767.35 1.618143559024504E9 24314642946067219.289 2022-09-10 2022-06-10T06:52:54 2022-10-22 150.62.5.109 jRomero@Rhybox.info Sachtjen Drive 84
+2022-12-31T20:00:01 1658024718 51540230440208955.468 false -110 -19442 6042 -447004279 32767.307 -1.558000125151187E9 21675360843130030.892 2022-11-14 2022-06-26T14:02:51 2022-05-08 18.110.198.57 5Rose@Devbug.org Cherokee Parkway 48
+2022-11-06T18:35:01 1897557978 52787049966600263.166 true -45 2589 -2609 50007734 32767.264 8.0396261208888E7 33064805090486846.974 2022-12-26 2022-06-13T08:51:42 2022-03-29 65.174.60.242 et@Skinder.gov Loeprich Pass 52
+2022-10-15T13:11:53 -1497909968 27012952279549600.521 false -28 -12781 -26606 722420626 32767.158 -4.75277368579731E8 19593895174108654.977 2022-07-15 2022-07-07T07:51:43 2022-08-13 36.79.152.158 iDean@Jabberbean.info Goodland Circle 26
+2022-07-01T20:53:09 1248745923 24848911496818958.569 true -36 -15877 8202 -1451993096 32767.125 1.557614928545075E9 36745461578276620.586 2022-12-21 2022-03-30T16:29:29 2022-04-17 27.217.220.253 qFox@Fliptune.com Macpherson Road 35
+2022-08-20T18:58:39 -764816941 23696968649873.157 true 4 -29579 -10518 -1618315528 32766.848 2.46997485521595E8 3596523905488433.465 2022-01-27 2022-07-11T10:38:39 2022-09-14 255.5.162.121 ArthurDean@Skaboo.net Londonderry Place 98
+2022-08-18T23:31:02 -303249502 41222404113028818.193 true 59 -1042 -12995 328851185 32766.832 1.460692812883648E9 40337792162187.664 2022-10-18 2022-06-30T10:13:20 2022-09-21 145.15.191.95 4King@Fanoodle.org Derek Park 69
+2022-02-03T03:14:10 -1638231600 40273337117344981.355 true -104 21971 9106 -480668649 32766.648 -1.274022605370237E9 11266174902460852.644 2022-11-21 2022-09-06T07:19:29 2022-05-05 153.249.100.179 accusantium_et_voluptates@Aibox.mil Luster Circle 39
+2022-05-26T19:50:30 -178771063 66737064997984085.407 false -4 12436 -29145 406979373 32766.59 2.9066412262873E7 24458404583836435.310 2023-01-06 2022-02-04T00:40:21 2022-11-13 174.213.103.117 voluptatum@Devcast.com Dahle Pass 15
+2022-04-30T12:06:27 1046717849 72627986434926943.767 false 40 -9290 -19846 -1967897496 32766.408 -4.45127586899636E8 68745674857304603.848 2022-04-28 2023-01-04T00:48:51 2022-08-29 156.17.115.230 pariatur@Lazzy.com Glendale Park 56
+2022-03-10T12:56:28 -308190496 35899895852191727.300 true 46 -28411 19644 -1006156944 32766.365 1.798419471510469E9 71539937481829950.261 2022-07-09 2022-12-09T12:21:37 2022-10-30 150.74.242.207 cumque@Reallinks.mil Esch Junction 16
+2022-09-20T09:38:26 1271224400 37717294824782877.120 false -26 -17735 12387 135439250 32766.299 7.74548148382679E8 39865411029260070.183 2022-01-28 2022-06-11T04:27:44 2023-01-06 161.28.174.115 nesciunt_necessitatibus_ut@Skidoo.biz Messerschmidt Court 93
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_asc.out
new file mode 100644
index 0000000000..3fc6ac462c
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q08_double_asc --
+2022-03-10T18:42:24 -405123470 30524842082085362.905 true 26 24437 4297 354795119 -25761.59 -2.147482437676639E9 50575378749456234.868 2022-03-10 2022-05-18T01:05:45 2022-09-13 47.119.254.67 EmilyOrtiz@Innojam.net Stoughton Trail 78
+2022-08-08T06:35:44 -2012289867 45617452929508063.366 true -122 25912 -1856 -1742024386 -19357.436 -2.14748217408611E9 68319443496875372.242 2022-02-04 2022-09-03T23:05:27 2022-09-23 167.91.84.230 tenetur@Topicware.info Ronald Regan Parkway 48
+2022-11-01T02:03:25 -2040869063 61735959420070173.869 false -125 213 15786 984234332 -24888.938 -2.14747852680751E9 61624435405251776.949 2022-09-17 2022-04-30T12:11:50 2022-11-27 46.8.13.249 PatrickSpencer@Gabtype.edu School Park 50
+2022-03-22T14:21:15 1208235307 96766443104061067.216 false -26 24825 -8689 653919993 -9123.589 -2.14747585583476E9 99499821157588901.634 2022-08-27 2022-05-26T11:23:38 2022-09-09 213.118.149.191 RussellLittle@Skilith.mil North Lane 69
+2022-08-31T01:03:43 1543030331 21060798832666421.875 false -18 -640 -9108 -533892269 -9892.433 -2.147470382276245E9 79205585363517823.524 2022-05-23 2022-11-29T10:17:27 2022-05-24 21.2.251.252 SarahWeaver@Kwimbee.net Eliot Parkway 60
+2022-10-24T01:20:17 1728404501 61238282568646523.204 true 121 -10884 -2623 -520433238 -2531.246 -2.147469149301041E9 16927494567415021.299 2022-07-23 2022-04-24T22:56:47 2022-12-10 166.54.119.20 oKing@Jabbercube.com Knutson Crossing 24
+2022-08-24T09:56:25 1767976805 42604827030624254.664 false -123 23752 -13890 735050569 14621.793 -2.147462989813695E9 72927487236500898.421 2022-10-17 2022-10-14T20:30:48 2022-05-02 198.56.155.197 TimothyRobinson@Kwimbee.name East Point 3
+2022-10-23T23:07:39 -1995889486 96481041268303342.302 false -121 6012 -1965 2005454932 -3898.677 -2.147460972447545E9 57374890084831617.256 2022-08-08 2022-11-30T20:42:59 2022-08-12 145.178.228.193 suscipit_aliquam@Miboo.net Division Park 9
+2022-02-23T04:22:49 881631226 94602930294624568.738 true 121 -10808 -21127 -640203604 2886.5693 -2.147459826391465E9 30866240195387124.250 2022-07-23 2022-07-26T04:53:27 2022-03-11 183.164.104.224 aFord@Muxo.name Gina Trail 75
+2022-07-05T09:07:16 -375749426 35505781736306985.300 false -17 -8492 31858 -1875503799 -30491.041 -2.147454316996151E9 20036407418065005.612 2022-02-11 2022-05-08T22:26:37 2022-07-09 87.36.135.225 fLarson@Gigaclub.name Artisan Place 64
+2022-05-09T11:21:56 744168247 91736531098704944.738 false 100 3446 13719 1742463622 10450.202 -2.147450080574351E9 1777397163243433.240 2022-09-09 2022-01-20T06:02:31 2023-01-02 142.252.236.123 tFrazier@Geba.net Derek Place 7
+2022-06-13T09:37:54 880607708 56051979616913558.930 true 45 21251 20284 684694333 13335.993 -2.147447600027668E9 56704909797333381.900 2022-06-07 2022-09-24T08:22:58 2022-11-29 251.89.212.99 aSpencer@Skyble.edu Amoth Terrace 74
+2022-09-11T07:06:33 -1658533753 81393249943026065.254 false 47 -4202 -2877 454202975 -5924.0073 -2.147443564400919E9 13909108580868795.867 2022-09-15 2022-11-21T00:47:47 2022-11-08 146.190.118.89 NicoleWatson@Livetube.org Ryan Pass 36
+2022-06-15T08:48:01 -743216727 62655508944115419.579 false 119 1120 4099 -1037219689 17388.986 -2.147443170041909E9 40462312893491746.636 2022-05-03 2022-05-01T22:00:31 2022-07-31 65.23.172.93 StephanieHansen@Thoughtworks.info Red Cloud Alley 1
+2022-09-19T23:52:38 -490124641 83215815942254282.599 false -83 -5021 -26145 -203241250 -3014.7898 -2.147435767935103E9 24883142112718518.660 2022-05-09 2022-06-14T20:14:32 2022-03-14 137.6.5.34 JuliaDaniels@Izio.biz Lerdahl Point 49
+2022-04-15T18:12:20 -1476674200 76077621753438032.418 false -81 -17630 -10269 -268792458 13778.415 -2.147435208942339E9 93226194917360130.580 2022-07-02 2022-08-07T20:32:33 2022-02-06 195.140.76.121 qWhite@Ooba.org Maywood Junction 85
+2022-04-22T15:18:10 -373161437 10185796628713839.151 true 78 -20341 -3857 -965487650 3162.9028 -2.147426668518247E9 87660212947422082.248 2022-08-08 2022-07-26T22:40:14 2022-07-01 227.174.162.56 xFox@Centidel.net Kings Point 27
+2022-02-02T02:55:25 887338146 5852994288487202.801 false 18 -1110 -2915 -1973362361 12884.521 -2.147414306997674E9 58177080984258084.521 2022-04-12 2022-06-14T16:11:06 2022-06-14 194.10.208.88 asperiores_aut_nam@Eimbee.info Scofield Road 30
+2022-06-27T01:36:01 260022507 743933466293884.547 false -128 24594 -1774 1280236247 25504.85 -2.14741145881511E9 50419753384455671.508 2022-08-21 2022-02-20T08:53:48 2022-08-08 47.55.246.239 voluptatem@Flipstorm.info Burning Wood Terrace 31
+2022-05-08T04:59:26 1767178007 6136230207395435.673 false 10 6759 14677 1442964429 814.3629 -2.147407577546572E9 88192023490142365.694 2022-03-06 2022-03-22T20:48:47 2022-10-30 93.78.153.54 JoanDuncan@Quinu.info Helena Center 83
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_desc.out
new file mode 100644
index 0000000000..e98e4dc22d
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q08_double_desc --
+2022-12-29T21:44:26 -1901453444 6972130491285679.714 true -41 30904 -24569 775713590 9847.924 2.147477153306775E9 18887933329250990.563 2022-01-13 2022-02-22T18:46:35 2022-02-19 210.166.146.182 voluptatum@Zava.com Esch Parkway 0
+2022-02-20T13:20:26 603774063 10031075483039884.550 false -17 24299 -5828 -476157404 17167.95 2.147476799175778E9 61087522469466821.603 2022-05-09 2022-11-01T11:02:13 2022-08-04 119.189.18.178 StephanieHart@Browsecat.gov Lunder Center 51
+2022-04-01T02:13:12 -714596317 59040238131172211.256 false -5 8267 31786 -1226086125 -21627.693 2.147468982588477E9 54918077517454206.357 2022-11-27 2022-06-02T10:50:01 2022-05-27 181.233.37.54 nTucker@Realbridge.com Anderson Park 30
+2022-10-30T19:57:07 318494459 53122206704355399.609 true 18 14246 23967 -1292820840 12325.499 2.14746497311557E9 43745863329775500.490 2022-12-25 2022-10-02T21:28:33 2022-05-23 138.39.3.221 assumenda_aut_sed@Kazio.com Lakeland Parkway 26
+2022-08-26T04:30:04 -1017580911 73134490765858113.307 false 72 27006 -23952 1526696207 30609.816 2.147460658319948E9 78955888319979537.554 2022-04-29 2022-10-10T06:01:34 2022-06-04 136.152.216.121 hDean@Skynoodle.name Arkansas Terrace 20
+2022-12-26T20:59:12 -414860945 61168599630920854.600 false 115 283 -16515 121510438 -15174.003 2.147450667851302E9 82161872297771737.741 2022-12-19 2022-05-20T08:41:28 2022-12-20 180.254.29.2 odio_quia@Zoonder.biz Golf View Center 59
+2022-11-18T22:52:22 -727722977 89956947221100614.123 true -68 25258 16043 -1054357441 7078.5977 2.14743292335321E9 12249955471390332.374 2022-07-11 2022-08-04T22:33:31 2022-10-08 47.235.187.120 JoshuaPerry@Wordpedia.com Utah Avenue 54
+2022-03-11T20:17:23 953563840 69892845086489081.642 false 76 11843 2419 1413362882 32233.459 2.147432562021997E9 63085092039170869.321 2022-10-26 2022-05-08T10:23:32 2022-04-04 240.88.225.211 nemo@Rhycero.com Nova Court 10
+2022-09-07T07:35:38 1376216092 83819753605409270.940 false -121 24247 -24187 675804821 -20800.373 2.14743177926813E9 54374081283430912.995 2022-03-08 2022-05-16T23:30:23 2022-04-10 161.243.186.40 delectus_voluptas_aperiam@Tagtune.org Forest Run Plaza 25
+2022-09-04T03:43:28 -785451379 38108027258674830.609 false 37 6603 14897 408672726 -25067.922 2.147426985925759E9 94979755077430855.427 2022-12-27 2022-04-23T03:02 2022-02-07 203.203.153.47 iste_est@Thoughtstorm.org Superior Hill 0
+2022-11-13T18:40:31 -1834847947 94408615957889922.260 true 91 1792 -10013 -1481262619 136.31235 2.147421724471276E9 78587339836232130.857 2022-11-13 2022-10-10T09:11:53 2022-05-17 243.176.29.130 laboriosam_quasi_quos@Devshare.mil Schmedeman Road 28
+2022-12-16T09:20:02 -371885987 49650554866602497.370 true -64 -28281 -14560 905661693 -13961.722 2.147417387496636E9 92469965794419874.219 2022-10-29 2022-06-09T04:57:20 2022-10-26 206.2.225.250 mParker@Oyondu.com Dapin Avenue 28
+2022-06-15T16:56:51 318786654 19312280480540543.880 false -128 -20686 -8126 -1552841847 11839.364 2.147413172813562E9 41648836477421064.713 2022-07-14 2022-08-21T08:59:58 2022-09-23 5.195.160.79 uBarnes@Topdrive.edu Coolidge Way 33
+2022-08-09T07:40:01 -878937379 53857411133700231.500 false -106 8200 16814 -1880737224 -31797.973 2.147412744844992E9 75564725097441111.249 2022-01-19 2022-01-25T12:55:42 2022-03-17 107.150.26.3 eVasquez@Jabbercube.info Shoshone Circle 50
+2022-09-08T16:18:16 -1506689957 68351529092632845.532 false 8 18536 -2976 -183877855 11343.571 2.147399311893309E9 71012217344071727.370 2023-01-10 2022-10-09T08:21:53 2022-01-28 200.126.93.129 StevenGonzales@Skilith.net Eastwood Lane 56
+2022-12-24T07:43:42 -365827392 28417565408603064.442 false 28 -13958 -25865 690921161 -1557.4167 2.147391585487465E9 11894844023068530.736 2022-11-26 2022-07-21T16:17:14 2022-11-19 174.50.207.114 voluptas_ex_quibusdam@JumpXS.gov Tennessee Parkway 38
+2022-07-04T11:42:30 840320864 8454955674736884.949 false -107 -32128 29734 1693609531 -15432.139 2.147374650680583E9 74009074929680668.123 2022-09-07 2022-09-10T09:28:50 2022-08-06 237.78.243.35 BonnieMurray@Quinu.net Golf Course Terrace 1
+2022-01-20T14:09:12 1065362379 3956641329612931.282 false 54 14504 -18689 1723072084 -20047.71 2.147374402750129E9 32781601533828468.477 2022-12-26 2023-01-04T07:29:52 2022-10-21 64.182.181.153 7Richardson@Devpoint.biz Westridge Terrace 47
+2022-10-24T12:19:09 -411624765 39890706948753974.422 true 48 18524 31536 -1501617938 1917.4728 2.147374277357E9 46226364337403049.211 2022-04-08 2022-02-28T23:14:02 2022-04-19 231.224.150.46 PatriciaWebb@Tagchat.gov Golf Hill 78
+2022-10-01T14:17:44 -416214628 12066789381999898.187 true -105 18780 21173 -202772752 3968.7388 2.147372430138913E9 40350761596541333.603 2022-06-01 2022-06-20T20:45:14 2022-09-09 194.138.106.58 DianaAllen@Fivespan.biz Everett Pass 59
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_asc.out
new file mode 100644
index 0000000000..715fa74ceb
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q09_decimal_asc --
+2022-11-21T02:13:11 -2094463843 82013240745568720.901 true -126 -287 -6431 -990277862 8351.304 9.52050585850082E8 104274718933.432 2022-10-10 2022-05-07T07:44:30 2022-06-26 151.59.35.29 saepe_perferendis_ab@Yotz.edu Porter Plaza 40
+2022-03-23T21:01:42 63620993 18877219711981123.246 false -124 -27634 11605 -1570634768 18759.242 -8.53030323635455E8 238388965769.804 2022-02-09 2022-10-18T01:16:37 2022-09-22 166.200.198.197 qKelly@Einti.com Green Ridge Lane 56
+2022-01-23T17:20:35 772939954 79625029259661832.927 false 17 25509 -712 -54139136 17758.87 1.78211739312035E9 241226087670.720 2022-08-20 2022-03-17T23:05:52 2022-08-21 33.167.110.221 AndrewSims@Aimbo.net Stephen Park 32
+2022-09-27T19:14:53 269519612 33235860598493411.504 true -89 13926 10398 -546659434 26608.496 9.70142659013418E8 378676839453.902 2022-09-30 2022-10-24T14:04:16 2022-06-17 220.92.0.99 vChapman@Abata.com Dorton Hill 77
+2022-02-15T03:19:24 1004223908 86999570572123405.400 false 11 -13716 -23084 -385171186 27309.123 1.716578506914097E9 434372319510.908 2022-09-25 2022-09-02T06:06:56 2022-12-08 125.240.174.59 et_molestiae_non@Pixoboo.org Coleman Pass 49
+2022-10-13T19:00:54 -1620632531 3296721712805713.971 true 64 -5015 -29331 -807690206 15233.427 1.359906008175727E9 474043731872.732 2022-01-24 2022-06-27T02:26:22 2022-11-24 7.161.103.24 CarolCrawford@Fivebridge.edu Colorado Park 15
+2022-09-05T10:19:11 -109280563 40924992124640391.216 true 11 1205 -20248 -189384810 15941.971 1.155589209973932E9 658402189460.136 2022-06-14 2022-09-26T13:26:56 2022-02-03 156.11.79.235 2Ross@Jetpulse.mil Glendale Lane 58
+2022-10-18T19:22:21 -78343958 80953826781875982.688 true -90 -6042 26893 1689911978 -5118.9185 -6.43478737364875E8 885035886287.540 2022-09-27 2022-09-17T09:14:05 2022-02-17 76.215.214.71 nostrum_dicta_excepturi@Zoombox.name International Center 6
+2022-09-03T23:14:13 -1163677228 63984933812840887.410 true 46 -29000 17658 -2126469198 -11242.861 -1.380599417257768E9 1102989768080.759 2022-11-30 2022-09-22T14:46:47 2022-03-15 102.25.80.204 qui@Edgeify.org Bonner Crossing 40
+2022-06-27T11:28:34 1470915099 15993738623443003.311 false -54 24192 16174 1695169698 856.2539 -1.179340611439944E9 1192584436496.690 2022-08-14 2022-09-29T22:43:24 2022-04-14 144.180.163.119 ipsam@Wordify.net Randy Court 90
+2022-10-14T04:54:56 1009547889 22192081719878907.454 true 33 -3474 10616 1476451250 9865.36 -1.057024605749733E9 1307922323512.678 2022-02-06 2022-10-23T18:15:14 2022-04-25 25.8.135.230 ab_sint@Kare.info Brown Circle 90
+2022-09-20T09:13:40 696034893 60176335006203914.181 false -112 -27283 2207 -1099640075 -6205.9883 8.73004570867467E8 1364712051686.780 2022-08-05 2022-02-16T23:03:06 2022-09-29 8.73.82.32 qui_amet_sed@Demimbu.net Surrey Crossing 65
+2023-01-05T05:02:29 -1881690009 82692433157462219.355 true 123 -15988 -30951 -484056798 -6971.7705 -1.450082975919906E9 1546077432131.302 2022-06-13 2022-10-03T20:25:07 2022-07-02 0.247.223.33 CarolynBradley@Jabberbean.edu Grasskamp Road 39
+2022-12-03T00:39:22 -1869314153 91471053441982863.900 true 107 -17315 16251 1083714597 -522.2943 -1.344632809022432E9 1650345856597.424 2022-10-07 2022-12-02T15:02:22 2022-09-11 107.87.16.12 ArthurOlson@Browsezoom.net Merchant Plaza 68
+2022-12-11T02:53:55 76648457 19353454235864461.644 false 73 27396 -21583 -580821534 -11190.054 -1.643367278440527E9 1680327468670.480 2022-08-27 2022-05-30T07:30:49 2022-12-15 130.24.210.219 PamelaGordon@Cogidoo.edu Utah Park 40
+2022-09-03T16:18:03 -2030067917 73821097923517915.774 true -43 -19482 21813 -1298426450 18488.309 1.154939669212595E9 2128119976896.118 2022-05-03 2022-04-26T23:06:46 2022-03-18 226.235.187.38 laboriosam_accusamus_iste@Devify.biz Grayhawk Center 68
+2022-09-10T10:51:55 -110467611 97568616219333432.353 false 91 5750 -26891 1287314168 -30644.705 1.747664269464388E9 2189861255277.600 2022-05-05 2022-04-26T04:38:55 2022-10-01 21.110.66.170 omnis_ut_inventore@Meetz.org Pawling Street 52
+2022-08-07T10:31:28 67641154 91779882057472742.208 false -31 23732 -1370 1438330869 -11211.295 -1.217490499883765E9 2573316059081.415 2022-06-13 2022-06-04T19:47:14 2022-09-14 228.39.218.73 voluptatem_ab_quidem@Skimia.com Mayfield Trail 92
+2022-09-01T18:30:38 1246194234 22790783297462329.277 true -34 9417 5985 -737940949 15110.503 2.079840062685427E9 2701365024477.353 2022-12-11 2022-08-23T08:42:16 2022-07-17 30.50.249.229 rReyes@Feedbug.org Washington Circle 51
+2022-06-25T16:17:26 1069327136 40438284601243562.653 false 108 -11471 -7937 -1266148182 25716.775 1.179133008519111E9 2704806075959.329 2022-10-16 2022-12-28T20:15:22 2022-10-31 101.8.185.15 5Barnes@Yodoo.net Northridge Terrace 49
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_desc.out
new file mode 100644
index 0000000000..fe596153ae
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q09_decimal_desc --
+2022-02-08T17:09:22 -48778739 80013672506374964.175 false -104 -21630 20223 1753753753 11044.746 2.0486295517382E9 99999907302815431.463 2022-10-03 2022-03-03T02:57:55 2022-02-11 77.69.100.114 doloribus_labore_possimus@Topicstorm.org Paget Trail 37
+2023-01-10T07:23:51 1902847973 11854731116764143.883 false 3 19740 27573 1013255347 14831.712 1.407728698006076E9 99999825142998731.887 2022-06-20 2022-11-11T12:21:25 2022-07-29 210.105.147.152 JoycePowell@Ozu.edu Waubesa Court 18
+2022-06-02T06:09:09 1213684540 47131855708359167.528 false 42 19491 23518 -1344262688 -24247.63 1.198089740108392E9 99999691649048205.378 2022-12-28 2022-09-26T13:27:26 2022-02-23 109.77.118.88 JudyLittle@Dynazzy.net Green Ridge Center 66
+2022-08-16T23:08:20 -856766628 4699441330808714.534 false -2 -22018 -17776 -224328857 2318.4412 1.668053802644466E9 99999690569344852.757 2022-06-25 2022-06-05T09:48:15 2022-05-25 114.246.69.219 JenniferRay@Dynabox.biz Cascade Plaza 53
+2022-02-01T12:57:15 -771189588 73326124982233438.548 true 27 -21510 -1701 944304750 -23516.396 1.282086787685226E9 99999527862620834.260 2022-05-17 2022-02-28T19:27:18 2022-09-25 231.243.121.69 DanielCox@Agimba.com Havey Pass 12
+2022-01-31T02:48:49 1299358565 25906682705073769.881 false 16 29340 7115 1414075728 1121.1704 2.5768813823955E7 99999480488551022.370 2023-01-04 2022-08-07T00:14:20 2022-12-28 157.70.26.221 eCampbell@Demizz.info Mendota Trail 94
+2022-08-29T18:38:23 -1829957619 85764936027920089.444 false 108 21050 -24102 898524354 2950.0564 5.2627884713044E7 99999427697608819.875 2022-01-18 2022-12-28T02:19:52 2022-09-08 18.149.12.111 LillianWatson@Flashset.biz Bonner Crossing 10
+2022-03-06T04:28:17 -1269636186 86632186864138858.274 true -52 29201 -31216 -2008441711 -15075.176 1.991885690891815E9 99999353009708383.460 2022-04-28 2022-01-16T11:41:36 2022-07-04 79.170.36.184 JoyceCrawford@Demivee.name 1st Pass 35
+2022-01-24T12:21:24 -1233125274 41826205585929464.702 false -42 30950 18627 -1245545292 -23570.18 1.167376285421624E9 99999171140586231.458 2022-05-15 2022-02-03T10:45:35 2022-05-17 79.221.191.181 RobertHenry@Youspan.edu Namekagon Avenue 56
+2022-07-13T00:07:51 -2146282454 15708754671771196.309 true -120 -1603 -21307 -322123500 12998.556 -3.21255428700764E8 99999040341261239.986 2022-04-27 2022-06-14T10:46:04 2022-06-28 12.247.87.160 jSmith@Avaveo.edu Loftsgordon Park 13
+2022-02-24T05:51:55 -891068687 94201901147831645.849 false 100 -12535 27960 -351386551 31962.186 -1.117344705452739E9 99998894052756341.691 2022-10-15 2022-01-23T15:47:59 2022-12-27 214.103.101.167 fugit@Blogtag.info Londonderry Avenue 34
+2022-10-09T01:23:56 -3065303 82458962889574301.734 false 5 -14392 8963 21170466 31113.385 -9.51652551293124E8 99998881983973310.520 2022-09-06 2022-07-20T20:40:23 2022-04-30 204.208.183.176 GeraldMcdonald@JumpXS.gov Forest Place 30
+2022-05-06T08:15:30 515729994 20089459116854946.510 true 116 28655 19783 -11683504 23774.346 1.656190033684653E9 99998855004419177.993 2022-11-24 2022-10-25T13:26:48 2022-06-07 138.8.107.3 repellat@Wordtune.edu Carpenter Junction 31
+2022-03-16T21:47:01 -700924173 43597087835894757.488 true 115 -3371 -9369 -1781241348 -15935.006 -9.67698551989422E8 99998768537510278.178 2022-07-21 2023-01-07T01:56:26 2022-02-22 173.251.108.10 BillyPatterson@Youbridge.name Sugar Alley 77
+2022-01-21T01:53:56 405529197 61167166838010741.959 true -40 -31072 -25490 1292850334 -32196.783 -6.14483966690681E8 99998748853209208.254 2022-12-02 2022-03-19T12:53:35 2022-11-26 1.41.65.135 JimmyRichards@Skyble.name Clemons Court 95
+2022-10-16T23:15:34 -1458420761 44969884991550372.471 false -20 10877 5574 -1083190436 -29883.58 -6.0318331732583E8 99998717054111542.440 2022-09-21 2022-04-30T20:43:19 2022-07-31 159.31.214.125 2Williamson@Realbridge.com Birchwood Circle 86
+2022-01-19T08:12:26 1069420461 48641501549913926.379 true -88 -21207 -17949 -358989795 -23976.33 1.204454319052688E9 99998602099384240.852 2022-03-11 2022-07-29T16:08:44 2022-05-15 12.196.143.0 qui@Twitterbridge.com Dryden Park 91
+2022-01-22T15:02:50 -1712946627 88486850141625387.602 false -43 31026 31662 223964349 31242.354 -7.45960341584651E8 99998455443281923.303 2022-12-20 2022-04-02T13:51:17 2022-06-06 115.56.41.137 JaneFowler@Eimbee.com Stoughton Place 93
+2022-08-02T06:01:31 351046507 65769339050839139.461 false 58 7055 -26702 -802851458 -4760.95 -3.9827864019842E7 99998314621099249.720 2022-12-12 2022-10-13T15:05:51 2022-04-04 180.220.39.66 soluta@Flashpoint.biz Graceland Place 45
+2022-08-17T22:48:27 -565676017 85524665042635216.550 true -105 -19148 -18398 -936458606 2016.3842 9.437143901522E7 99998289681366107.356 2022-06-27 2022-03-01T09:12:42 2022-04-24 4.114.35.116 aut_hic@Flipopia.edu Crescent Oaks Center 46
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_asc.out
new file mode 100644
index 0000000000..bb0031a4e0
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q10_decimalv3_asc --
+2022-05-29T04:07:47 -789106469 224953913168.281 false -2 -20724 8844 -1245074969 -6347.4688 -1.215439687058768E9 28913011806406311.945 2022-12-10 2022-11-02T22:26:53 2022-09-28 148.14.110.116 KimberlyThomas@Tanoodle.info Fulton Plaza 22
+2022-05-21T08:37:29 715001192 295451347869.709 true 39 23629 -32754 -1823668862 -18180.234 -1.813637574700689E9 6456346804537335.538 2022-12-31 2022-12-27T20:24:33 2022-07-31 201.60.224.145 JohnnyFlores@Wordtune.info Loftsgordon Parkway 82
+2022-12-05T21:37:35 -160429213 545942280027.415 false 80 7436 -8846 687387519 24064.27 -2.132744818000418E9 83505318895222282.424 2022-08-19 2022-10-26T06:47:58 2022-05-18 81.13.195.129 BarbaraPierce@Tagcat.org West Park 22
+2022-09-18T07:21:01 -366369852 656084436389.326 false -9 3850 29335 464530994 13906.77 -1.994977344890222E9 2175505787912007.691 2022-07-22 2022-02-21T11:17:16 2022-10-23 155.170.179.115 animi_rerum@Trilia.com American Circle 20
+2022-06-18T17:34:02 -658208211 656428206744.592 false -48 27172 -26231 1983716950 1054.4502 9.54529071331357E8 59614133728718616.981 2022-09-17 2022-07-28T20:56:57 2022-12-28 110.249.164.90 xAlexander@Ainyx.gov Mandrake Pass 26
+2022-05-09T22:05:07 1115035313 666861267107.644 true 79 32766 9212 450171396 -1866.4689 7.77563839932363E8 90992477662136679.337 2022-12-13 2022-03-19T09:35:44 2023-01-02 218.227.189.124 suscipit@Trunyx.biz Sauthoff Hill 54
+2022-03-30T14:54:45 71063199 804031754534.881 true -26 -17233 23381 1325780104 -7717.424 1.84952175633689E9 91654833374919592.894 2022-02-08 2022-06-01T10:18:18 2023-01-07 207.134.2.218 StephanieHayes@Zoomlounge.net 7th Lane 31
+2022-08-22T14:09:55 1492965080 828460225722.464 true 8 -20890 7535 -73825703 9222.409 -1.444812642568396E9 41957274954652166.262 2022-05-21 2022-07-06T05:32:09 2022-11-05 27.246.116.114 4Harvey@Quatz.biz Kipling Park 43
+2022-12-21T20:40:42 -712876242 835143560344.531 false 119 12521 -1493 341763481 22953.76 6.03741368661214E8 38926544549455190.948 2022-01-12 2022-08-13T06:07:16 2022-01-13 140.156.80.20 DeborahRamirez@Jetwire.org Forest Pass 2
+2022-12-14T16:11:27 1377250237 861636208375.810 true 56 22180 -7637 -1747439805 21856.328 1.477063082563715E9 42594042587766210.946 2022-08-23 2022-06-14T23:50:21 2022-11-19 39.242.210.218 EricJohnson@Buzzster.com Golf Course Court 77
+2022-11-14T13:15:25 -1973752124 900270045103.661 true -8 1831 -20566 78273074 -30708.668 8.08196311683926E8 9289472022583529.807 2022-12-09 2022-04-02T05:11:10 2022-09-02 20.150.111.99 hRomero@Oyondu.net Moose Circle 64
+2022-04-08T13:35:18 800676046 952066991241.367 true 4 19011 -10345 486535128 7727.1616 8.66323042068133E8 90517464330331470.348 2022-11-29 2022-12-31T05:44:37 2022-07-22 105.23.253.228 pFernandez@Oyonder.name Magdeline Crossing 10
+2022-08-09T18:35:16 1952267990 1051051893998.771 false -53 -26987 -9039 -355033895 -21641.64 -8.23738655422749E8 19814816503611626.392 2022-06-01 2022-05-06T20:00:39 2022-06-16 22.199.142.108 JoyceCarroll@Jamia.com Anniversary Alley 79
+2022-12-31T20:52:26 -366788314 1284601191000.995 true -82 5337 -23707 1707369917 -1361.867 1.708340177834741E9 21377893310656745.228 2022-12-30 2022-06-27T16:04:45 2022-07-07 237.32.110.81 cum@Feedfire.info Main Junction 23
+2022-07-13T02:14:12 1789084898 1362561229786.168 true 60 3174 10131 2079254538 -19499.953 -1.045203028440303E9 7972412282094692.838 2022-08-14 2022-01-24T01:46:34 2022-07-29 75.194.81.39 KathyJohnson@Divape.com Reinke Alley 18
+2022-05-29T15:54:36 1608145109 1414473603522.946 true -85 -5774 28735 191621007 10726.853 -1.732467449211401E9 90327418585674894.350 2022-11-30 2022-03-23T22:18:15 2022-12-16 249.38.147.73 5Vasquez@Brainbox.edu Towne Alley 65
+2022-08-22T03:21:23 1415857152 1419028141544.445 true 10 -346 1694 -333578251 13900.476 -1.112134277678726E9 52007129676995076.853 2022-06-18 2022-11-06T09:37:38 2022-07-30 126.211.82.252 jSanders@Roomm.net Nelson Junction 84
+2022-07-21T23:46:31 335272384 1457107238489.783 true -43 -15944 -18320 1248150534 -484.68964 -7.84732813528091E8 51785776656453601.162 2022-11-20 2022-05-22T01:30:39 2022-10-05 113.237.137.137 aGordon@Gabtype.gov Kingsford Park 6
+2022-04-03T01:58:27 1110213845 1589727276392.832 false 66 -2716 -4346 1464096993 1479.1958 -3.79576519283935E8 42813791657086925.329 2022-07-25 2022-11-10T16:23:33 2022-06-07 82.229.218.235 doloremque_ullam@Mydo.net Mockingbird Trail 11
+2022-03-14T13:44:37 1784415930 1647996775734.968 true -33 3949 3308 -1497191255 21905.285 1.106241012693313E9 47579901407103912.628 2022-09-20 2023-01-02T23:46:26 2022-04-02 78.149.140.10 KimberlyGeorge@Flashset.net Forest Street 54
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_desc.out
new file mode 100644
index 0000000000..bbe49d644d
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q10_decimalv3_desc --
+2022-04-16T18:40:21 -1010214952 99999747825367559.824 false 52 8375 28995 1328062044 -5155.519 1.247576590267535E9 1095923614063639.584 2023-01-02 2022-02-03T03:36:12 2022-12-01 127.81.56.105 dRobinson@Bubblemix.com Sherman Road 0
+2022-09-23T11:43:36 -916474103 99999732640045963.240 true 47 -27745 13671 -945279221 12600.383 -1.641240639347924E9 81062820059332745.878 2022-05-24 2022-07-16T06:34:33 2022-05-29 176.97.43.237 tYoung@Skimia.com Charing Cross Park 77
+2022-01-14T06:11:43 1430545038 99999668905903753.800 false -37 29751 -32025 -1924214800 -17488.03 -1.906916102532119E9 1518199245825383.703 2022-05-26 2022-10-05T10:32:41 2022-06-03 41.34.214.184 tempore_ipsum@Kaymbo.net Porter Park 0
+2022-09-13T20:43:08 -1344408641 99999640320859162.916 false 70 1562 -15950 114167053 -21606.701 -1.278566458297833E9 57179008381468335.649 2022-02-27 2022-01-19T10:12:12 2022-08-13 43.137.12.5 JuliaStevens@Skalith.com Scoville Center 33
+2022-10-01T18:36:11 404652057 99999634230240441.246 false -72 22590 18587 1203355781 -17286.275 -3.36294130382289E8 52582933810361935.535 2022-07-15 2022-03-22T23:07:59 2022-10-29 226.204.6.102 ToddPalmer@Quimm.edu Colorado Drive 61
+2022-01-22T01:00:14 1534958901 99999425434743386.320 true -56 -2049 25348 -1467923070 22919.861 1.075822569370258E9 89288386125599355.178 2022-07-09 2022-05-07T16:43:16 2022-12-09 105.69.100.111 SharonHughes@Linkbridge.edu Macpherson Junction 44
+2022-12-18T02:18:01 -1774129340 99999239001172237.417 false -103 -13772 -16674 1914414398 4393.039 3.07730150126997E8 97847995016045403.360 2022-04-17 2022-12-17T10:49:30 2022-01-28 149.56.180.142 qui@Browsetype.name Dahle Place 35
+2022-11-05T06:58:13 744522189 99999173920040702.700 true 90 6622 -22730 -1085894753 22869.305 -2.04906230579109E9 3271938319169910.892 2022-10-18 2022-07-06T22:41:25 2022-05-27 107.161.10.23 amet_facere@Skidoo.net Ludington Road 93
+2022-11-23T16:56:58 950224824 99999072440532391.285 true 21 6888 -21489 626221868 13896.374 -8.39726839172374E8 4350218835152252.627 2022-01-13 2022-05-12T16:29:03 2022-04-02 43.21.14.100 sequi_molestiae@Zazio.com Bultman Alley 21
+2022-10-21T03:47:04 -489035542 99999041991592107.612 true -69 29414 10058 -1993314704 -31865.492 6.64789455492839E8 3544688816701520.657 2022-01-13 2022-06-29T07:54:47 2022-07-19 176.43.134.251 NicholasJordan@Trilia.gov Monterey Circle 42
+2022-06-27T18:25:29 1666278716 99999037068648323.555 true -25 2545 830 1934706209 20796.746 -1.225709884225744E9 95560165404082727.447 2022-10-09 2022-11-15T02:07:45 2022-03-25 120.254.105.82 praesentium_dignissimos@Fadeo.org Heffernan Park 78
+2022-01-22T16:03:13 2070967367 99999002507124942.581 false 50 27647 17350 1336110107 -6784.9307 -2.127600570389967E9 90368901623776618.789 2022-08-20 2022-02-06T08:26:17 2022-01-31 94.199.87.44 JohnnyOrtiz@Roomm.com Lukken Street 59
+2022-07-03T00:28:45 -334403295 99998844514984453.994 true -89 -15411 -31625 -573722982 -6336.6694 -1.183579017709985E9 5870087526645738.360 2022-06-15 2022-07-09T01:09:52 2022-11-29 22.104.128.110 dolorum@Meeveo.name Ramsey Terrace 82
+2022-02-21T16:38:33 -1679145705 99998811574612033.430 false -125 24463 -18640 2122053485 32360.127 -9.24309285036904E8 14377693673005046.550 2022-05-21 2022-12-27T05:06:39 2022-12-14 116.53.6.137 sapiente@Eimbee.name 4th Hill 73
+2022-06-25T18:59:37 -1535092205 99998803472203687.302 true 113 15993 31947 1237162395 26000.998 -1.541666114735052E9 83656441106578636.443 2022-04-12 2022-11-29T15:00:13 2022-12-03 235.182.155.40 in_fugiat_perferendis@Photobean.info Buell Plaza 78
+2022-02-23T08:05:32 -1185372022 99998723123158129.612 true -76 17823 16276 502635722 8045.3154 -1.383947363140137E9 63988461392414815.618 2022-06-25 2022-07-07T06:18:27 2022-07-10 44.194.194.46 RebeccaBrown@Jaloo.name Gale Avenue 92
+2022-05-04T11:24:41 -1922905302 99998568819864508.395 false 35 -27529 12453 135644899 -25303.123 -1.123671605866239E9 94034450353515393.270 2022-06-16 2022-10-11T15:24:07 2022-07-21 50.254.6.198 dMills@Skimia.gov Reindahl Plaza 44
+2022-07-16T11:02:22 683483771 99998312563274227.717 true -112 12875 -25206 -1438386774 4347.295 1.506470693807616E9 88643665771885132.584 2022-01-22 2022-03-06T12:09:32 2022-07-15 101.108.186.87 NormaKnight@LiveZ.biz Gale Center 35
+2022-06-17T22:08:14 -23445822 99998108790492690.570 true -31 25999 19375 234441053 -19584.082 -5.70783230876946E8 72814161415290058.825 2022-11-14 2022-12-08T18:38:37 2022-06-22 6.10.22.70 7Parker@Quimm.biz Waxwing Hill 93
+2022-07-06T10:08:54 -1712737615 99998036695606472.762 false 100 -31303 -22809 1377576722 22449.87 -1.437888446033773E9 35445448729929966.300 2022-09-16 2022-10-02T19:13:57 2022-12-19 4.93.160.191 EugeneWright@Fivespan.name Rieder Terrace 88
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_asc.out
new file mode 100644
index 0000000000..04704a5be9
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q11_date_asc --
+2022-04-25T18:08:03 -2136089243 36803235001158739.790 true 16 -19507 8330 -573416157 24291.943 -2.044079012439694E9 98823911702020758.323 2022-01-10 2022-02-06T21:24:14 2022-08-30 145.213.37.250 soluta_velit_sint@Centidel.org Atwood Drive 52
+2022-12-02T01:59:13 -2124085593 63319058192011694.255 true 114 -23385 13529 1355190506 -25249.451 -2.063695504681695E9 16213871536504510.983 2022-01-10 2022-06-16T07:18:01 2022-11-25 139.135.53.164 JoshuaPatterson@Riffpath.org Eagle Crest Point 20
+2022-08-20T19:47:43 -2118550490 58914727532485247.351 true -102 16807 1582 -961515504 27808.71 -5.49781788171066E8 58215663511753687.121 2022-01-10 2022-07-04T07:40:02 2022-08-15 95.142.162.117 qWatson@Innotype.com 6th Alley 76
+2022-11-05T22:07:52 -2115824485 24087808672011992.668 true 66 -10258 -18247 -129687083 -2207.829 -1.789678928809944E9 67455083593991945.328 2022-01-10 2022-10-02T03:03:19 2022-09-04 122.51.165.56 RobinDunn@Kimia.mil Blackbird Crossing 53
+2022-12-14T20:24:16 -2095967062 96507502027785313.709 true -77 -1046 3582 -258412188 -9147.349 1.099851670900486E9 98832230981550821.348 2022-01-10 2022-06-01T15:40:35 2022-12-30 65.95.22.198 2Armstrong@Yambee.gov John Wall Hill 33
+2022-08-18T18:43:10 -2092967033 84464451114820192.447 true -122 -29846 2096 -1502322884 10074.492 1.58406588921841E9 60354648484131640.262 2022-01-10 2022-11-18T19:13:06 2022-12-11 1.100.233.200 JonathanWheeler@Bubblemix.net Esker Alley 3
+2022-09-06T07:08:29 -2087897275 13014564554055456.834 false -11 -29639 24830 -864417043 -27362.47 -4.42142425714961E8 23301017897934618.914 2022-01-10 2022-07-06T21:01:52 2022-11-28 70.150.117.116 mRogers@Wikivu.org Lunder Trail 42
+2022-04-26T22:37:17 -2085227401 67883758725303394.951 true 125 24891 20485 1387822597 -29551.752 -7.51503927591174E8 83490924321421189.731 2022-01-10 2022-05-05T19:26:08 2022-12-28 231.37.55.38 8Carter@Feedmix.mil Logan Place 53
+2022-03-05T16:13:25 -2080027061 71674617947241266.630 true -100 -6485 1840 -683694166 24901.457 -8.76185833240946E8 48852235830078324.720 2022-01-10 2022-12-14T07:00:37 2022-07-02 196.168.27.195 FrankGilbert@Pixope.info Prentice Pass 87
+2022-12-14T12:13:24 -2077449691 16569341791761686.932 false -69 -8072 -32585 -605877345 -22103.316 -1.433425324070884E9 29997670481504283.395 2022-01-10 2022-03-01T01:15:43 2022-06-24 170.175.139.138 esse@Linklinks.info Warner Crossing 60
+2022-01-23T13:20:42 -2077437148 16828496110699534.790 true 70 1571 -3627 -1608684637 25449.088 3.52372438023482E8 9810271127104778.377 2022-01-10 2022-01-29T12:47:14 2022-06-05 114.93.129.117 totam_aliquam@Trunyx.name Mandrake Way 30
+2022-05-03T00:57:06 -2073518326 26610224448960906.375 false 50 14702 -1550 -1033108812 12473.847 -6.3161006583213E8 14436847231070161.109 2022-01-10 2022-05-18T02:31:56 2022-10-25 242.93.200.208 lCarter@Devpoint.com Maple Wood Hill 50
+2022-02-22T01:40:53 -2070345822 46152588533434926.209 true 18 -2180 15082 -1265186829 13151.707 1.2197607452317E8 56063508279381863.367 2022-01-10 2022-11-15T00:41:44 2022-06-16 132.56.247.63 assumenda_molestiae_culpa@Quamba.mil Kennedy Circle 29
+2022-03-04T04:24:27 -2064567991 21745766435033628.720 true 48 -16478 -29574 1895980983 -29204.008 -1.522171408921843E9 53672504337973221.511 2022-01-10 2022-11-13T17:18:30 2022-06-26 86.219.99.215 KarenDuncan@Quaxo.name Jay Terrace 2
+2022-07-24T21:30:48 -2064253439 4818893478016717.292 false 41 13891 -26496 -243810128 -8276.231 3.95595458403956E8 53860411271916852.861 2022-01-10 2022-03-15T21:53:31 2022-03-15 211.130.236.133 necessitatibus@Teklist.com Talisman Drive 6
+2022-06-02T17:00:37 -2059830502 94748615728602621.360 true -14 29076 -3863 24191520 -4271.069 -2.136208546119772E9 49579391641389305.412 2022-01-10 2022-09-29T13:33:55 2022-12-12 151.174.44.99 sHowell@Meembee.mil Roth Point 25
+2022-06-08T04:14:35 -2051444231 96764243000217184.938 true 48 -9530 -13569 1890413268 11796.022 1.731528150371074E9 24782330162456582.141 2022-01-10 2022-11-12T02:07:20 2022-09-08 233.214.208.252 consequatur_tempora@Jatri.gov Wayridge Park 12
+2022-01-22T16:22:33 -2050195325 56954426225924199.910 true -34 -4666 -31031 -1773849298 6089.9756 2.119721038034936E9 82394233604701364.314 2022-01-10 2022-09-17T07:21:37 2022-09-28 213.207.238.130 CharlesFernandez@Katz.name Larry Parkway 22
+2022-03-27T03:47:31 -2037093680 34198987134748818.265 true 75 4023 -11950 48896844 6940.73 3.35736744420993E8 25279482426826273.959 2022-01-10 2022-07-18T20:01:56 2022-07-05 7.223.96.201 RobinLee@Twitternation.name Fallview Park 71
+2022-01-25T05:40:54 -2035438927 92967735922682585.853 false 95 -20718 -7608 -1852418234 26781.89 4.1762320229463E7 40181738950406136.320 2022-01-10 2022-07-03T05:27:10 2022-06-01 124.195.54.27 BrianRuiz@Yotz.info Sullivan Alley 67
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_desc.out
new file mode 100644
index 0000000000..e16aea69b4
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q11_date_desc --
+2022-01-31T11:22:31 2147171064 62858433964902277.438 false -57 25710 27708 -1083150336 443.9486 -2.86423836710735E8 85659629515126497.597 2023-01-10 2022-06-09T08:55:06 2022-05-13 142.127.205.24 FrankRichards@Rhynyx.org Maryland Pass 95
+2022-08-27T09:33:31 2143837975 15528482914420443.722 true 106 6496 13483 1146883043 -1042.6069 -2.9330997096231E8 11851817078532709.757 2023-01-10 2022-03-22T23:50:14 2023-01-06 78.38.251.75 KathyBaker@Twitternation.mil Maple Wood Drive 50
+2022-01-30T16:44:23 2141031258 90746287993996784.734 false 68 21907 -24340 1016634638 -22198.287 8.79444680816074E8 37633204902327223.218 2023-01-10 2022-02-26T10:56:38 2022-12-04 183.154.16.27 omnis_atque@Meeveo.edu Shasta Park 17
+2022-04-05T21:48:27 2140833548 67442640969144301.905 true 55 28478 -17048 867393855 -25025.035 -9.95075167042897E8 44206615458639731.626 2023-01-10 2022-12-24T11:46:41 2022-04-17 106.217.219.71 enim@Lajo.mil Weeping Birch Road 81
+2022-05-17T14:48:09 2139995069 10404865114081238.644 true -22 8503 10624 -762172645 -7851.69 1.685778554095771E9 18603007844498247.868 2023-01-10 2022-09-14T23:22:02 2022-02-27 181.226.43.236 yWagner@Quaxo.org Roth Trail 13
+2022-11-25T08:47:45 2137120100 53722728973748238.915 true 94 -24023 31438 791788416 11250.101 -1.441002296547653E9 65644625864269869.686 2023-01-10 2022-11-10T15:42:24 2022-11-02 76.246.100.125 RoseBoyd@Twitterbridge.name Oakridge Avenue 9
+2022-07-07T00:59:18 2137003315 2036546008974432.125 true -74 -8433 -8954 1057327836 14379.353 1.40471556116768E9 18172191219156250.483 2023-01-10 2022-07-12T22:20:27 2022-05-28 212.144.76.161 JudithKing@Youtags.com Namekagon Terrace 73
+2022-04-26T06:08:12 2134428023 20161304298218160.210 false 123 14065 25356 1359592390 9587.823 -1.15126135682833E8 78673083734657014.345 2023-01-10 2022-07-01T20:49:36 2022-02-08 149.89.243.7 nemo@Quatz.edu Old Shore Hill 83
+2022-12-29T01:08:21 2132496397 81344161904122194.599 true 111 28680 2039 -1862191065 29829.01 -7488369.629529 96275743577510749.589 2023-01-10 2022-03-10T20:14:05 2022-05-09 105.76.158.197 nemo@Blognation.biz Messerschmidt Point 17
+2022-11-26T16:56:51 2129501608 11588200352101124.733 false 58 14120 7978 -477632016 -19722.633 1.467067408318817E9 8090648029524509.447 2023-01-10 2022-01-23T01:33:41 2022-05-11 45.99.69.225 vitae_perferendis@Zoombeat.edu Victoria Place 87
+2022-03-23T08:43:46 2128997181 93885083872972672.219 true -76 -13413 26861 370950669 -7662.348 9.12047677759944E8 55066796449309174.770 2023-01-10 2022-09-03T22:52:37 2022-06-09 27.108.222.24 PaulaJacobs@Mita.mil Calypso Street 14
+2022-04-28T23:53:25 2128535300 59246800045440032.570 true -99 25529 -30120 -1224121458 -7418.188 -1.018512456276405E9 51228092948506456.752 2023-01-10 2022-09-01T11:19:45 2023-01-01 71.136.249.113 6Bell@Feednation.info Badeau Road 79
+2022-03-18T06:53:23 2121445015 79540867691227756.246 false -127 27056 -23918 759270155 -11075.16 1.367452304525654E9 1390141744548898.180 2023-01-10 2022-10-06T15:29:25 2022-08-01 151.87.74.252 vChavez@Fivespan.edu Beilfuss Lane 37
+2022-02-12T22:20:36 2121438078 94782206362654537.496 false 89 27846 -18231 92285843 26871.3 1.255516596279802E9 8458006545663366.358 2023-01-10 2022-01-20T16:38:52 2022-06-03 114.128.6.31 CharlesStanley@Brainverse.edu Barby Pass 4
+2022-05-06T10:24:54 2120869348 75016020435886720.191 true -62 32018 8431 -1437099419 10780.735 1.82531394142749E9 92672086784133326.690 2023-01-10 2022-02-12T17:14:11 2022-10-28 211.242.199.137 LindaFowler@Gabtype.gov Northridge Court 93
+2022-01-16T16:20:16 2120473752 45663165388620626.133 false -47 -13694 32637 226880678 27021.426 -440841.716447 50890508670557705.960 2023-01-10 2022-12-12T05:16:18 2022-05-22 11.252.109.68 6Fowler@Devpulse.name Menomonie Pass 55
+2022-10-10T18:19:20 2118735163 16315734799016695.602 false -14 -13399 5620 805215789 -25128.734 1.247336639130183E9 94167533490062711.295 2023-01-10 2022-07-06T08:29:14 2022-10-30 204.19.86.157 8Sanders@Bluejam.info Kipling Crossing 12
+2022-01-15T16:23:04 2114915255 47602509254638265.972 false -31 8525 -1795 -1713145605 6742.736 -2.006715395135593E9 36708610439067521.928 2023-01-10 2022-02-16T17:36:14 2022-07-24 245.156.208.104 KeithBradley@Wikizz.net Anniversary Plaza 53
+2022-06-11T03:00:02 2113139730 97202104508737561.152 true 56 -26934 -1186 621184115 -25364.152 1.934541410109143E9 9320633621180118.342 2023-01-10 2022-05-03T21:15:45 2022-10-30 90.67.255.60 5Morrison@Bluezoom.org La Follette Crossing 53
+2022-05-16T08:48:33 2106444088 2780964013381426.234 false -83 -19795 23289 640756214 -10731.697 -1.625470197269475E9 60792557643844173.824 2023-01-10 2022-12-13T20:24:21 2022-11-30 30.76.33.224 consequatur@Yozio.com Duke Drive 96
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_asc.out
new file mode 100644
index 0000000000..7e9ebaef1d
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q12_datetime_asc --
+2022-03-16T06:51:57 136659331 64395973718059954.328 false 104 -15824 30286 -1288345942 13452.328 2.013437229996864E9 52515748270989673.914 2022-04-14 2022-01-10T15:58:22 2022-11-28 79.233.179.146 RoseShaw@Reallinks.com Hansons Parkway 27
+2022-05-02T07:25:25 768464342 57190870707475100.282 true 73 -11287 -27016 2125223920 13369.397 -9.87914542455395E8 95927737281775565.136 2022-03-16 2022-01-10T15:58:31 2022-11-02 7.64.65.181 gHunter@LiveZ.net Oriole Circle 73
+2023-01-06T11:05:48 -1648142465 54677204030088082.409 true 79 21739 17305 1169224340 -4452.572 1.20081587170498E8 93022819774045829.230 2022-09-17 2022-01-10T15:59:05 2022-01-27 40.60.137.158 lWeaver@Voonyx.mil Nelson Point 82
+2022-11-20T07:12:24 1983361558 37796454160530349.938 false 12 31251 2064 284792847 22777.398 -1.473178599380819E9 8708970919680269.840 2022-02-21 2022-01-10T15:59:16 2022-07-08 120.102.132.244 sPowell@Thoughtbridge.org Rockefeller Pass 74
+2022-10-21T09:03:20 1885844901 73071962951227211.188 true -101 691 -23590 -1762405078 -21995.639 1.069765955025462E9 92762103346734638.819 2022-05-21 2022-01-10T15:59:35 2022-07-24 100.191.97.165 animi_nulla@Feedspan.edu Karstens Place 82
+2022-09-14T18:30:57 140768659 64741222367067744.400 false -128 -13755 -18262 262426471 21633.924 -5.31195483228335E8 56653641156549476.421 2022-02-10 2022-01-10T16:00:15 2022-07-27 116.146.1.140 KellyRobinson@Rhynoodle.name Ilene Court 30
+2022-02-06T14:37:49 521057052 59465139356192449.348 false 77 4836 21887 -1722331533 -22314.172 4.20100818339494E8 48480346882877531.917 2022-05-20 2022-01-10T16:00:30 2022-07-16 190.218.3.220 BettyAndrews@Dabjam.com Eagan Street 27
+2022-03-19T16:24:06 -326016194 40596598384439441.204 false 124 7383 -11847 -1343544935 23186.81 1.094967105220328E9 40999081648159066.827 2022-08-04 2022-01-10T16:00:37 2022-11-28 55.128.173.30 molestias_accusamus_ut@Centimia.net Sachtjen Plaza 24
+2022-01-20T08:42:12 1724747921 73809169266134389.891 true 3 -2180 -4863 1489565814 4529.6475 -5.44494140753884E8 18739735537324630.529 2022-08-25 2022-01-10T16:00:48 2022-02-07 162.67.16.171 RogerPatterson@Kwimbee.info Mayer Park 37
+2022-06-14T21:01:15 923399288 27419844037110652.150 true 79 -2357 -3287 -1690061360 1629.2401 4.98151886869095E8 48345363723307074.113 2022-09-17 2022-01-10T16:01:04 2022-03-05 37.53.114.66 jMoore@Tekfly.biz Coleman Drive 61
+2022-12-28T11:56:23 498557725 32440480483939584.697 false 66 13736 20225 1691617002 -28770.77 1.859059050176822E9 16973456685874873.530 2022-05-24 2022-01-10T16:01:45 2022-02-02 246.158.216.208 JudithRiley@Livetube.info Coleman Plaza 56
+2022-02-26T09:54:55 1362277550 75147328732864306.841 true -87 -24980 8626 761263433 -10682.875 1.204869422496459E9 6388839377342282.941 2022-03-06 2022-01-10T16:01:45 2023-01-02 91.24.148.99 BonnieWatkins@Youspan.mil Shelley Point 16
+2022-05-11T10:49:28 -1943845626 24482199120032665.120 true -126 11051 3393 -943421338 22719.35 9.8130093209596E8 43126263209608491.809 2022-04-24 2022-01-10T16:02:14 2022-04-29 23.103.245.11 iste_et@Chatterbridge.com Waxwing Pass 26
+2022-07-12T02:39:53 -1775850306 95934991241926225.524 true 72 -12304 22172 -525005035 2814.9053 1.180996237515648E9 87964064739140948.597 2022-07-28 2022-01-10T16:02:27 2022-06-12 42.18.241.169 quae_sed@Photofeed.info Buhler Place 9
+2022-11-21T00:05 1298448426 54092119712757010.886 false -41 -31180 10183 -745289014 11504.318 1.855337786519898E9 52962315651502772.909 2022-04-19 2022-01-10T16:02:54 2022-12-14 244.178.31.4 xRoss@Zoozzy.edu Longview Avenue 82
+2022-08-29T03:32:23 1215718088 43412176476359919.244 true -65 -29943 -759 -919029408 -17602.988 1.800776109984884E9 26525877105410978.684 2022-04-21 2022-01-10T16:03:31 2022-02-19 243.219.200.88 sunt_numquam@Skibox.name Hermina Court 83
+2022-03-23T15:16:01 1451235628 62176723050646167.536 true -40 -349 -14583 279870234 8201.707 6.49885206121071E8 89665151476675946.921 2022-06-15 2022-01-10T16:03:50 2022-10-25 135.163.50.172 TinaHart@Quaxo.mil Sunfield Hill 80
+2022-11-14T07:02:32 120232690 27699597717777080.850 false -18 -29068 -2539 995049806 2349.1514 9.50574861725708E8 67069277976863468.247 2022-08-24 2022-01-10T16:04:04 2022-04-28 101.14.179.42 mAndrews@Oyoloo.mil Blaine Plaza 65
+2022-06-03T22:36:14 -581460052 72734562394852711.410 false 75 -9696 3760 -2120607157 27925.836 1.892426389237949E9 1902718679437748.273 2022-01-25 2022-01-10T16:04:38 2022-04-14 42.184.181.140 ClarenceGarza@Oyoloo.edu Longview Pass 21
+2022-12-15T06:22:43 -1054071857 79920838378941619.402 false 98 22243 -6642 1544746333 25906.867 2.08388856967211E8 70193108754677521.215 2022-09-14 2022-01-10T16:06:10 2022-05-15 11.175.29.16 tRogers@Browsedrive.name Rowland Pass 2
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_desc.out
new file mode 100644
index 0000000000..331bdf342b
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q12_datetime_desc --
+2022-11-08T07:08:28 -1066005916 2711322022578576.820 true -25 -4830 -259 -1468142949 -15088.466 4.18529268033892E8 28789840661393982.630 2022-04-14 2023-01-10T15:58:19 2022-11-11 206.107.251.193 TammyMorrison@Edgeify.org Kingsford Junction 58
+2022-03-15T03:06:31 668254923 3782863113844868.873 true 69 20579 14896 145374625 -8449.486 1.018012378015139E9 52901779657013709.995 2022-12-10 2023-01-10T15:58:05 2022-07-15 153.174.252.249 AntonioBowman@Innojam.name Independence Point 44
+2022-10-14T13:35:15 2019994917 71657433427323725.194 false 96 -6782 25352 1873939398 24246.695 -1.754617292596912E9 61612550972100153.182 2022-02-06 2023-01-10T15:57:41 2022-11-24 60.0.162.255 KathyHanson@Vitz.info Schiller Way 80
+2022-05-29T01:48:58 1434871175 21362173204391739.292 false 14 9189 28370 1044101396 -4874.707 -3.7166526867238E7 52080969602253262.651 2022-08-22 2023-01-10T15:57:04 2022-04-13 188.199.23.151 ut_consequatur@Rhyzio.name Hooker Circle 22
+2022-09-01T10:07:13 1366406656 68465353279837169.200 true 81 21973 -6749 -2102012999 -30858.27 -9.351878342054E7 93886043582449574.701 2022-09-17 2023-01-10T15:55:43 2022-01-25 146.121.84.65 qui@Trilith.mil Cambridge Point 14
+2022-04-19T19:55:51 1703822649 51545907153704816.772 false 127 -22998 -8483 -1616142131 -19153.855 -5.82004175644415E8 74372372862774013.562 2022-07-15 2023-01-10T15:55:32 2022-03-03 243.188.73.192 oCooper@Talane.edu Del Mar Avenue 5
+2022-03-10T05:47:01 -1675630776 82003003039149538.999 false 1 -19409 -18103 -1372334528 -16445.648 2.018283835300718E9 88912041120172355.230 2022-03-23 2023-01-10T15:55:19 2022-08-21 251.168.233.153 RyanRice@Blogtag.name Twin Pines Street 33
+2022-03-21T13:59:43 2040107942 84217493695601697.997 false 109 -12972 -2179 -1491242267 16577.234 1.47922140614803E9 26567233446731867.734 2022-06-09 2023-01-10T15:55:09 2022-01-18 182.67.131.46 tempora_et@Tambee.edu Anzinger Parkway 25
+2022-10-24T15:39:22 -1459594378 52262794985491101.647 true -42 -22407 -22094 228960686 -9769.24 2.077062938838231E9 73030258438373197.120 2022-01-23 2023-01-10T15:53:24 2022-05-29 148.98.178.220 RuthWells@Flashpoint.info Warrior Pass 48
+2022-01-25T09:01:27 2035473225 66698749489987074.299 false 77 -5329 21752 1675425771 18688.0 -8.5648146144319E7 31526757185434628.845 2022-09-11 2023-01-10T15:53:05 2022-03-11 176.150.160.60 MarthaWallace@Dynabox.info Scofield Drive 5
+2022-09-18T07:22:57 -39577789 56077931809553335.543 false 78 18504 -31816 1181353725 8534.284 5.58103010379219E8 21874588065205497.669 2022-11-25 2023-01-10T15:52:22 2022-07-18 31.216.16.216 PaulKim@Meevee.gov Stoughton Street 58
+2022-12-10T00:07:24 113755357 64870506613049853.237 true 4 19833 9929 -2077553236 23880.182 1.110814616578153E9 78470595268731167.411 2022-08-18 2023-01-10T15:52:14 2022-11-17 175.195.211.143 MargaretFields@Dynava.edu Oak Valley Pass 70
+2022-02-21T22:57:51 -1637714937 81780395964777394.730 true -68 7890 4125 981797519 2002.7689 1.587789066765131E9 52717473500355786.612 2022-10-05 2023-01-10T15:52:03 2022-05-24 82.173.6.5 LouisNelson@Eare.info Pleasure Place 39
+2022-09-19T01:45:36 -1815567027 90437876600192763.460 true -67 450 -24660 1026693250 -13756.589 6.71783949837051E8 39013162201507383.364 2022-08-20 2023-01-10T15:51:56 2022-08-17 45.45.139.39 DorothyReid@Realblab.edu Shelley Court 61
+2022-12-16T01:48:46 -1620708820 79977863841506873.394 true 125 -23288 -31304 183634480 8690.287 1.089143087804835E9 88816216187143767.419 2022-03-05 2023-01-10T15:51:13 2022-02-27 113.65.179.131 RobinAustin@Photofeed.org Dorton Avenue 24
+2022-07-08T01:02:22 1861328091 30077669685454416.324 false 99 21673 -26343 -1739516645 8052.1733 -1.891426776824317E9 89945213768006513.891 2022-05-31 2023-01-10T15:50:27 2022-01-12 15.113.29.94 bJones@Oyope.com Jenifer Street 55
+2022-03-16T14:57:47 1144803378 80982813638697367.150 false -91 -27233 -18313 1663615911 -25966.441 7.22324706023479E8 18684410454219087.191 2022-02-24 2023-01-10T15:50:11 2022-08-26 196.194.98.204 tGreen@Twitterlist.net Dixon Junction 53
+2022-10-13T12:02:35 -1347487763 57812014428142349.468 false -120 24273 7900 164864749 -17766.543 -3.03169332525345E8 32350663418360499.179 2022-01-24 2023-01-10T15:50:11 2022-01-26 2.176.226.184 bHenderson@Zoozzy.net Transport Pass 76
+2022-02-13T03:55:11 1078801732 7733188757011073.353 true -7 13590 27006 -538765858 2454.2322 -1.033081914363393E9 50694939932448239.625 2022-04-01 2023-01-10T15:49:48 2022-10-21 236.201.98.40 quasi_corporis_quos@Gigashots.net Norway Maple Circle 26
+2022-11-22T03:28:58 -117977774 15359161559210533.516 true -111 9742 -32472 1092699613 -5584.0483 -2.109555631793559E9 74430333927005549.370 2022-07-18 2023-01-10T15:49:35 2022-05-02 129.113.4.194 FrankVasquez@Omba.com Dakota Pass 77
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_asc.out
new file mode 100644
index 0000000000..4eb99b45a1
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q13_datev2_asc --
+2022-07-12T11:41:01 -2146975814 41357500306060590.461 false 64 -17725 -30892 -785473015 5554.3315 -7.07670608707416E8 39550144162788220.422 2022-12-06 2022-08-10T22:15:25 2022-01-10 189.114.136.127 rerum@Gabtype.edu Shoshone Court 22
+2022-04-01T19:59:42 -2142080488 47635055176314981.257 false -17 20839 -680 333629779 2168.549 2.97777270977873E8 39473089553015086.260 2022-03-31 2022-08-03T13:46:23 2022-01-10 35.44.130.64 BrendaGonzales@Yodo.biz Loeprich Pass 80
+2022-06-04T21:42:24 -2140044769 7783475951196088.445 false 73 -17759 20687 -2049461130 26184.016 -3.90752727197558E8 31606054951248587.468 2022-08-10 2022-09-26T11:54:10 2022-01-10 159.173.238.32 yRay@Dynazzy.gov Ludington Parkway 0
+2022-07-10T05:40 -2138529278 60338362814142329.874 false 84 26203 -11182 -317752860 -5591.201 -1.404030078790996E9 20957356361655916.898 2022-09-30 2022-09-14T09:27:58 2022-01-10 109.87.105.1 odit_sint@Eadel.biz Ilene Plaza 68
+2022-01-16T07:18:33 -2135250531 9734301943706675.434 true -2 -4906 16201 -1473092149 13383.368 1.197528990381749E9 17062190276150723.367 2022-07-15 2022-03-28T02:55:12 2022-01-10 168.238.16.209 BonnieFranklin@Kanoodle.biz Graedel Drive 74
+2022-08-31T02:36:07 -2117185324 59743261011801800.413 false 33 17176 11096 53279997 29987.072 -2.58796461657595E8 75922041112654579.450 2022-02-21 2022-08-22T11:52:22 2022-01-10 66.171.17.35 voluptatem_quas_rerum@Kwideo.gov Debra Trail 15
+2022-10-12T16:35:38 -2111769499 45558916266306430.790 true 32 6235 10922 1175989093 -2964.8184 4.36215514885263E8 59308934930266657.983 2022-02-04 2022-07-31T21:42:10 2022-01-10 141.88.150.220 accusamus@Riffpedia.edu Debra Circle 31
+2022-09-09T17:09:01 -2103366732 37340056829809766.385 true -23 3249 25341 941263660 24186.512 -2.19436971727631E8 59068318153705580.563 2022-04-18 2023-01-02T14:14:22 2022-01-10 4.98.166.245 dolore_placeat_facilis@Kamba.info Anhalt Center 29
+2022-02-28T12:32:04 -2102850466 23727314888942662.978 true -108 -24289 -31921 -2097160101 22546.42 -1.897250159100898E9 35667126626131126.265 2022-08-04 2022-06-10T05:38:26 2022-01-10 214.251.78.45 MatthewHernandez@Gabvine.net Manley Road 46
+2022-06-02T00:31:51 -2087994185 89415047244778430.524 false -108 -13241 14965 -1616908029 -14109.911 -1.779065986959512E9 65136696039133182.221 2022-03-16 2022-05-21T23:55:35 2022-01-10 233.112.66.155 qui_et@Blogtags.net Northfield Crossing 26
+2022-11-18T07:06:44 -2086738248 75063615109283038.383 true -108 -21250 -20787 -604922324 15193.834 -1.582563961727976E9 38754951253821634.880 2023-01-01 2022-01-21T06:04:38 2022-01-10 151.171.203.34 bLong@Photobug.name Fair Oaks Place 0
+2022-05-03T01:54:18 -2084730743 55868258475185633.998 false 100 30892 11474 -1003384827 -16795.324 -2.66482900229458E8 38274861901008636.699 2022-09-02 2022-09-26T09:26:39 2022-01-10 87.215.82.226 RoyGreen@Twinte.mil Mallory Point 53
+2022-05-10T06:20:37 -2082829453 67978527071141443.272 true 22 -9868 -2879 765306321 13285.469 -6.48002527053794E8 32026976534152264.605 2022-02-12 2022-06-18T11:55:43 2022-01-10 153.116.25.151 fMiller@Wordpedia.biz Sachtjen Crossing 75
+2022-05-20T10:32:49 -2081347927 53313499951075075.438 false -89 21440 6030 1628630844 13481.725 1.718778818150949E9 53774595472737928.667 2022-09-29 2022-11-08T22:25:18 2022-01-10 29.245.30.231 jCunningham@Photojam.info Moulton Hill 98
+2022-05-01T01:32:24 -2076648723 6277927567128061.983 false 112 -29763 15730 -1235400235 -21089.047 -8.46344570919055E8 63347069568442763.160 2022-06-11 2022-03-20T18:01:32 2022-01-10 36.238.7.14 oRuiz@Jetpulse.com 6th Junction 51
+2022-06-10T05:24:56 -2070474524 62397553545384420.801 true 0 -18264 -23436 410485674 26833.127 -1.006575273291974E9 73586344131503717.119 2022-10-31 2022-06-02T14:12:06 2022-01-10 204.0.155.201 HaroldWatkins@Midel.info Fallview Plaza 25
+2022-10-19T08:28:58 -2063031871 76391457194248119.941 true 88 14442 -11164 -606747075 23782.432 -3.24091037086612E8 73301955948794481.479 2022-12-27 2022-08-19T17:38:23 2022-01-10 163.138.253.190 expedita_est@Lajo.org Katie Circle 65
+2022-02-20T22:02:18 -2062115605 15624283051576902.259 true 110 -793 -9570 -1779247391 -21120.338 1.691382449493783E9 70887384831826844.935 2022-01-15 2022-01-18T11:33:21 2022-01-10 2.233.188.36 rFord@Bubblemix.name School Road 87
+2022-10-11T06:43:36 -2059031173 91679904453987552.609 true 33 32398 15066 -1151066447 30360.873 -1.943948412332053E9 1060645175254625.275 2022-07-21 2022-03-31T08:11:10 2022-01-10 53.88.162.88 quo_at@Fivechat.com Johnson Park 81
+2022-05-13T02:41:37 -2056692155 75905320909210630.976 true -100 -6983 -21686 572017053 24283.582 -7.4428889320198E7 17363153585947227.962 2022-02-07 2022-10-16T00:13:27 2022-01-10 236.40.210.234 1Alvarez@Eadel.gov Sunfield Alley 55
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_desc.out
new file mode 100644
index 0000000000..7acdff7475
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q13_datev2_desc --
+2022-10-04T17:30:46 2143384637 92202795681145703.263 true -120 16077 4556 -405206580 5421.973 2.86547678151814E8 4602250727469436.685 2022-09-25 2022-04-28T10:55:02 2023-01-10 122.119.146.42 JuliaBaker@Bubblemix.name Dakota Pass 89
+2022-10-28T13:49:28 2142286124 7359872474738353.652 true 48 30597 32694 -1821570699 -5880.8228 -7.42137004235877E8 84071566806744952.316 2022-10-19 2023-01-01T23:13:06 2023-01-10 189.149.118.170 yWright@Edgepulse.com Carberry Court 48
+2023-01-03T00:04:15 2141665842 45088640814925845.600 true 8 -7817 -20159 -971735894 -20806.344 1.96902070987103E9 12752024591701115.548 2022-03-26 2022-12-09T03:56:29 2023-01-10 169.220.157.133 dOwens@Quire.com Bunker Hill Pass 19
+2022-06-14T10:36:55 2137993045 80947953368783118.235 false 75 19546 -7851 2055362901 19778.533 -7.02527423306826E8 1963404328664105.324 2022-10-30 2022-09-29T17:29:10 2023-01-10 108.20.56.201 suscipit_laboriosam_tempora@Thoughtstorm.gov Heath Court 14
+2022-04-28T02:56:24 2137140915 68568089336716561.481 false 19 -21407 -21269 -488834060 354.32346 1.659679012918404E9 17802003643825419.550 2022-06-08 2022-11-30T10:35:47 2023-01-10 36.192.27.252 inventore@Feedmix.com Towne Drive 54
+2022-05-25T19:29:35 2134670263 60901110455289230.329 true 87 7511 1623 1805984845 -22132.87 8.85485624873741E8 24506148630615884.248 2022-09-23 2022-06-25T08:34:02 2023-01-10 88.231.54.12 kReyes@Bubbletube.edu Pine View Trail 46
+2022-04-21T18:35:22 2134104264 34789385857509481.512 false -67 2573 16693 1005656644 22698.537 1.159611102532654E9 45158419238749204.911 2022-11-23 2022-12-29T21:07:46 2023-01-10 244.40.39.75 tBlack@Voonix.info Killdeer Lane 93
+2022-07-28T12:01:51 2133391808 75791318869626496.620 false 92 3163 -27594 -418861716 -6281.406 -7.11646101939523E8 77537132793987835.920 2022-04-08 2022-06-12T03:53:25 2023-01-10 62.120.54.15 MartinWhite@Twinte.com Nova Court 7
+2022-08-25T08:21:04 2127263930 28357699424870651.798 true -73 20106 24978 -1548870190 18499.852 1.020422023788034E9 87364955034963175.426 2022-06-01 2022-04-01T23:10:01 2023-01-10 218.96.227.9 sMendoza@Rhyzio.net Vidon Lane 70
+2022-08-04T22:02:12 2125253359 71901728808080343.385 true 47 -24924 14315 1584792761 613.7653 4.55688160011837E8 6591133412069812.190 2022-06-14 2022-05-05T21:03:48 2023-01-10 76.178.94.123 doloremque@Eabox.name Spenser Trail 70
+2022-11-08T06:45:31 2120885163 29857375301798851.444 true -113 -30907 -31300 -43503665 27946.63 -8.90713782977671E8 79480225718806594.791 2022-12-02 2022-12-16T15:44:04 2023-01-10 185.36.183.21 et@Mydeo.name Thompson Crossing 56
+2022-02-23T01:16:51 2119921657 63998521727981116.606 false -84 -17839 9838 -593999332 -15966.607 -2.063820459840978E9 75366678047526224.766 2022-10-17 2022-12-04T11:38:19 2023-01-10 191.255.22.49 JoeBaker@Youspan.mil Lake View Alley 57
+2022-11-10T05:41:45 2119040621 11899526568093727.358 false -20 11583 -2671 624208898 -5228.81 -2.78302970328152E8 17941386887897056.118 2022-11-18 2022-01-21T23:03:22 2023-01-10 100.11.32.199 velit_commodi_accusamus@Voomm.gov Iowa Plaza 44
+2022-12-08T21:07:26 2118241217 6301898336111519.330 true 86 -21286 11190 -472027739 31261.693 9.71565646697208E8 78027879960732674.917 2022-04-24 2022-10-11T14:09:56 2023-01-10 254.19.51.141 nobis@Quimm.org Prairieview Parkway 88
+2022-08-04T07:34:19 2117900648 52619835326601404.303 true -80 6293 -3660 -1563536431 -28754.547 -1.613773825190437E9 45450228907052547.544 2022-06-14 2022-04-24T18:27:20 2023-01-10 18.71.71.254 perspiciatis_itaque_minus@Fliptune.biz Farragut Terrace 25
+2022-09-11T23:56:26 2117248310 49165450310001614.880 false -82 -14164 15408 -686141402 17675.533 9.37875378624397E8 15765069107479361.861 2022-07-30 2022-02-09T02:25:16 2023-01-10 128.58.245.73 JohnMcdonald@BlogXS.mil Graedel Court 37
+2022-04-25T08:55:49 2115025714 52813901778078833.847 true -62 28035 -15952 2080110570 4264.9404 -8.20843484546934E8 74212342808885749.980 2022-04-07 2022-09-12T02:52:57 2023-01-10 196.155.151.65 kPayne@Avamba.mil Express Road 11
+2022-03-09T04:08:22 2114964742 70882243835620622.859 true -5 7314 -12565 -1935959664 24499.186 1.573856871514853E9 90048089418607254.991 2022-09-06 2022-08-06T15:43:49 2023-01-10 29.15.71.237 MildredRoss@Talane.edu Lakewood Gardens Drive 52
+2022-02-26T12:36:52 2114887007 84842748115180769.262 false 70 -28673 8252 -1427439640 6455.6455 1.69941556957551E9 23351052108667185.335 2022-08-15 2022-12-27T12:33:06 2023-01-10 28.155.71.249 eRyan@Geba.edu Clemons Hill 97
+2022-08-29T11:12:33 2112187773 52081198872407354.000 true -14 12024 17566 -590989675 -9049.307 7.4022969373203E8 14818930632155820.939 2022-07-23 2022-11-07T23:36:15 2023-01-10 239.219.190.193 iMorgan@Mybuzz.mil Butternut Junction 72
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_asc.out
new file mode 100644
index 0000000000..8ec01d341a
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q14_datetimev2_asc --
+2022-01-10T15:58:40 -387631717 50491596287709053.348 false 79 4132 -25325 1087461642 -628.5988 1.952250555808231E9 22831880007732095.345 2022-12-12 2022-11-24T11:12:14 2022-10-28 61.225.183.165 MargaretEdwards@Tekfly.name New Castle Circle 29
+2022-01-10T16:01:50 1875364866 98578317795671280.305 true -101 16317 -22682 493160211 6647.924 -4.118583450822E7 11785036705001142.200 2022-03-09 2022-08-17T01:28:36 2023-01-09 233.142.114.64 8Black@Twimbo.org Johnson Street 67
+2022-01-10T16:02:21 576563617 14170936804202410.552 true -83 -11275 -20051 -1104825272 -24694.344 2.45343925042296E8 83652505897808471.460 2022-04-20 2022-03-14T07:52:01 2022-07-03 127.62.73.237 JasonLittle@Skinder.mil Oak Valley Center 47
+2022-01-10T16:03:23 -1816395909 85944124623622546.668 true 69 6238 -19462 105883429 29650.547 1.240988083367038E9 88963236536078959.366 2022-06-11 2022-11-10T22:08:45 2022-07-25 91.168.156.5 RebeccaFields@Thoughtblab.edu Texas Terrace 64
+2022-01-10T16:04:31 -1064005566 80284431255136857.710 false 102 3479 -13921 644536622 5325.0425 1.596685981136262E9 10610183127825981.612 2022-04-25 2022-12-08T23:01:55 2022-08-11 149.216.36.0 ChristinaRodriguez@Youspan.biz Randy Circle 17
+2022-01-10T16:04:41 742992063 87315224836228918.795 false 71 19225 -32131 1626906818 32651.121 -1.632682384887526E9 60375695436836332.771 2022-11-05 2022-11-10T11:14:54 2022-06-11 97.5.232.212 sRivera@Zoomcast.mil Golf View Crossing 62
+2022-01-10T16:04:49 -744222108 64562066838726736.278 false 85 25637 -21148 -593493650 -11450.651 -1.167904321387118E9 32585085266732240.402 2022-09-10 2022-08-08T18:00:04 2022-11-03 54.143.193.60 vitae@Oyoloo.mil Ruskin Court 16
+2022-01-10T16:05:38 -1256679026 94632541519623071.590 false 7 -21444 -16013 -1439667661 2700.9944 -1.444617894945704E9 44853498876094960.297 2023-01-02 2022-08-27T03:37:26 2022-08-04 11.8.86.176 eFields@Gigabox.org Village Court 44
+2022-01-10T16:05:45 -733803005 42526411727465526.361 true -46 18193 15477 1838898287 15033.911 -7.68768505032434E8 88488171622590599.810 2022-12-21 2022-04-14T09:10:01 2022-11-01 238.124.55.15 yWard@Yakidoo.name Northport Pass 5
+2022-01-10T16:06:02 1769095688 95858385508825939.586 false -61 -24768 8981 -1811059535 26550.553 1.898948089429888E9 6302075696085095.930 2022-04-12 2022-05-06T18:56:26 2022-01-18 70.75.107.213 JacquelineRamirez@Edgetag.edu Schlimgen Way 58
+2022-01-10T16:06:40 -1623839913 49311124665541595.480 false 30 17239 5439 -1922469617 -23665.729 -1.88884989441398E8 45755156309522466.870 2022-04-03 2022-09-08T10:57:29 2022-05-25 249.98.251.14 KathleenWilliams@Fanoodle.mil Gerald Plaza 4
+2022-01-10T16:09:50 -1431870339 44264881470360983.805 false -40 -24105 -7389 -1002197417 20793.098 -1.295938018197165E9 10862309589738237.466 2022-08-18 2022-03-04T10:00:09 2022-04-17 71.24.67.176 9Meyer@Voomm.name Eliot Street 7
+2022-01-10T16:09:54 -626724778 97458644512885827.102 true -60 -8632 6288 -1920488824 -8787.745 -1.72476970658196E8 57901851298744604.934 2022-02-23 2022-06-25T08:32:30 2022-02-08 98.159.195.141 nPalmer@Blogspan.info Kennedy Avenue 90
+2022-01-10T16:10:07 -1473750556 2790815456820904.170 false 34 -24709 -16704 -351836436 9071.129 -1.830655735609612E9 38386913868571378.894 2022-03-13 2022-03-17T14:09:04 2022-02-17 83.206.190.20 EdwardRogers@Skinix.mil Bobwhite Road 69
+2022-01-10T16:10:59 -1123086736 51492832283400442.873 true -69 7857 29140 -1898153416 -10556.305 -1.77309875898539E9 60377727563550063.665 2022-09-19 2022-11-19T14:48:07 2022-08-07 207.113.20.129 nam@Gigaclub.info Crescent Oaks Crossing 79
+2022-01-10T16:11:51 -788430590 27555656427882512.659 true 34 10628 -16106 1894961333 4313.937 -5.1092627768235E7 71134698800701686.263 2022-02-22 2022-05-11T23:40:21 2022-04-11 179.160.110.61 quidem_dolores@Jetpulse.net Mesta Way 40
+2022-01-10T16:11:53 -515031918 81258071637598243.191 true -46 909 -17835 -560944317 24897.818 -9.6981475802878E8 68736411734897767.367 2022-06-04 2022-08-11T20:17:35 2022-06-03 145.225.78.240 2Ryan@Topiczoom.name Dawn Center 29
+2022-01-10T16:11:53 1906472648 30323570439371776.353 true -64 23204 -27723 1753599187 -28017.578 -8.7412093534361E7 34175877199258167.909 2023-01-07 2022-07-02T15:40:57 2022-10-09 60.230.5.23 asperiores_aut@Chatterpoint.name Summit Plaza 70
+2022-01-10T16:13:35 -1323249438 40281101252049750.461 false 69 -14005 -17375 488331620 6671.3335 4.03622966295354E8 69297743384305331.670 2022-12-24 2022-06-09T15:30:28 2022-02-19 127.36.89.221 sed_cumque_omnis@Ainyx.org Aberg Street 53
+2022-01-10T16:13:38 1028405269 61289821142114474.254 true 68 -31254 -2346 1789547553 22300.36 1.097286253842532E9 84787711042937558.513 2022-03-02 2022-03-21T19:39:21 2022-12-02 168.182.92.190 NormaRussell@InnoZ.edu Lawn Hill 18
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_desc.out
new file mode 100644
index 0000000000..ec7e6e57fc
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q14_datetimev2_desc --
+2023-01-10T15:54:54 530527963 27225608586195589.798 false -97 -2229 -9276 -658660963 -6392.991 1.070207632356559E9 51697377775165538.424 2022-06-06 2022-07-04T13:35:39 2023-01-08 34.201.94.216 RogerFerguson@Brainbox.net Calypso Street 87
+2023-01-10T15:54:33 -2064827646 91851991844064745.311 true -84 -4657 14877 715518221 26711.805 1.606809192182132E9 42538622852040097.670 2022-02-16 2022-01-30T01:00:10 2022-06-27 146.164.88.114 2Watkins@Photofeed.mil Hermina Plaza 42
+2023-01-10T15:54:23 2078632063 72019727709057736.800 false 27 22579 30242 -1616359267 1131.4033 -1.620026728921817E9 83034082469706378.876 2022-02-17 2022-07-29T02:43:05 2022-03-13 54.247.61.224 oButler@Oyope.mil Waywood Alley 96
+2023-01-10T15:53:53 1995718879 80009003816572842.344 false -126 12424 10489 -464770757 21452.365 -1.298753384191263E9 63761511886741335.861 2022-10-26 2022-05-09T15:24:24 2022-08-29 10.139.173.164 KathrynBurns@Lazz.biz Green Ridge Place 34
+2023-01-10T15:53:50 192433708 23048228277112759.704 false 88 11777 3887 1603276431 -13262.567 -1.915556868466225E9 34014441659017924.203 2022-07-19 2022-07-03T16:15:42 2022-09-01 179.71.154.133 oRyan@Buzzdog.name Laurel Center 85
+2023-01-10T15:53:42 -1932505194 63623448263670416.340 false 63 2032 -11874 -1399777322 16880.77 -1.519859996691444E9 56970527355985709.162 2022-06-14 2022-01-13T22:59:40 2022-07-25 38.233.171.77 zFrazier@Fadeo.com Fair Oaks Trail 76
+2023-01-10T15:53:21 -230367489 21196940057983146.102 false 25 29019 3243 -941111571 7400.8613 -1.851388483983088E9 226348102723553.824 2022-01-30 2022-11-05T19:15:47 2022-06-17 78.99.152.130 TimothyRodriguez@Skiba.gov Quincy Street 10
+2023-01-10T15:53:20 1586087269 33316929850521405.551 false 39 3457 31331 2099786888 9167.861 7.40817506739393E8 76135761346738557.500 2022-06-05 2022-10-27T15:56:34 2022-11-28 242.215.184.220 et_non@Skinte.com Boyd Way 92
+2023-01-10T15:53:13 -1745676531 21098746824407609.260 true -96 -3790 -18552 498576598 -21261.895 2.02833954475258E9 74412367636815540.338 2022-10-27 2022-04-27T10:34:32 2022-04-28 157.66.0.200 rFranklin@Skiptube.com Claremont Place 66
+2023-01-10T15:53:07 -2018705059 76350796289203640.329 true 98 23822 10317 1916911140 13203.572 9.2911973892668E7 12249279130142689.133 2022-07-14 2022-01-13T00:35:34 2023-01-08 202.202.55.60 ChrisWest@Janyx.net Spohn Court 64
+2023-01-10T15:53:05 -747816388 47572043970529301.102 true -70 -28179 13001 -721287450 -1172.9457 -1.3783788712626E7 27935674067996655.648 2022-04-14 2022-05-08T09:13:38 2022-05-17 41.98.48.113 dolorem_consequatur@Twimm.com Namekagon Drive 66
+2023-01-10T15:53:02 1608057881 85671925794548632.210 true -68 -15487 -12409 1598998546 14191.23 3.82595692387622E8 19897840121651746.140 2022-02-11 2022-01-23T10:11:49 2022-09-26 8.217.66.147 repudiandae@Oozz.info Bowman Lane 64
+2023-01-10T15:52:06 -1064508762 28439978402783179.370 false -111 -14000 23312 261566359 -5224.155 2.083079549441855E9 43245476996773941.738 2022-12-18 2022-06-07T15:47:03 2022-02-15 102.62.212.218 5Taylor@Eazzy.org Talisman Avenue 33
+2023-01-10T15:52:01 -641966300 75184464997965549.611 true -38 22410 -7360 -453267994 2730.9773 -1.493077666188507E9 31054867297987176.544 2022-02-01 2022-12-19T05:07:44 2022-10-28 21.153.120.86 nFranklin@Wikido.org Clemons Drive 16
+2023-01-10T15:51:30 -806554627 41776560302308166.469 true 9 -29912 6653 -1508039995 29528.578 4.97728171025548E8 73019312741185243.275 2022-12-21 2022-07-17T05:36:46 2022-08-26 84.148.159.64 id_fugiat@Leenti.mil Oneill Plaza 6
+2023-01-10T15:50:49 -1235902706 62702866242320144.501 true -79 -17549 -20797 1287125300 18818.393 -2.089314157103185E9 63536403364005197.721 2022-03-22 2022-05-19T04:04:46 2022-11-10 46.211.238.210 MarkGardner@Voolith.info Schmedeman Circle 63
+2023-01-10T15:50:10 1049919668 56484137302104819.546 false 21 -25562 -15584 -1531844516 1401.4991 8.60001496950306E8 46863118513399593.572 2022-08-26 2022-07-31T15:24:34 2022-07-13 198.143.122.50 mHernandez@Vidoo.name American Ash Lane 11
+2023-01-10T15:49:43 332882194 51484756427294065.321 false -71 7766 -14400 555986434 15951.512 -8.33659684687661E8 36795573298172542.285 2022-01-17 2022-08-07T18:57 2022-06-20 249.56.248.134 LoriPeterson@Oyonder.info Shopko Point 92
+2023-01-10T15:49:36 867743322 48034921398559420.240 true -98 27378 22309 442023125 28779.576 -1.12667442379089E9 98762307453210732.937 2022-05-02 2022-12-27T09:22:58 2022-12-23 253.53.23.10 yGonzales@Avamba.org Bellgrove Park 16
+2023-01-10T15:49:10 -1945221726 56823652649349950.258 true -88 -9812 -8994 -1463310929 -23013.854 3.46004724369729E8 51179538056668726.666 2022-04-10 2022-09-07T08:44:20 2022-12-20 194.237.171.255 TimothyKing@Jamia.info American Hill 32
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_asc.out
new file mode 100644
index 0000000000..35f29c9fc5
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q15_char_asc --
+2022-09-11T06:50:01 2061922250 1754132376561068.511 false -40 27258 -5928 1496737886 5772.6973 6.06076201086729E8 60015904398688265.304 2022-09-07 2022-11-23T12:57:47 2022-07-25 0.0.112.236 nHowell@Devpulse.info Jackson Avenue 67
+2022-08-07T19:06:07 -110183145 69972174390695974.576 true 100 -20151 -19882 -619054806 23015.803 -1.437034101778622E9 15432008675859507.489 2022-04-13 2022-09-30T18:38:26 2022-02-04 0.0.141.235 vero@Oyonder.gov Hazelcrest Way 45
+2022-02-05T11:27:35 -1736389557 31046413624968009.531 true -109 28986 14238 1987535150 -15644.225 1.451063217218461E9 49113860871835022.616 2022-08-12 2022-02-09T00:57 2022-01-15 0.0.147.179 exercitationem@Livetube.biz Ramsey Park 44
+2022-01-23T09:12:02 -373426246 42362793424784481.903 false 104 27194 -14878 740957837 5517.1963 2.39950583453862E8 52088711656772050.492 2022-03-03 2022-06-17T05:23:11 2022-06-10 0.0.158.180 JoshuaThompson@Pixope.info Chinook Terrace 80
+2022-10-12T06:39:01 1485033220 64471960948135748.330 true 8 15768 22426 -918020430 16532.443 -1.48369281225366E9 45550443706866425.980 2022-08-28 2022-05-16T20:10:46 2022-01-20 0.0.173.63 culpa_ut_omnis@Cogibox.mil Miller Drive 86
+2022-03-30T14:54:03 -839244895 99436850501846431.477 true 126 -17986 -28788 564690702 13945.036 -2.008353962471632E9 2868487869278653.559 2022-09-30 2022-09-15T16:17:33 2022-06-27 0.0.189.137 qBaker@Dynazzy.com Laurel Point 47
+2022-11-24T10:09:46 1621060662 55258277581265783.545 false 9 -1840 15145 -380506944 581.4438 -1.391258038688637E9 28635299784354798.894 2022-10-03 2022-10-22T15:41:50 2022-10-17 0.0.199.186 MarilynRogers@Gabtype.gov Crownhardt Hill 28
+2022-05-06T15:53:29 748383400 63420406170608204.417 true -36 -31267 7431 -1782698096 4226.3384 -1.083150366886749E9 8129207772663429.404 2022-11-10 2022-07-09T21:16:10 2022-02-01 0.0.20.37 fSullivan@Eire.edu Mcguire Road 99
+2022-04-22T09:12:14 1208486587 48994995597883814.209 true 2 -16828 28703 -74819671 -2158.284 -1.148517068916708E9 82590226618452760.477 2022-05-19 2022-05-10T20:24:46 2022-11-02 0.0.23.196 fuga_officiis_aliquid@Chatterbridge.name Trailsway Hill 92
+2022-01-20T01:49:14 -403720874 53433470277239324.415 false -8 -23044 -18910 -1472669446 28636.297 -5.00744090095746E8 22062650149414224.482 2022-01-26 2022-05-01T06:17:56 2022-07-26 0.0.241.109 MartinMitchell@Feedfish.edu Anzinger Crossing 18
+2022-12-07T15:28:04 -1690732746 27384295151729802.390 false 54 -8332 -8218 821665409 -10875.8 -3.03226791069825E8 20040395786878026.390 2022-01-14 2022-01-25T07:09:29 2022-09-18 0.0.6.219 non_nesciunt@Quamba.biz Dahle Point 18
+2022-11-29T01:10:19 -352131903 73581216486041728.733 true 50 13436 -5439 -860164339 29512.43 -5.5725064488281E7 95721473550833224.949 2022-04-02 2022-11-29T03:46:59 2022-10-31 0.0.64.30 sint@Buzzdog.mil Linden Junction 35
+2022-03-17T18:15:01 -1109053205 68713946547667189.783 false 18 4932 -31418 -2070957788 16692.02 1.39271842729734E9 70802595134660500.380 2022-04-12 2022-10-25T17:08:51 2022-06-29 0.0.68.92 qui_a_quos@Minyx.edu Oakridge Drive 93
+2022-03-21T21:29:42 367400850 56011302765065072.792 false 90 20941 2364 1369142817 -2850.9583 -1.073191087237996E9 64557232837889758.458 2022-07-01 2022-11-02T18:30:10 2022-11-10 0.0.93.170 9Mcdonald@Ntag.name Sundown Circle 80
+2022-11-20T18:10:51 698774384 55214482096451540.655 false 66 -11060 30241 -706655319 9563.255 1.711512546331549E9 86123581066112873.177 2022-02-18 2022-06-27T18:41:58 2022-06-07 0.1.106.158 FrancesHunter@Zoomzone.net Porter Junction 97
+2022-06-27T20:18:30 2042492551 58723281040536682.941 false 104 7699 16377 -1612800915 8224.908 -1.223988811139082E9 66259336731313525.998 2022-06-06 2022-09-12T02:10:29 2022-09-06 0.1.175.230 aut@Tazz.gov Independence Terrace 34
+2022-11-08T00:13:56 -1134542266 30015106421241075.831 false -27 -259 -4519 -313282257 16304.245 1.2280493397297E8 78408058298171417.803 2022-05-11 2022-11-30T09:44:48 2022-11-16 0.1.195.216 ShawnBennett@Jazzy.edu Myrtle Crossing 7
+2022-10-14T08:30:35 -504423350 72068073088516397.143 true 4 26889 27282 1595585863 28450.484 -1.660718820204285E9 39686973033625060.755 2022-10-25 2022-08-10T06:15:23 2022-12-06 0.1.220.203 HeatherBishop@Quinu.net Fallview Lane 0
+2022-06-27T13:14:40 -1327770544 17199335182798345.180 false -113 19955 28233 -355908019 16261.51 5.28572899087892E8 64030119903544942.626 2022-11-17 2022-11-10T12:47:05 2022-01-26 0.1.244.27 nihil@Skynoodle.name Florence Avenue 31
+2022-11-09T12:34:17 406939467 12193470696400113.320 false -83 -335 18246 1700773704 27185.422 -1.383589711089231E9 54710816599500355.989 2022-11-20 2022-08-10T16:22:33 2022-02-06 0.1.34.119 saepe_fugit@Gabtune.org Burning Wood Way 14
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_desc.out
new file mode 100644
index 0000000000..eb06d6e93c
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q15_char_desc --
+2022-10-08T08:41:41 315413695 87402351967250684.928 true -11 9047 -16042 1297934047 -21483.018 -2.26702700070283E8 16104896194012429.274 2022-03-15 2022-04-22T07:07:30 2022-04-04 99.99.73.10 sBrown@Cogilith.com Butterfield Park 41
+2022-07-16T03:02:43 836879246 56801583459856893.830 true -23 -14592 -26122 496203717 1772.0596 1.185438524640771E9 20080170946700327.840 2022-10-01 2022-10-25T03:09:47 2022-09-01 99.99.65.2 tempora@Tagpad.gov Sutherland Street 77
+2022-12-06T02:30 1825355576 63227915060384469.762 false -49 -11509 31496 1348925826 -29811.771 1.555339546364234E9 36073525734273916.881 2022-07-21 2022-09-28T21:04:48 2022-04-15 99.99.52.107 6Woods@Jabbersphere.org Kim Way 98
+2022-09-13T02:26:26 154177324 22835870212258864.233 true 68 32655 26442 -560202813 3579.6008 1.255404269167506E9 38063662382836804.367 2022-11-29 2022-07-27T11:59:25 2022-01-12 99.99.42.106 et@Lazz.net Florence Alley 85
+2022-10-11T11:28:20 21936678 46478461969542333.380 false -117 8231 -21782 1139137663 10938.842 -1.057008120850436E9 21895162787971921.483 2022-03-14 2022-10-07T07:39:40 2022-05-25 99.99.32.22 vHarris@Realcube.net Eggendart Avenue 66
+2022-04-22T06:23:46 -1168970205 65417203213940735.724 false 79 12895 -28578 -831904083 -31004.512 1.432690821104434E9 97049703840275279.473 2022-03-09 2022-07-01T16:12:26 2022-10-18 99.99.251.179 PhilipWard@Oodoo.edu Kinsman Plaza 67
+2022-08-25T17:05:43 1161664534 16092016026315635.631 false -6 1466 -28789 2003513669 -7275.823 -1.352268570474401E9 63693907264007526.706 2022-08-13 2022-06-22T01:11:23 2022-01-31 99.99.25.187 hBell@Jabbercube.org Nancy Point 75
+2022-02-06T09:23:20 -1533516077 63146209740350464.773 true 73 -30843 -12729 -632464735 -24846.486 -1.557415605506909E9 60732582186708126.168 2022-09-20 2022-07-22T06:14:59 2022-08-07 99.99.232.59 wSpencer@Zazio.info Westport Lane 18
+2022-08-19T12:26:30 671564995 67846104265740508.611 false -40 -26244 -28252 624092585 -28578.262 6.76825147497824E8 61408724469676584.495 2022-02-04 2022-03-09T16:06:39 2022-06-29 99.99.185.180 xReed@Oozz.info Stang Terrace 0
+2022-11-26T17:10:27 487504607 29518437746859778.487 true -119 -29809 -26159 -105456031 1036.6146 -1.719819451468896E9 26867176777263708.699 2022-11-22 2022-11-07T18:36:22 2022-05-20 99.99.164.6 LisaOrtiz@Ozu.gov Waubesa Street 26
+2022-07-22T08:01:26 -462004515 66316712668660562.390 false -53 -32713 -16081 1430690796 -29099.066 -9.4342937285693E7 272598634884611.563 2022-05-05 2022-04-27T01:36:05 2022-11-07 99.99.153.30 veniam_est_fuga@DabZ.mil Mendota Center 41
+2022-08-23T03:13:09 1611917990 11686777916746799.747 true 0 -4621 2933 -1719636659 21074.697 2.21699064875878E8 53087198341020605.170 2022-11-19 2022-01-19T22:04:30 2022-11-26 99.99.131.135 temporibus_sint@Jabbersphere.org Loomis Lane 56
+2022-10-11T11:38:23 -2104470411 983928040161651.973 false 66 -23990 -8284 -967492502 -20395.6 1.75026400847612E9 86495489904533644.698 2022-03-17 2022-05-10T01:21:40 2022-06-24 99.99.110.39 ipsam@Snaptags.gov Dottie Drive 23
+2022-03-26T23:24:15 1933610720 15402010564132004.572 true 9 -5966 -29957 568244976 -17778.19 1.083495191384842E9 41175360255408185.797 2022-10-10 2022-06-21T17:10:40 2022-04-30 99.98.7.143 JohnPhillips@JumpXS.mil Northfield Street 40
+2022-03-03T23:08:50 -827053022 19774247748352723.496 false -38 -12917 14591 -1520961109 -8798.018 1.773274879550194E9 16894403904562058.880 2022-08-20 2022-09-15T19:15:57 2022-08-17 99.98.55.187 magni_distinctio@Latz.edu Sherman Point 80
+2022-03-27T04:34:26 1004878685 99389772778275988.194 false -65 9865 10316 -1634361062 17097.492 -5.06221481685881E8 85412879871181681.636 2022-12-04 2022-04-21T08:59 2022-02-05 99.98.35.34 fShaw@Dabtype.info Warrior Plaza 98
+2022-04-23T14:33:58 -257611424 14081308502706946.151 false -123 22434 7943 252761259 -28889.205 1.134490007284071E9 98097833124037540.937 2022-05-22 2022-01-22T11:57:33 2022-05-31 99.98.225.219 MatthewDixon@Quatz.biz Lillian Hill 6
+2022-12-17T17:28:26 -1539361515 66750608328000893.222 false 80 -17729 25445 -1419632228 -16896.219 -3.44039476377946E8 67871896371312643.741 2022-05-03 2022-05-07T23:46:47 2022-08-11 99.98.215.80 wWatson@Meevee.net Sheridan Parkway 58
+2023-01-08T18:22:36 -2031164725 60319854991159903.596 false 40 7355 31824 -570808911 -26422.096 -1.03572662369708E9 42766196239369804.410 2022-12-31 2022-08-11T19:20:57 2022-10-18 99.98.201.155 pMorris@Quimm.mil Fallview Terrace 18
+2022-09-03T22:11:39 -411129909 55812779586883865.724 true 104 15570 -26366 1539982848 13558.636 -1.417665566745042E9 12781487249997112.145 2022-05-09 2022-04-13T04:19:10 2022-12-21 99.98.160.119 necessitatibus_perferendis_mollitia@Miboo.edu Kedzie Crossing 94
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_asc.out
new file mode 100644
index 0000000000..3bbba3bc65
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q16_varchar_asc --
+2022-04-07T15:02:47 1797695104 84213740854143146.702 true -75 -104 -11439 2105972372 -15571.382 -3.13416812104635E8 66211621978377773.712 2022-02-10 2022-08-17T05:42:16 2022-02-17 99.37.174.165 0Adams@Avavee.gov Farragut Avenue 98
+2022-01-21T00:17:38 -958286252 57824727639993577.784 false -120 9252 15150 2121854656 21649.045 -1.483857694140935E9 65983807817182051.212 2022-06-04 2022-11-25T18:56:01 2022-12-06 104.173.194.209 0Adams@Babbleblab.org Heffernan Place 92
+2022-05-19T02:54:37 -1920641609 97451548289298816.795 false -97 5857 -17639 529426952 -4368.816 -8.34307056540495E8 46777988452739592.810 2022-06-25 2022-07-22T21:09:52 2022-12-20 233.87.159.216 0Adams@Blogtags.gov Nelson Court 83
+2022-08-23T02:25:56 -1468347723 70456065456224859.584 false -111 -28521 28470 -550203363 6653.323 -1.26180418760216E8 30956206602610132.137 2022-02-26 2022-05-01T18:51:48 2022-02-24 124.83.205.120 0Adams@Blogtags.net Weeping Birch Park 10
+2022-12-07T06:21:39 -720211049 49333586356906756.880 false -50 -30770 32057 186813977 21040.217 -6.58404593391288E8 60727264521358083.818 2022-11-20 2022-10-06T11:29:42 2022-03-16 179.60.104.122 0Adams@Centizu.biz La Follette Point 83
+2022-11-02T12:51:44 -947135330 2411433397927536.737 false -23 17847 26665 -43853619 -11561.912 -6.09321264357218E8 55701153208270371.240 2022-05-06 2022-05-13T07:24:18 2022-05-25 231.198.214.91 0Adams@Centizu.name Pleasure Point 91
+2022-01-12T18:16:02 -1459335612 6139998172032968.178 true 100 32113 -15771 -1588076150 -19139.355 -1.829078671770872E9 48521368446241192.527 2022-10-01 2022-11-22T13:39:29 2022-03-01 132.94.71.172 0Adams@Dabtype.mil Mockingbird Place 27
+2022-11-02T20:39:12 1254335929 97649938057988199.640 false 112 25192 -6487 1714503190 14583.035 4.95256485257821E8 19137653761507551.873 2022-10-15 2022-01-20T09:11:43 2023-01-02 145.224.235.215 0Adams@Demivee.biz Lakeland Street 84
+2022-10-01T06:05:06 1801908468 65701556117586573.477 false -11 -6066 26161 1928153315 -30342.908 -7.30091520636972E8 45312953546435208.950 2022-04-30 2022-09-21T11:49:18 2022-08-10 88.234.210.202 0Adams@Eayo.biz Sundown Terrace 96
+2022-07-05T20:54:31 -148076065 33301347986256707.665 true -30 17694 -16459 -261859686 748.5687 -1.768193158119264E9 13068923230186124.622 2022-11-14 2022-05-22T10:16:32 2022-03-20 105.250.160.250 0Adams@Eazzy.name Hudson Lane 63
+2022-05-14T11:59:17 -1770745436 8357011414103597.650 false -80 27808 15056 -449189586 -15391.033 1.463640500290254E9 13327585285006091.219 2022-10-11 2022-01-15T10:59:09 2022-07-17 173.31.173.101 0Adams@Eimbee.gov Cascade Way 78
+2022-06-14T16:23:28 326305693 204101120200419.182 true -67 30729 -22645 -743982796 -31949.08 1.97803703422932E8 62257931951431274.472 2022-02-26 2022-05-12T20:37:13 2022-11-24 121.78.49.147 0Adams@Fanoodle.biz Di Loreto Trail 83
+2022-07-31T16:06:44 1114355328 49111120280429020.687 false -3 -23037 15215 1903201717 -21974.174 2.103916341460758E9 50127971203500124.220 2022-06-24 2022-02-19T19:18:41 2022-09-06 246.147.88.176 0Adams@Feedfire.net Scott Plaza 47
+2022-04-13T10:15:19 186199696 54081990138712437.537 true -108 25437 18792 -1391744433 -20749.486 -1.125399054343154E9 23960515845960565.489 2022-02-26 2022-04-28T15:57:58 2022-12-14 50.44.53.188 0Adams@Feednation.mil Susan Pass 40
+2022-11-28T04:49:21 -915405460 57864712370072939.265 false -85 -13603 -13704 1738838557 3141.5361 -2.97652470613914E8 92253318844724875.743 2022-04-22 2022-10-12T10:28:20 2022-04-02 73.208.65.31 0Adams@Flashset.com Hovde Hill 25
+2022-10-15T08:00:06 -741106301 81560892839529258.188 true 67 22996 18256 -1184298400 18545.238 1.694037939410913E9 97006674633358758.300 2022-12-20 2022-04-09T20:40:15 2022-10-20 254.254.196.98 0Adams@Flipbug.com Katie Point 81
+2022-07-16T10:12:18 -1739034249 26339656191567982.300 true 63 -2896 -4146 -380406778 -18377.836 7.84313715126075E8 48482808327324600.685 2022-07-07 2022-02-17T07:44:31 2022-05-30 18.251.165.22 0Adams@Gevee.info Sherman Terrace 70
+2022-04-30T11:09:28 1034989059 738488906565712.547 false -19 5700 9871 -738030182 -19515.191 -1.083594064583577E9 17073301499600251.902 2022-09-19 2022-12-22T14:13:55 2022-05-12 58.21.141.10 0Adams@Jamia.org Gulseth Center 31
+2022-04-30T04:36:08 -1390930139 35460428483836996.940 false -71 18179 19935 804818547 9542.708 2.74460725522634E8 31567325872879436.445 2022-12-11 2022-09-02T08:37:43 2022-11-27 156.83.149.87 0Adams@Janyx.gov Holmberg Street 65
+2022-10-17T11:43:29 -673738377 91245669539822906.596 true 87 -833 7738 -1062114366 -12725.854 9.43055268902166E8 4892436008635635.900 2022-12-21 2022-02-17T03:42:39 2022-03-10 72.231.231.72 0Adams@Jetpulse.info Hudson Point 36
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_desc.out
new file mode 100644
index 0000000000..3496766a66
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q16_varchar_desc --
+2022-02-14T20:02:32 2019660998 55904519836354353.576 false 48 -206 -13596 -1766766472 -20109.396 -1.814550838401074E9 36738629026567407.620 2022-08-14 2022-05-17T08:00:22 2022-09-02 82.50.188.139 zYoung@Zoovu.org Southridge Street 61
+2022-07-23T06:53:43 1659265921 9139328414562640.904 true 105 12042 8442 480642288 18212.434 1.612014975253071E9 88102591439342972.100 2022-04-07 2022-03-28T16:41:14 2022-06-15 155.113.194.128 zYoung@Zoomzone.biz Grayhawk Pass 31
+2022-12-06T01:22:58 -1745784945 83540556062899645.243 false 124 -26762 7919 -1035341289 16691.45 -2.069415625024853E9 54041227921821380.948 2022-10-07 2022-10-12T02:15:34 2022-11-12 125.131.195.30 zYoung@Zoomlounge.mil Colorado Court 11
+2022-01-22T11:56:20 -479842162 95698629984115168.828 true -6 -16750 9289 -708802434 14229.186 8.5574561107844E7 93561682246078815.634 2022-06-11 2022-03-21T15:17:25 2022-03-29 172.75.247.140 zYoung@Zoombox.edu Kinsman Center 19
+2022-01-17T01:23:40 777654849 45278827571542119.859 true -5 -7679 -22953 16025651 -4613.541 -2.42846385460306E8 97483452045750237.306 2022-11-22 2022-04-17T18:27:44 2022-09-09 184.6.134.120 zYoung@Yambee.name Westerfield Crossing 46
+2022-08-06T10:18:27 -760779777 26868460766500939.216 false 95 13887 25602 -583887194 -3448.5054 2.138515855115856E9 37163265296852857.422 2022-10-02 2022-06-12T23:04:11 2022-06-12 85.206.42.73 zYoung@Wikibox.com Prentice Trail 13
+2022-02-13T16:35:41 1863815904 96543754932550314.714 true -25 -10937 25627 857866364 26096.742 1.90183660005557E8 31524755859798316.256 2022-06-21 2022-04-21T01:33:02 2022-07-02 88.99.133.147 zYoung@Vinder.org Canary Parkway 91
+2022-03-08T18:24:22 1254569160 80594090908020998.259 true -16 -13154 -28240 403222972 16686.61 -1.841377578067562E9 24510591458871527.248 2022-01-16 2022-10-17T19:46:19 2022-08-03 228.150.118.114 zYoung@Thoughtstorm.edu 4th Alley 74
+2022-05-19T14:15:50 -1197424578 45338212877606335.505 true -106 -18713 -14604 214175844 -3836.9036 3.9589229240208E7 16960757975659393.635 2022-11-14 2022-11-12T15:25:34 2022-07-11 217.139.233.131 zYoung@Thoughtbridge.mil Continental Drive 67
+2022-10-01T07:25:51 -1790889154 17703206212211138.234 true -40 31641 -25862 -1404707906 17343.885 1.737692320515817E9 53286004790989688.316 2022-07-27 2022-12-18T17:53:45 2022-09-29 94.170.177.234 zYoung@Skippad.net Charing Cross Center 52
+2022-01-24T17:25:20 -173107591 17487145059280950.480 true 60 22867 1052 -1409233094 -13404.633 -2.007737794671291E9 21642190053674066.564 2022-09-05 2022-10-14T12:56:17 2022-09-21 99.250.199.1 zYoung@Skipfire.edu Westridge Park 76
+2022-08-12T07:54:47 -2010582449 14360639605714550.978 true -56 14452 31524 -1047322258 4297.5596 8.145848157256E7 86993882380386051.986 2022-05-24 2022-11-02T08:52:45 2022-12-20 120.48.217.151 zYoung@Skinix.gov Jenifer Trail 28
+2023-01-03T23:15:04 725748224 88133313515558712.623 true -128 -31831 3182 1293378306 -14287.929 -1.985905340225478E9 71383661629105444.358 2022-11-29 2022-09-09T08:37:51 2022-01-20 18.164.94.137 zYoung@Skinder.gov Utah Hill 49
+2022-06-12T17:09:21 -905799624 18880042539531098.275 true -108 -24818 -24568 -1948006796 31817.932 -1.029835834870436E9 41086919080271309.256 2022-02-26 2022-11-13T19:40:45 2022-05-02 73.170.53.26 zYoung@Skimia.info Ronald Regan Road 49
+2022-02-20T02:50:44 -185110644 59552996290687282.400 false 117 -24002 -20806 -1038995074 14082.866 -1.921400240189578E9 78346053662501348.604 2022-07-15 2022-08-12T19:45:12 2022-08-18 241.111.54.249 zYoung@Rhycero.info Graedel Street 59
+2022-10-30T09:03:23 65392670 30356364161196306.520 true -48 22867 -5527 -1126401313 21589.85 -5.7482620780016E8 48592779402668399.669 2022-04-11 2022-05-19T21:26:49 2022-03-04 45.108.243.171 zYoung@Realbridge.biz Michigan Trail 16
+2022-09-15T05:03:12 -1800346257 49621957955099644.862 false -44 -23721 -16271 -1292692094 30569.791 -1.767617706908059E9 10447827669552088.565 2022-04-08 2022-07-16T17:41:06 2022-10-28 238.237.183.93 zYoung@Quinu.biz Crest Line Alley 29
+2022-06-05T08:57:17 718634291 76046921382683024.570 false 100 4563 -3620 -365945168 -23038.889 -1.095987274354548E9 27228007073316839.814 2022-07-13 2022-06-02T02:47:42 2022-06-18 131.175.168.11 zYoung@Quimm.name Cordelia Plaza 64
+2022-01-25T21:33:50 -265423504 57813067390186827.587 true -37 13813 11564 1262073599 3595.745 1.51725892560408E8 49243869281888627.621 2022-10-02 2022-08-02T11:03:01 2022-02-17 236.31.247.40 zYoung@Quatz.name East Center 51
+2022-08-30T07:23:47 1745631368 143626455306392.438 false 3 11152 23332 1775459731 1700.391 -1.04266610682783E9 89305210055280091.734 2022-06-04 2022-06-16T19:46:02 2022-08-16 131.249.239.87 zYoung@Oyoyo.biz Stuart Park 73
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_asc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_asc.out
new file mode 100644
index 0000000000..2661c73a00
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_asc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q17_string_asc --
+2022-05-04T12:36:15 -1627101797 89644326556158513.379 false 7 -6579 -4583 -1654417357 27475.512 -7.72179757635776E8 5106404149572992.768 2022-10-08 2022-10-23T21:29:23 2022-11-22 203.19.103.240 VictorMyers@Realbridge.mil 1st Alley 12
+2022-12-05T18:43:08 1750833797 34872247060725414.103 false 74 -23326 15941 891145292 -5566.2886 6.4382361116976E7 52189184506203487.310 2022-03-06 2023-01-09T20:39:13 2022-04-26 143.232.171.53 nobis@Browsecat.mil 1st Alley 13
+2022-01-13T00:52:13 -864425143 16604520726130112.540 true -12 15806 -20284 -1233425583 6070.7563 -1.687605190786361E9 93797407399565913.962 2022-06-12 2022-09-12T07:57:08 2022-05-20 132.111.222.23 zFrazier@Vinte.gov 1st Alley 15
+2022-05-30T05:06:41 -487765455 85156661075679181.191 true 116 19545 24523 -744291975 14334.146 -1.370426800828882E9 24415617793165219.823 2022-11-22 2022-12-02T10:41:46 2022-05-13 227.128.59.245 dolorem_maxime@Plajo.name 1st Alley 16
+2022-03-01T00:39:57 1293233069 66535740915975078.367 true 101 -11983 22518 1720627422 -1102.1978 -1.5211350824911E7 61032815302357696.530 2022-08-13 2022-02-15T13:12:26 2022-10-05 252.11.32.94 rDay@Dabshots.net 1st Alley 16
+2022-07-29T03:10:35 2002724802 66897979016479933.675 true 14 7586 -30868 1763447185 -23086.096 1.85638128615846E8 24041567062979912.765 2022-06-15 2022-04-22T07:16:02 2022-12-08 68.176.214.175 BettyWarren@Browsecat.edu 1st Alley 18
+2022-09-28T18:08:16 -766929243 52482249297349333.699 true 42 4139 -22365 561391544 -19803.291 -1.065853626171658E9 15610738818188781.565 2022-07-01 2022-03-31T07:09:51 2022-01-13 223.83.173.58 possimus_et@Minyx.mil 1st Alley 19
+2022-01-11T01:13:25 140324916 15916441852690239.231 false -93 4940 -29817 -1600969036 4689.1763 -2.06639748964639E9 51555626034242289.996 2022-04-04 2022-01-13T20:12:48 2022-05-04 252.64.86.251 eum_expedita_molestias@Feedbug.edu 1st Alley 19
+2022-02-13T14:33:28 -92138496 32641466394086614.649 true 85 18149 18969 1496123550 1554.6405 -2.86568393056742E8 40045618626472403.297 2022-12-18 2022-04-28T21:13:46 2022-02-24 69.238.217.1 sit_doloremque_quidem@Podcat.name 1st Alley 2
+2022-11-16T04:01:03 -1953153949 59107956519203663.641 false 70 13772 -3666 794516042 30508.299 -3.6696945276336E8 24271391813829958.167 2022-06-09 2022-02-12T20:25:46 2022-01-29 211.200.144.103 quae@Mybuzz.com 1st Alley 23
+2022-09-04T09:34:12 1331727343 10731295967421040.309 true 106 -31165 29111 1878010588 23252.588 -1.231731682067512E9 80664184950286523.256 2022-09-08 2022-08-16T16:35:28 2022-01-25 240.54.161.78 mHoward@Teklist.info 1st Alley 25
+2022-03-20T23:04:57 64676326 15981739244075342.717 true -46 -16521 -22293 -1602922021 15013.503 9.42511173939751E8 27773242362015829.371 2022-10-26 2022-04-12T06:46:28 2022-11-21 52.176.134.155 voluptatem@Skynoodle.mil 1st Alley 26
+2022-09-30T14:24:20 1353141153 23553265743374278.450 true 112 8609 13724 883070966 -25159.037 -2.140929160065219E9 23406056908281689.749 2022-08-25 2022-12-05T14:00:56 2022-08-12 39.131.108.169 tLarson@Jabberbean.com 1st Alley 26
+2022-06-07T23:55:47 1499825638 61330784035771336.193 true -105 7183 -28526 -1607553214 12269.968 -1.761041511613938E9 42798595719558090.580 2022-05-17 2022-08-20T20:21:55 2022-04-03 196.44.104.55 ClarenceNelson@Voonyx.org 1st Alley 26
+2022-02-28T06:38:23 1151877578 58742070671324246.252 false 107 1019 22572 996484353 -9232.662 -8.04361595870219E8 77889185630116813.498 2022-11-30 2023-01-02T04:34:16 2022-04-01 74.199.167.167 MichelleStewart@Eire.name 1st Alley 27
+2022-08-29T15:21:22 451804115 35143558808840530.861 false -40 -9632 21176 1696491377 -12843.192 3.79427988057741E8 15638281725428596.745 2022-05-13 2022-02-19T10:00:08 2022-03-31 161.16.206.176 EmilyTorres@Wikizz.info 1st Alley 29
+2022-10-01T16:32:50 -416573763 53800078998086841.650 false -122 -31053 -8072 -96380668 -22764.047 -1.359660555702382E9 19869290518855525.928 2022-07-16 2022-12-22T21:49:30 2022-10-11 143.68.82.222 0Warren@Dabtype.com 1st Alley 3
+2022-05-03T18:21:10 -1973158190 17155322170144469.269 false 117 -17762 20701 -1241485587 -24601.283 6.72091766154775E8 54548642673501144.185 2022-03-01 2022-11-21T05:16:50 2022-10-22 64.143.247.4 JohnRiley@Skajo.mil 1st Alley 30
+2022-06-25T05:22:10 1504641832 46265893863186851.662 false -37 -2518 -2859 -308301378 17676.936 -1.800508497969299E9 54361167905408506.274 2022-03-23 2022-04-03T07:18:06 2022-01-11 94.218.6.31 rem_occaecati@Npath.net 1st Alley 31
+2022-10-21T19:12:29 -1969397161 83480590743076696.507 true -101 -27798 -21430 1096940579 5275.2524 1.36416645484735E8 29219757547674036.584 2022-02-21 2022-07-02T17:46:09 2022-07-28 87.176.129.84 ArthurJenkins@Twimm.net 1st Alley 33
+
diff --git a/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_desc.out b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_desc.out
new file mode 100644
index 0000000000..9c070c748f
--- /dev/null
+++ b/regression-test/data/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_desc.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unique2_nonkey_topn_q17_string_desc --
+2022-04-22T12:09:06 -2099239257 68427975603194356.948 true 63 -11603 3603 215943754 -20036.201 4.20506006996905E8 79486202597669846.661 2022-10-16 2022-06-11T18:46:40 2022-02-07 107.130.185.130 TammyRoss@Pixoboo.gov Westridge Way 96
+2022-04-18T10:48:43 314894420 2098173440227552.250 false -13 -21521 20792 391302757 -26360.688 -2.130985315271908E9 21030644542468258.957 2022-09-01 2022-01-20T09:09:35 2022-08-31 198.171.156.31 RandyDiaz@Yakijo.mil Westridge Way 95
+2022-05-27T21:08:53 -1897423790 84310229524119763.590 false 42 -26805 3875 375837646 -13273.37 6.9697487758171E8 42884975833855223.353 2022-07-14 2022-08-15T18:14:46 2022-11-01 70.151.162.7 nobis@Pixoboo.com Westridge Way 95
+2022-12-07T23:08:20 -365199063 34845826481852959.468 true -8 29043 -17756 61604339 -14375.166 1.132912438548864E9 82889461616174859.743 2022-10-02 2022-01-24T14:16:52 2022-01-14 174.51.38.80 LarrySmith@Roombo.net Westridge Way 94
+2022-10-06T14:19:54 620394269 80295423676735577.609 false 57 17148 -713 -595208350 14440.632 -4.16626631409584E8 49563225865731116.263 2022-08-14 2022-05-21T08:57:32 2022-08-09 219.175.201.6 CherylBrown@Blogspan.gov Westridge Way 91
+2022-04-27T07:23:22 74622799 65660071267706921.327 true 46 -20041 -25147 1731721011 -5553.182 1.138268469627672E9 47073624330727067.681 2022-11-03 2022-03-18T22:31:21 2022-01-17 8.96.132.28 6Wallace@Kayveo.info Westridge Way 91
+2022-11-19T08:16:56 330605379 47139795015533125.459 false 66 4914 -5871 -676471521 -20194.97 1.02628849302948E9 48101486995500295.358 2022-08-19 2022-08-27T09:31:33 2022-10-29 240.88.201.114 quia@Twitterbeat.net Westridge Way 90
+2022-03-11T15:03:41 70154103 5270698736150700.302 false 65 -3132 25334 -1714376369 -19339.865 -1.757875633009279E9 78923550065287892.761 2022-09-13 2022-02-19T12:54:16 2022-05-20 146.114.119.163 7Lee@Jabberstorm.biz Westridge Way 9
+2022-09-25T17:02:16 1771425675 11360144073035110.860 false -37 -31048 7539 299951714 17394.299 4902695.642423 18550221340526293.213 2022-04-19 2022-01-26T21:15:21 2022-01-17 90.111.218.36 uGarcia@LiveZ.gov Westridge Way 89
+2022-04-22T22:56:40 -146034629 15123111098081104.340 true 1 -29290 23259 -792220741 -16748.357 -4.39889132616518E8 7675275209982281.850 2022-03-28 2022-01-17T07:31:19 2022-11-13 162.122.150.229 et@Chatterpoint.mil Westridge Way 89
+2022-10-29T05:22:13 -900428298 56007378700458463.351 true 88 -5452 20614 740440588 23007.346 -1.662857591934437E9 877863554691558.898 2022-07-07 2022-12-19T21:38:45 2022-10-29 3.167.101.33 rerum_aut_dolores@Oyonder.edu Westridge Way 89
+2022-12-24T20:54:18 -1519565861 22571648105451090.654 false 62 -11190 29625 818425899 20055.523 -1.561890863176794E9 22076739850886636.520 2022-05-30 2022-10-08T04:45:40 2022-05-05 147.80.140.38 yGonzalez@DabZ.name Westridge Way 89
+2022-11-19T00:17:54 -1295454768 29969096078554471.481 false -67 -5097 -15138 -972205738 20271.934 -1.800836466541678E9 38544426212096088.530 2022-06-21 2022-09-20T15:56:01 2022-10-19 23.81.121.178 ex@Twitterbeat.biz Westridge Way 87
+2023-01-10T12:21:52 -1689662597 65230640004270083.875 true 31 12180 -6122 2001417237 -13576.946 9.21989416750725E8 65669183802887664.711 2022-06-26 2022-06-10T03:12:46 2022-11-03 197.82.90.185 similique_suscipit_debitis@Rhybox.edu Westridge Way 87
+2022-03-16T10:21:57 -1267821738 62312436470384583.290 true 17 29317 27364 -1256756498 26649.877 -3.25197861948544E8 56386698141704941.483 2022-05-31 2022-12-24T12:04:06 2022-03-17 62.179.6.11 cHicks@Wikizz.info Westridge Way 86
+2022-05-11T20:44:46 -2021819558 6695578893767881.911 false 35 -23474 4358 -1105824380 18573.38 1.922391897886631E9 57744065520145976.231 2022-04-11 2022-07-10T18:02:20 2022-05-24 80.237.166.177 iAlvarez@Tagopia.com Westridge Way 86
+2022-08-30T10:57:06 1332889445 1042711916750383.473 false -100 25858 -851 1058738313 -26333.469 1.920784533754478E9 54698007295776299.290 2022-08-20 2022-04-26T10:09:36 2023-01-01 146.171.143.208 LawrenceBrooks@Ntag.com Westridge Way 80
+2022-12-12T08:01:09 -1475233551 53233051136435203.685 false 67 -20298 12904 42003257 -1733.4249 1.291079052928937E9 99906662946434400.570 2022-01-20 2022-08-18T04:15 2022-08-16 226.137.150.145 8Carpenter@Blogtag.com Westridge Way 80
+2022-05-27T03:41:43 2022813179 96854679979479728.502 true 24 31559 -3815 -1927482006 6423.038 -1.99428251937564E8 47736023841899638.552 2022-09-18 2022-09-16T10:33:40 2022-04-16 10.230.38.117 StevenSimpson@Voomm.gov Westridge Way 8
+2022-09-10T20:38:29 -1997486447 28102352307302453.552 true 1 25701 -5014 -99345622 4059.546 -1.74320200146372E8 93568203003475872.662 2022-03-03 2023-01-06T22:36:20 2022-02-28 136.24.182.227 debitis@Buzzdog.gov Westridge Way 78
+
diff --git a/regression-test/suites/datatype_p0/scalar_types/load.groovy b/regression-test/suites/datatype_p0/scalar_types/load.groovy
new file mode 100644
index 0000000000..87178bfbb2
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/load.groovy
@@ -0,0 +1,151 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import org.codehaus.groovy.runtime.IOGroovyMethods
+
+suite("test_scalar_types_load", "p0") {
+
+ def dataFile = """${getS3Url()}/regression/datatypes/test_scalar_types.csv"""
+
+ // define dup key table
+ def testTable = "tbl_scalar_types_dup"
+ sql "DROP TABLE IF EXISTS ${testTable}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${testTable} (
+ `k1` bigint(11) NULL,
+ `c_bool` boolean NULL,
+ `c_tinyint` tinyint(4) NULL,
+ `c_smallint` smallint(6) NULL,
+ `c_int` int(11) NULL,
+ `c_bigint` bigint(20) NULL,
+ `c_largeint` largeint(40) NULL,
+ `c_float` float NULL,
+ `c_double` double NULL,
+ `c_decimal` decimal(20, 3) NULL,
+ `c_decimalv3` decimalv3(20, 3) NULL,
+ `c_date` date NULL,
+ `c_datetime` datetime NULL,
+ `c_datev2` datev2 NULL,
+ `c_datetimev2` datetimev2(0) NULL,
+ `c_char` char(15) NULL,
+ `c_varchar` varchar(100) NULL,
+ `c_string` text NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`k1`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 10
+ PROPERTIES("replication_num" = "1");
+ """
+
+ // load data
+ streamLoad {
+ table testTable
+ file dataFile
+ time 60000
+
+ check { result, exception, startTime, endTime ->
+ if (exception != null) {
+ throw exception
+ }
+ log.info("Stream load result: ${result}".toString())
+ def json = parseJson(result)
+ assertEquals(1000000, json.NumberTotalRows)
+ assertEquals(1000000, json.NumberLoadedRows)
+ }
+ }
+
+
+ // define unique key table1 enable mow
+ testTable = "tbl_scalar_types_unique1"
+ sql "DROP TABLE IF EXISTS ${testTable}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${testTable} (
+ `c_datetimev2` datetimev2(0) NULL,
+ `c_bigint` bigint(20) NULL,
+ `c_decimalv3` decimalv3(20, 3) NULL,
+ `c_bool` boolean NULL,
+ `c_tinyint` tinyint(4) NULL,
+ `c_smallint` smallint(6) NULL,
+ `c_int` int(11) NULL,
+ `c_largeint` largeint(40) NULL,
+ `c_float` float NULL,
+ `c_double` double NULL,
+ `c_decimal` decimal(20, 3) NULL,
+ `c_date` date NULL,
+ `c_datetime` datetime NULL,
+ `c_datev2` datev2 NULL,
+ `c_char` char(15) NULL,
+ `c_varchar` varchar(100) NULL,
+ `c_string` text NULL
+ ) ENGINE=OLAP
+ UNIQUE KEY(`c_datetimev2`, `c_bigint`, `c_decimalv3`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`c_bigint`) BUCKETS 10
+ PROPERTIES("replication_num" = "1", "unique_key_merge_on_write" = "true");
+ """
+
+ // insert data into unique key table1 2 times
+ sql """INSERT INTO ${testTable} SELECT `c_datetimev2`, `c_bigint`, `c_decimalv3`,
+ `c_bool`, `c_tinyint`, `c_smallint`, `c_int`, `c_largeint`,
+ `c_float`, `c_double`, `c_decimal`, `c_date`, `c_datetime`, `c_datev2`,
+ `c_char`, `c_varchar`, `c_string` FROM tbl_scalar_types_dup"""
+ sql """INSERT INTO ${testTable} SELECT `c_datetimev2`, `c_bigint`, `c_decimalv3`,
+ `c_bool`, `c_tinyint`, `c_smallint`, `c_int`, `c_largeint`,
+ `c_float`, `c_double`, `c_decimal`, `c_date`, `c_datetime`, `c_datev2`,
+ `c_char`, `c_varchar`, `c_string` FROM tbl_scalar_types_dup"""
+
+
+ // define unique key table2 disable mow
+ testTable = "tbl_scalar_types_unique2"
+ sql "DROP TABLE IF EXISTS ${testTable}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${testTable} (
+ `c_datetimev2` datetimev2(0) NULL,
+ `c_bigint` bigint(20) NULL,
+ `c_decimalv3` decimalv3(20, 3) NULL,
+ `c_bool` boolean NULL,
+ `c_tinyint` tinyint(4) NULL,
+ `c_smallint` smallint(6) NULL,
+ `c_int` int(11) NULL,
+ `c_largeint` largeint(40) NULL,
+ `c_float` float NULL,
+ `c_double` double NULL,
+ `c_decimal` decimal(20, 3) NULL,
+ `c_date` date NULL,
+ `c_datetime` datetime NULL,
+ `c_datev2` datev2 NULL,
+ `c_char` char(15) NULL,
+ `c_varchar` varchar(100) NULL,
+ `c_string` text NULL
+ ) ENGINE=OLAP
+ UNIQUE KEY(`c_datetimev2`, `c_bigint`, `c_decimalv3`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`c_bigint`) BUCKETS 10
+ PROPERTIES("replication_num" = "1", "unique_key_merge_on_write" = "false");
+ """
+
+ // insert data into unique key table1 2 times
+ sql """INSERT INTO ${testTable} SELECT `c_datetimev2`, `c_bigint`, `c_decimalv3`,
+ `c_bool`, `c_tinyint`, `c_smallint`, `c_int`, `c_largeint`,
+ `c_float`, `c_double`, `c_decimal`, `c_date`, `c_datetime`, `c_datev2`,
+ `c_char`, `c_varchar`, `c_string` FROM tbl_scalar_types_dup"""
+ sql """INSERT INTO ${testTable} SELECT `c_datetimev2`, `c_bigint`, `c_decimalv3`,
+ `c_bool`, `c_tinyint`, `c_smallint`, `c_int`, `c_largeint`,
+ `c_float`, `c_double`, `c_decimal`, `c_date`, `c_datetime`, `c_datev2`,
+ `c_char`, `c_varchar`, `c_string` FROM tbl_scalar_types_dup"""
+
+}
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_asc.sql
new file mode 100644
index 0000000000..3d4eae156d
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_bool, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_desc.sql
new file mode 100644
index 0000000000..a960cef38b
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q01_bool_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_bool DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_asc.sql
new file mode 100644
index 0000000000..8aa7e0e96e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_tinyint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_desc.sql
new file mode 100644
index 0000000000..92cd2d3449
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q02_tinyint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_tinyint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_asc.sql
new file mode 100644
index 0000000000..5ba3495af6
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_smallint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_desc.sql
new file mode 100644
index 0000000000..5945c4a19b
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q03_smallint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_smallint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_asc.sql
new file mode 100644
index 0000000000..76abc1705f
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_int, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_desc.sql
new file mode 100644
index 0000000000..67a1433ee5
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q04_int_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_int DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_asc.sql
new file mode 100644
index 0000000000..00638e50e4
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_bigint, c_largeint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_desc.sql
new file mode 100644
index 0000000000..bfdb332c8d
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q05_bigint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_bigint DESC, c_largeint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_asc.sql
new file mode 100644
index 0000000000..66186250f5
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_largeint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_desc.sql
new file mode 100644
index 0000000000..dba2792800
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q06_largeint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_largeint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_asc.sql
new file mode 100644
index 0000000000..3809a96943
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_float, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_desc.sql
new file mode 100644
index 0000000000..9e8cdcf3e1
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q07_float_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_float DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_asc.sql
new file mode 100644
index 0000000000..f95080f5d9
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_double, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_desc.sql
new file mode 100644
index 0000000000..d947a8b6c8
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q08_double_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_double DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_asc.sql
new file mode 100644
index 0000000000..2f4b2b7df1
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_decimal, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_desc.sql
new file mode 100644
index 0000000000..a9e96829e5
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q09_decimal_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_decimal DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_asc.sql
new file mode 100644
index 0000000000..bb1edd6fff
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_decimalv3, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_desc.sql
new file mode 100644
index 0000000000..f0adc6f73e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q10_decimalv3_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_decimalv3 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_asc.sql
new file mode 100644
index 0000000000..4ac4f42258
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_date, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_desc.sql
new file mode 100644
index 0000000000..ad67938e09
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q11_date_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_date DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_asc.sql
new file mode 100644
index 0000000000..9849cc5473
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_datetime, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_desc.sql
new file mode 100644
index 0000000000..0a81aac7f4
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q12_datetime_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_datetime DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_asc.sql
new file mode 100644
index 0000000000..5fb900ef67
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_datev2, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_desc.sql
new file mode 100644
index 0000000000..e12f881fbd
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q13_datev2_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_datev2 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_asc.sql
new file mode 100644
index 0000000000..19b769be0e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_datetimev2, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_desc.sql
new file mode 100644
index 0000000000..9017f64319
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q14_datetimev2_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_datetimev2 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_asc.sql
new file mode 100644
index 0000000000..7a7c6c8d6e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_char, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_desc.sql
new file mode 100644
index 0000000000..af7338e9a1
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q15_char_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_char DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_asc.sql
new file mode 100644
index 0000000000..ed7c290b9d
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_varchar, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_desc.sql
new file mode 100644
index 0000000000..cfc5dfa3b9
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q16_varchar_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_varchar DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_asc.sql
new file mode 100644
index 0000000000..25ecf80587
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_string, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_desc.sql
new file mode 100644
index 0000000000..85ae703976
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/dup_nonkey_topn_q17_string_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_dup ORDER BY c_string DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_asc.sql
new file mode 100644
index 0000000000..a8c19054eb
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_bool, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_desc.sql
new file mode 100644
index 0000000000..da92933318
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q01_bool_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_bool DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_asc.sql
new file mode 100644
index 0000000000..429871544e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_tinyint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_desc.sql
new file mode 100644
index 0000000000..c688fca01c
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q02_tinyint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_tinyint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_asc.sql
new file mode 100644
index 0000000000..755c68b3d2
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_smallint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_desc.sql
new file mode 100644
index 0000000000..b871662044
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q03_smallint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_smallint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_asc.sql
new file mode 100644
index 0000000000..f65728e540
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_int, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_desc.sql
new file mode 100644
index 0000000000..375cdb5c9e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q04_int_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_int DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_asc.sql
new file mode 100644
index 0000000000..24f0443d98
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_bigint, c_largeint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_desc.sql
new file mode 100644
index 0000000000..86f211b35e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q05_bigint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_bigint DESC, c_largeint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_asc.sql
new file mode 100644
index 0000000000..c75a763c28
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_largeint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_desc.sql
new file mode 100644
index 0000000000..ce0f1624a2
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q06_largeint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_largeint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_asc.sql
new file mode 100644
index 0000000000..dcc89cca67
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_float, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_desc.sql
new file mode 100644
index 0000000000..46dfca0768
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q07_float_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_float DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_asc.sql
new file mode 100644
index 0000000000..a529f9f01f
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_double, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_desc.sql
new file mode 100644
index 0000000000..b30d93f43b
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q08_double_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_double DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_asc.sql
new file mode 100644
index 0000000000..4e5132a20e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_decimal, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_desc.sql
new file mode 100644
index 0000000000..3988ee3195
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q09_decimal_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_decimal DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_asc.sql
new file mode 100644
index 0000000000..c8abbdc49a
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_decimalv3, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_desc.sql
new file mode 100644
index 0000000000..620ffdec65
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q10_decimalv3_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_decimalv3 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_asc.sql
new file mode 100644
index 0000000000..a319d731cd
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_date, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_desc.sql
new file mode 100644
index 0000000000..da75092094
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q11_date_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_date DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_asc.sql
new file mode 100644
index 0000000000..7975011ccc
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_datetime, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_desc.sql
new file mode 100644
index 0000000000..cced3bc5a0
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q12_datetime_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_datetime DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_asc.sql
new file mode 100644
index 0000000000..bd46a1dc2f
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_datev2, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_desc.sql
new file mode 100644
index 0000000000..4d85c584cd
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q13_datev2_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_datev2 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_asc.sql
new file mode 100644
index 0000000000..cf4456fe4a
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_datetimev2, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_desc.sql
new file mode 100644
index 0000000000..d3d765855e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q14_datetimev2_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_datetimev2 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_asc.sql
new file mode 100644
index 0000000000..e9aec0c470
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_char, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_desc.sql
new file mode 100644
index 0000000000..02cbc113e3
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q15_char_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_char DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_asc.sql
new file mode 100644
index 0000000000..548bef59bb
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_varchar, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_desc.sql
new file mode 100644
index 0000000000..6d3c4bef06
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q16_varchar_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_varchar DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_asc.sql
new file mode 100644
index 0000000000..1dd6afa50e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_string, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_desc.sql
new file mode 100644
index 0000000000..6a1822fde4
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique1_nonkey_topn_q17_string_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique1 ORDER BY c_string DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_asc.sql
new file mode 100644
index 0000000000..628f1adb9d
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_bool, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_desc.sql
new file mode 100644
index 0000000000..402ed78a35
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q01_bool_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_bool DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_asc.sql
new file mode 100644
index 0000000000..6a085f307a
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_tinyint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_desc.sql
new file mode 100644
index 0000000000..b0fa86b447
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q02_tinyint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_tinyint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_asc.sql
new file mode 100644
index 0000000000..a4a05d48e2
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_smallint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_desc.sql
new file mode 100644
index 0000000000..1873c3f0b0
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q03_smallint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_smallint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_asc.sql
new file mode 100644
index 0000000000..fb317085d2
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_int, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_desc.sql
new file mode 100644
index 0000000000..04f27b132a
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q04_int_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_int DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_asc.sql
new file mode 100644
index 0000000000..cfec50076c
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_bigint, c_largeint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_desc.sql
new file mode 100644
index 0000000000..49863385d4
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q05_bigint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_bigint DESC, c_largeint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_asc.sql
new file mode 100644
index 0000000000..88adef8b9d
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_largeint, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_desc.sql
new file mode 100644
index 0000000000..cc66f6169c
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q06_largeint_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_largeint DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_asc.sql
new file mode 100644
index 0000000000..fafd1fbd3e
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_float, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_desc.sql
new file mode 100644
index 0000000000..dba2dd8504
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q07_float_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_float DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_asc.sql
new file mode 100644
index 0000000000..b5753c3f4b
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_double, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_desc.sql
new file mode 100644
index 0000000000..4be5e1f8e0
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q08_double_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_double DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_asc.sql
new file mode 100644
index 0000000000..75cf63803b
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_decimal, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_desc.sql
new file mode 100644
index 0000000000..ad6721a360
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q09_decimal_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_decimal DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_asc.sql
new file mode 100644
index 0000000000..6af2238d41
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_decimalv3, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_desc.sql
new file mode 100644
index 0000000000..f2fdb00292
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q10_decimalv3_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_decimalv3 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_asc.sql
new file mode 100644
index 0000000000..1bb1a2aa63
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_date, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_desc.sql
new file mode 100644
index 0000000000..6ed0f7d493
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q11_date_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_date DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_asc.sql
new file mode 100644
index 0000000000..c8fad8675f
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_datetime, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_desc.sql
new file mode 100644
index 0000000000..7e55c9ede0
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q12_datetime_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_datetime DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_asc.sql
new file mode 100644
index 0000000000..5822af3182
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_datev2, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_desc.sql
new file mode 100644
index 0000000000..ffdd68d0dd
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q13_datev2_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_datev2 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_asc.sql
new file mode 100644
index 0000000000..fcd9cae4e7
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_datetimev2, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_desc.sql
new file mode 100644
index 0000000000..87a68bf476
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q14_datetimev2_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_datetimev2 DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_asc.sql
new file mode 100644
index 0000000000..add76be79a
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_char, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_desc.sql
new file mode 100644
index 0000000000..f2c2e3beca
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q15_char_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_char DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_asc.sql
new file mode 100644
index 0000000000..d897874eac
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_varchar, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_desc.sql
new file mode 100644
index 0000000000..204a2da8a6
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q16_varchar_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_varchar DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_asc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_asc.sql
new file mode 100644
index 0000000000..24989fe515
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_asc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_string, c_bigint LIMIT 20;
\ No newline at end of file
diff --git a/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_desc.sql b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_desc.sql
new file mode 100644
index 0000000000..f9a0b00c38
--- /dev/null
+++ b/regression-test/suites/datatype_p0/scalar_types/sql/unique2_nonkey_topn_q17_string_desc.sql
@@ -0,0 +1 @@
+SELECT * FROM tbl_scalar_types_unique2 ORDER BY c_string DESC, c_bigint DESC LIMIT 20;
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org