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

yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 5912bbaafc9 [opt](regression test) Add string-like column order by 
test #26379 (#26533)
5912bbaafc9 is described below

commit 5912bbaafc9a4ac55bde2f7e641b85dc6f063cd1
Author: zhiqiang <[email protected]>
AuthorDate: Wed Nov 8 21:55:55 2023 -0600

    [opt](regression test) Add string-like column order by test #26379 (#26533)
---
 regression-test/data/query_p0/sort/sort.out      | 60 ++++++++++++++++++++++++
 regression-test/suites/query_p0/sort/sort.groovy | 54 +++++++++++++++++++++
 2 files changed, 114 insertions(+)

diff --git a/regression-test/data/query_p0/sort/sort.out 
b/regression-test/data/query_p0/sort/sort.out
index c6150f773a2..3452271691f 100644
--- a/regression-test/data/query_p0/sort/sort.out
+++ b/regression-test/data/query_p0/sort/sort.out
@@ -3146,3 +3146,63 @@ z
 3023-03-21T08:00       1023.1023       1023
 3024-03-21T08:00       1024.1024       1024
 
+-- !order_by_col_str --
+1      A
+2      A
+5      B
+6      B
+3      a
+4      a
+7      b
+8      b
+
+-- !order_by_col_str_null --
+2      \N
+4      \N
+6      \N
+8      \N
+1      A
+5      B
+3      a
+7      b
+
+-- !order_by_col_varchar --
+1      A
+2      A
+5      B
+6      B
+3      a
+4      a
+7      b
+8      b
+
+-- !order_by_col_varchar_null --
+2      \N
+4      \N
+6      \N
+8      \N
+1      A
+5      B
+3      a
+7      b
+
+-- !order_by_col_char --
+1      A
+2      A
+5      B
+6      B
+3      a
+4      a
+7      b
+8      b
+
+-- !order_by_col_char_null --
+2      \N
+4      \N
+6      \N
+8      \N
+1      A
+5      B
+3      a
+7      b
+
diff --git a/regression-test/suites/query_p0/sort/sort.groovy 
b/regression-test/suites/query_p0/sort/sort.groovy
index 154bc104551..a7f096b330e 100644
--- a/regression-test/suites/query_p0/sort/sort.groovy
+++ b/regression-test/suites/query_p0/sort/sort.groovy
@@ -155,4 +155,58 @@ suite("sort") {
     qt_order_by_float """ select 
/*SET_VAR(parallel_pipeline_task_num=1,parallel_fragment_exec_instance_num=1)*/ 
* from ${tblName} order by dc; """
     qt_order_by_int """ select 
/*SET_VAR(parallel_pipeline_task_num=1,parallel_fragment_exec_instance_num=1)*/ 
* from ${tblName} order by ic; """
     qt_order_by_uint """ select 
/*SET_VAR(parallel_pipeline_task_num=1,parallel_fragment_exec_instance_num=1)*/ 
* from ${tblName} order by time_period; """
+
+
+    // string order by test
+    // test purpose:
+    // 1. make sure order by string-like column will follow its ASCI value
+    // 2. make sure order by with null value works as expected
+    sql """ DROP TABLE IF EXISTS sort_string_orderby """
+    sql """ CREATE TABLE sort_string_orderby (
+      `row_id`              INT NOT NULL,
+      `col_str`             STRING NOT NULL,
+      `col_str_null`        STRING NULL,
+      `col_varchar`         VARCHAR(10) NOT NULL,
+      `col_varchar_null`    VARCHAR(10) NULL,
+      `col_char`            CHAR(10) NOT NULL,
+      `col_char_null`       CHAR(10) NULL,
+    ) ENGINE=OLAP
+    DUPLICATE KEY(`row_id`)
+    DISTRIBUTED BY HASH(`row_id`) BUCKETS 1
+    PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1",
+    "disable_auto_compaction" = "true"
+    );
+    """
+    sql """
+      INSERT INTO sort_string_orderby VALUES (1, 'A', 'A', 'A', 'A','A', 'A'),
+                                            (2, 'A', NULL, 'A', NULL, 'A', 
NULL),
+                                            (3, 'a', 'a', 'a', 'a','a', 'a'),
+                                            (4, 'a', NULL, 'a', NULL,'a', 
NULL),
+                                            (5, 'B', 'B', 'B', 'B','B', 'B'),
+                                            (6, 'B', NULL, 'B', NULL, 'B', 
NULL),
+                                            (7, 'b', 'b', 'b', 'b', 'b', 'b'),
+                                            (8, 'b', NULL, 'b', NULL,'b', 
NULL);
+    """
+    qt_order_by_col_str """
+      select row_id, col_str from sort_string_orderby order by col_str,row_id
+    """
+    qt_order_by_col_str_null """
+      select row_id, col_str_null from sort_string_orderby order by 
col_str_null,row_id;
+    """
+    qt_order_by_col_varchar """
+      select row_id, col_varchar from sort_string_orderby order by 
col_varchar,row_id
+    """
+    qt_order_by_col_varchar_null """
+      select row_id, col_varchar_null from sort_string_orderby order by 
col_varchar_null,row_id
+    """
+    qt_order_by_col_char """
+      select row_id, col_char from sort_string_orderby order by col_char,row_id
+    """
+    qt_order_by_col_char_null """
+      select row_id, col_char_null from sort_string_orderby order by 
col_char_null,row_id
+    """
+    sql """
+      drop table if exists sort_string_orderby;
+    """
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to