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 2022/09/30 13:35:38 UTC

[doris] branch master updated: [enhancement](test) add some cases from trino to p0 (#12699)

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 48d32de9ae [enhancement](test) add some cases from trino to p0 (#12699)
48d32de9ae is described below

commit 48d32de9ae05b1f8f905bf3951c75e53386cc607
Author: Yongqiang YANG <98...@users.noreply.github.com>
AuthorDate: Fri Sep 30 21:35:30 2022 +0800

    [enhancement](test) add some cases from trino to p0 (#12699)
---
 .../sql/distinct/multipleDistinctAgg_order.out     |   4 +
 .../sql/distinct/repeatedDistinctAgg_order.out     |   4 +
 .../data/trino_p0/sql/distinct/withCount_order.out |   4 +
 .../trino_p0/sql/distinct/withDuplicates_order.out |   8 ++
 .../sql/distinct/withGroupByDistinctAgg_order.out  |   7 ++
 .../sql/distinct/withNoDuplicates_order.out        |   8 ++
 .../trino_p0/sql/distinct/withOrderBy_order.out    |   8 ++
 .../sql/group_by/runAggrWithoutGroupBy_order.out   |   4 +
 .../runAggregatesGroupByOridnalAndHaving_order.out |   5 +
 .../runAggregatesWithGroupByOrdinal_order.out      |   8 ++
 ...tesWithGroupByWithFalseWherePredicate_order.out |   3 +
 ...sWithWherePredicatesAndGroupByOrdinal_order.out |   5 +
 ...egatesWithoutGroupByButWithPredicates_order.out |   4 +
 .../sql/group_by/runConstantGroupBy_order.out      |  28 +++++
 .../trino_p0/sql/group_by/runCountNull_order.out   |   8 ++
 .../sql/group_by/runHavingOnEmptyResult_order.out  |   4 +
 .../sql/group_by/runHavingOutsideSubq_order.out    |   6 +
 .../sql/group_by/runHavingWithAggExpr_order.out    |   4 +
 .../sql/group_by/runHavingWithExpr_order.out       |  13 +++
 .../sql/group_by/runHavingWithGrpExpr_order.out    |  12 ++
 .../group_by/runHavingWithMultipleAggs_order.out   |   9 ++
 .../sql/group_by/runHavingWithNullCheck_order.out  |   4 +
 .../sql/group_by/runHavingWithOrderBy_order.out    |   6 +
 .../sql/group_by/runHavingWithoutGroupBy_order.out |   4 +
 .../sql/group_by/runMultipleGroupBy_order.out      |  13 +++
 .../data/trino_p0/sql/join/cross_join_order.out    | 128 +++++++++++++++++++++
 .../explicit_inner_implicit_same_tables_order.out  |  27 +++++
 .../explicit_inner_join_select_columns_order.out   |  28 +++++
 .../explicit_inner_join_select_count_order.out     |   4 +
 .../join/explicit_inner_join_select_star_order.out |  28 +++++
 .../explicit_inner_join_select_where_order.out     |  23 ++++
 .../explicit_left_implicit_same_tables_order.out   |  27 +++++
 .../sql/join/implicit_explicit_inner_order.out     |   7 ++
 .../sql/join/implicit_explicit_left_order.out      |   8 ++
 .../join/implicit_inner_join_table_alias_order.out |  28 +++++
 .../trino_p0/sql/join/implicit_less_then_order.out |  13 +++
 .../trino_p0/sql/join/implicit_not_equal_order.out | 123 ++++++++++++++++++++
 .../sql/join/inner_join_null_data_order.out        |  13 +++
 .../sql/join/inner_join_right_outer_join_order.out |   8 ++
 .../left_join_on_multiple_predicates_order.out     |  28 +++++
 .../sql/join/left_join_where_constant_order.out    |   4 +
 .../sql/join/left_join_where_is_not_null_order.out |   8 ++
 .../sql/join/left_join_where_is_null_order.out     |  23 ++++
 .../sql/join/left_outer_join_inner_join_order.out  |  23 ++++
 .../trino_p0/sql/join/left_outer_join_order.out    |  28 +++++
 .../sql/join/right_join_left_join_order.out        |  28 +++++
 .../sql/join/right_join_null_data_order.out        |  17 +++
 .../trino_p0/sql/join/right_outer_join_order.out   |  28 +++++
 .../data/trino_p0/sql/join/sub_select_in_order.out |   8 ++
 .../sql/order_by/orderByAggregate_order.out        |  23 ++++
 .../order_by/orderByAliasSameAsColumn_order.out    |  23 ++++
 .../order_by/orderByDistinctColumnDesc_order.out   |  15 +++
 .../sql/order_by/orderByExpression_order.out       |  23 ++++
 .../order_by/orderByMixOfColumnsAscDesc_order.out  |  23 ++++
 .../orderByNonProjectedAggregate_order.out         |   8 ++
 .../order_by/orderByNonProjectedColumns_order.out  |  28 +++++
 .../orderByNonProjectedExpression_order.out        |  23 ++++
 .../sql/order_by/orderByOrdinals_order.out         |  28 +++++
 .../sql/order_by/runOrderByWithFromSubq_order.out  |   8 ++
 .../trino_p0/sql/union/unionAllSameTable_order.out |  53 +++++++++
 .../sql/union/unionDistinctSameTable_order.out     |  28 +++++
 .../sql/union/unionMoreThanTwoTables_order.out     |  34 ++++++
 .../data/trino_p0/sql/union/unionOrderBy_order.out |  34 ++++++
 .../sql/union/unionWithAggregation_order.out       |   9 ++
 .../org/apache/doris/regression/Config.groovy      |   4 +
 regression-test/suites/trino_p0/ddl/nation.sql     |   8 ++
 regression-test/suites/trino_p0/ddl/orders.sql     |  13 +++
 regression-test/suites/trino_p0/ddl/part.sql       |  13 +++
 regression-test/suites/trino_p0/ddl/region.sql     |   7 ++
 regression-test/suites/trino_p0/ddl/workers.sql    |  12 ++
 regression-test/suites/trino_p0/load.groovy        |  70 +++++++++++
 .../sql/distinct/multipleDistinctAgg_order.sql     |   1 +
 .../sql/distinct/repeatedDistinctAgg_order.sql     |   1 +
 .../trino_p0/sql/distinct/withCount_order.sql      |   1 +
 .../trino_p0/sql/distinct/withDuplicates_order.sql |   1 +
 .../sql/distinct/withGroupByDistinctAgg_order.sql  |   3 +
 .../trino_p0/sql/distinct/withGroupBy_order.sql    |   5 +
 .../sql/distinct/withNoDuplicates_order.sql        |   1 +
 .../trino_p0/sql/distinct/withOrderBy_order.sql    |   1 +
 .../sql/group_by/runAggrWithoutGroupBy_order.sql   |   1 +
 .../runAggregatesGroupByOridnalAndHaving_order.sql |   1 +
 .../runAggregatesWithGroupByOrdinal_order.sql      |   1 +
 ...tesWithGroupByWithFalseWherePredicate_order.sql |   1 +
 ...sWithWherePredicatesAndGroupByOrdinal_order.sql |   1 +
 ...egatesWithoutGroupByButWithPredicates_order.sql |   1 +
 .../sql/group_by/runConstantGroupBy_order.sql      |   1 +
 .../trino_p0/sql/group_by/runCountNull_order.sql   |   1 +
 .../sql/group_by/runHavingOnEmptyResult_order.sql  |   1 +
 .../sql/group_by/runHavingOutsideSubq_order.sql    |   1 +
 .../sql/group_by/runHavingWithAggExpr_order.sql    |   1 +
 .../sql/group_by/runHavingWithExpr_order.sql       |   1 +
 .../sql/group_by/runHavingWithGrpExpr_order.sql    |   1 +
 .../group_by/runHavingWithMultipleAggs_order.sql   |   1 +
 .../sql/group_by/runHavingWithNullCheck_order.sql  |   1 +
 .../sql/group_by/runHavingWithOrderBy_order.sql    |   1 +
 .../sql/group_by/runHavingWithoutGroupBy_order.sql |   1 +
 .../sql/group_by/runMultipleGroupBy_order.sql      |   1 +
 .../suites/trino_p0/sql/join/cross_join_order.sql  |   2 +
 .../explicit_inner_implicit_same_tables_order.sql  |   7 ++
 .../explicit_inner_join_select_columns_order.sql   |   2 +
 .../explicit_inner_join_select_count_order.sql     |   2 +
 .../join/explicit_inner_join_select_star_order.sql |   2 +
 .../explicit_inner_join_select_where_order.sql     |   2 +
 .../explicit_left_implicit_same_tables_order.sql   |   7 ++
 .../sql/join/implicit_explicit_inner_order.sql     |   9 ++
 .../sql/join/implicit_explicit_left_order.sql      |   9 ++
 .../join/implicit_inner_join_table_alias_order.sql |   2 +
 .../trino_p0/sql/join/implicit_less_then_order.sql |   5 +
 .../trino_p0/sql/join/implicit_not_equal_order.sql |   6 +
 .../sql/join/inner_join_null_data_order.sql        |   1 +
 .../sql/join/inner_join_right_outer_join_order.sql |   9 ++
 .../left_join_on_multiple_predicates_order.sql     |   1 +
 .../sql/join/left_join_where_constant_order.sql    |   6 +
 .../sql/join/left_join_where_is_not_null_order.sql |   6 +
 .../sql/join/left_join_where_is_null_order.sql     |   6 +
 .../sql/join/left_outer_join_inner_join_order.sql  |   9 ++
 .../trino_p0/sql/join/left_outer_join_order.sql    |   2 +
 ...join_left_join_inner_join_parentheses_order.sql |  12 ++
 .../sql/join/right_join_left_join_order.sql        |   9 ++
 .../right_join_left_join_parentheses_order.sql     |  10 ++
 .../sql/join/right_join_null_data_order.sql        |   1 +
 .../trino_p0/sql/join/right_outer_join_order.sql   |   2 +
 .../trino_p0/sql/join/sub_select_in_order.sql      |   2 +
 .../sql/order_by/orderByAggregate_order.sql        |   2 +
 .../order_by/orderByAliasSameAsColumn_order.sql    |   2 +
 .../sql/order_by/orderByAscNullsDefault_order.sql  |   3 +
 .../sql/order_by/orderByAscNullsFirst_order.sql    |   3 +
 .../sql/order_by/orderByAscNullsLast_order.sql     |   3 +
 .../order_by/orderByDefaultNullsDefault_order.sql  |   3 +
 .../order_by/orderByDefaultNullsFirst_order.sql    |   3 +
 .../sql/order_by/orderByDefaultNullsLast_order.sql |   3 +
 .../sql/order_by/orderByDescNullsFirst_order.sql   |   3 +
 .../sql/order_by/orderByDescNullsLast_order.sql    |   3 +
 .../order_by/orderByDistinctColumnDesc_order.sql   |   1 +
 .../sql/order_by/orderByExpression_order.sql       |   1 +
 .../order_by/orderByMixOfColumnsAscDesc_order.sql  |   2 +
 .../orderByNonProjectedAggregate_order.sql         |   1 +
 .../order_by/orderByNonProjectedColumns_order.sql  |   1 +
 .../orderByNonProjectedExpression_order.sql        |   1 +
 .../sql/order_by/orderByOrdinals_order.sql         |   1 +
 .../sql/order_by/runOrderByWithFromSubq_order.sql  |   1 +
 .../trino_p0/sql/union/unionAllSameTable_order.sql |   5 +
 .../sql/union/unionDistinctSameTable_order.sql     |   5 +
 .../sql/union/unionMoreThanTwoTables_order.sql     |   9 ++
 .../trino_p0/sql/union/unionOrderBy_order.sql      |  10 ++
 .../sql/union/unionWithAggregation_order.sql       |   6 +
 146 files changed, 1565 insertions(+)

diff --git a/regression-test/data/trino_p0/sql/distinct/multipleDistinctAgg_order.out b/regression-test/data/trino_p0/sql/distinct/multipleDistinctAgg_order.out
new file mode 100644
index 0000000000..a3ab300fde
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/distinct/multipleDistinctAgg_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !multipleDistinctAgg_order --
+5	25	0
+
diff --git a/regression-test/data/trino_p0/sql/distinct/repeatedDistinctAgg_order.out b/regression-test/data/trino_p0/sql/distinct/repeatedDistinctAgg_order.out
new file mode 100644
index 0000000000..f84afebe9b
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/distinct/repeatedDistinctAgg_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !repeatedDistinctAgg_order --
+5	5
+
diff --git a/regression-test/data/trino_p0/sql/distinct/withCount_order.out b/regression-test/data/trino_p0/sql/distinct/withCount_order.out
new file mode 100644
index 0000000000..aeb4b69a9c
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/distinct/withCount_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !withCount_order --
+5	25
+
diff --git a/regression-test/data/trino_p0/sql/distinct/withDuplicates_order.out b/regression-test/data/trino_p0/sql/distinct/withDuplicates_order.out
new file mode 100644
index 0000000000..675640c293
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/distinct/withDuplicates_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !withDuplicates_order --
+0
+1
+2
+3
+4
+
diff --git a/regression-test/data/trino_p0/sql/distinct/withGroupByDistinctAgg_order.out b/regression-test/data/trino_p0/sql/distinct/withGroupByDistinctAgg_order.out
new file mode 100644
index 0000000000..c66347353b
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/distinct/withGroupByDistinctAgg_order.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !withGroupByDistinctAgg_order --
+0	5
+1	5
+2	5
+3	5
+
diff --git a/regression-test/data/trino_p0/sql/distinct/withNoDuplicates_order.out b/regression-test/data/trino_p0/sql/distinct/withNoDuplicates_order.out
new file mode 100644
index 0000000000..cc2bd0a6f4
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/distinct/withNoDuplicates_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !withNoDuplicates_order --
+AFRICA
+AMERICA
+ASIA
+EUROPE
+MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/distinct/withOrderBy_order.out b/regression-test/data/trino_p0/sql/distinct/withOrderBy_order.out
new file mode 100644
index 0000000000..e68abd143d
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/distinct/withOrderBy_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !withOrderBy_order --
+0
+1
+2
+3
+4
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runAggrWithoutGroupBy_order.out b/regression-test/data/trino_p0/sql/group_by/runAggrWithoutGroupBy_order.out
new file mode 100644
index 0000000000..470da23d4c
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runAggrWithoutGroupBy_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runAggrWithoutGroupBy_order --
+25	25	0	4	50
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runAggregatesGroupByOridnalAndHaving_order.out b/regression-test/data/trino_p0/sql/group_by/runAggregatesGroupByOridnalAndHaving_order.out
new file mode 100644
index 0000000000..7c146fd527
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runAggregatesGroupByOridnalAndHaving_order.out
@@ -0,0 +1,5 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runAggregatesGroupByOridnalAndHaving_order --
+2	5
+3	5
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runAggregatesWithGroupByOrdinal_order.out b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithGroupByOrdinal_order.out
new file mode 100644
index 0000000000..fe39a7a821
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithGroupByOrdinal_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runAggregatesWithGroupByOrdinal_order --
+0	5	50
+1	5	47
+2	5	68
+3	5	77
+4	5	58
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runAggregatesWithGroupByWithFalseWherePredicate_order.out b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithGroupByWithFalseWherePredicate_order.out
new file mode 100644
index 0000000000..71f6b245ef
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithGroupByWithFalseWherePredicate_order.out
@@ -0,0 +1,3 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runAggregatesWithGroupByWithFalseWherePredicate_order --
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runAggregatesWithWherePredicatesAndGroupByOrdinal_order.out b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithWherePredicatesAndGroupByOrdinal_order.out
new file mode 100644
index 0000000000..7333410359
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithWherePredicatesAndGroupByOrdinal_order.out
@@ -0,0 +1,5 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runAggregatesWithWherePredicatesAndGroupByOrdinal_order --
+3	5	15
+4	5	20
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runAggregatesWithoutGroupByButWithPredicates_order.out b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithoutGroupByButWithPredicates_order.out
new file mode 100644
index 0000000000..d4abfdbfe7
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runAggregatesWithoutGroupByButWithPredicates_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runAggregatesWithoutGroupByButWithPredicates_order --
+0	\N
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runConstantGroupBy_order.out b/regression-test/data/trino_p0/sql/group_by/runConstantGroupBy_order.out
new file mode 100644
index 0000000000..3e7855ddba
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runConstantGroupBy_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runConstantGroupBy_order --
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runCountNull_order.out b/regression-test/data/trino_p0/sql/group_by/runCountNull_order.out
new file mode 100644
index 0000000000..fe61349df2
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runCountNull_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runCountNull_order --
+0	0
+1	0
+2	0
+3	0
+4	0
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingOnEmptyResult_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingOnEmptyResult_order.out
new file mode 100644
index 0000000000..2cdd559546
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingOnEmptyResult_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingOnEmptyResult_order --
+0
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingOutsideSubq_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingOutsideSubq_order.out
new file mode 100644
index 0000000000..9f08db0c80
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingOutsideSubq_order.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingOutsideSubq_order --
+0
+1
+2
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingWithAggExpr_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingWithAggExpr_order.out
new file mode 100644
index 0000000000..634286ba63
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingWithAggExpr_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingWithAggExpr_order --
+14
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingWithExpr_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingWithExpr_order.out
new file mode 100644
index 0000000000..8630ec516e
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingWithExpr_order.out
@@ -0,0 +1,13 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingWithExpr_order --
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingWithGrpExpr_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingWithGrpExpr_order.out
new file mode 100644
index 0000000000..9e20006bcc
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingWithGrpExpr_order.out
@@ -0,0 +1,12 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingWithGrpExpr_order --
+1
+1
+1
+1
+1
+1
+1
+1
+4
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingWithMultipleAggs_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingWithMultipleAggs_order.out
new file mode 100644
index 0000000000..66b0a97f29
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingWithMultipleAggs_order.out
@@ -0,0 +1,9 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingWithMultipleAggs_order --
+ECONOMY POLISHED STEEL	22
+LARGE BURNISHED TIN	25
+MEDIUM BRUSHED COPPER	21
+PROMO BRUSHED BRASS	21
+STANDARD PLATED TIN	25
+STANDARD POLISHED TIN	21
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingWithNullCheck_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingWithNullCheck_order.out
new file mode 100644
index 0000000000..00db895692
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingWithNullCheck_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingWithNullCheck_order --
+\N	4
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingWithOrderBy_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingWithOrderBy_order.out
new file mode 100644
index 0000000000..23367f01fd
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingWithOrderBy_order.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingWithOrderBy_order --
+\N	2
+2	2
+5	2
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runHavingWithoutGroupBy_order.out b/regression-test/data/trino_p0/sql/group_by/runHavingWithoutGroupBy_order.out
new file mode 100644
index 0000000000..47314492e7
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runHavingWithoutGroupBy_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runHavingWithoutGroupBy_order --
+25
+
diff --git a/regression-test/data/trino_p0/sql/group_by/runMultipleGroupBy_order.out b/regression-test/data/trino_p0/sql/group_by/runMultipleGroupBy_order.out
new file mode 100644
index 0000000000..f881d2e876
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/group_by/runMultipleGroupBy_order.out
@@ -0,0 +1,13 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runMultipleGroupBy_order --
+1	0	0
+1	0	14
+1	0	15
+1	0	16
+1	0	5
+1	1	1
+1	1	17
+1	1	2
+1	1	24
+1	1	3
+
diff --git a/regression-test/data/trino_p0/sql/join/cross_join_order.out b/regression-test/data/trino_p0/sql/join/cross_join_order.out
new file mode 100644
index 0000000000..8cf5bffad1
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/cross_join_order.out
@@ -0,0 +1,128 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !cross_join_order --
+ALGERIA	AFRICA
+ALGERIA	AMERICA
+ALGERIA	ASIA
+ALGERIA	EUROPE
+ALGERIA	MIDDLE EAST
+ARGENTINA	AFRICA
+ARGENTINA	AMERICA
+ARGENTINA	ASIA
+ARGENTINA	EUROPE
+ARGENTINA	MIDDLE EAST
+BRAZIL	AFRICA
+BRAZIL	AMERICA
+BRAZIL	ASIA
+BRAZIL	EUROPE
+BRAZIL	MIDDLE EAST
+CANADA	AFRICA
+CANADA	AMERICA
+CANADA	ASIA
+CANADA	EUROPE
+CANADA	MIDDLE EAST
+CHINA	AFRICA
+CHINA	AMERICA
+CHINA	ASIA
+CHINA	EUROPE
+CHINA	MIDDLE EAST
+EGYPT	AFRICA
+EGYPT	AMERICA
+EGYPT	ASIA
+EGYPT	EUROPE
+EGYPT	MIDDLE EAST
+ETHIOPIA	AFRICA
+ETHIOPIA	AMERICA
+ETHIOPIA	ASIA
+ETHIOPIA	EUROPE
+ETHIOPIA	MIDDLE EAST
+FRANCE	AFRICA
+FRANCE	AMERICA
+FRANCE	ASIA
+FRANCE	EUROPE
+FRANCE	MIDDLE EAST
+GERMANY	AFRICA
+GERMANY	AMERICA
+GERMANY	ASIA
+GERMANY	EUROPE
+GERMANY	MIDDLE EAST
+INDIA	AFRICA
+INDIA	AMERICA
+INDIA	ASIA
+INDIA	EUROPE
+INDIA	MIDDLE EAST
+INDONESIA	AFRICA
+INDONESIA	AMERICA
+INDONESIA	ASIA
+INDONESIA	EUROPE
+INDONESIA	MIDDLE EAST
+IRAN	AFRICA
+IRAN	AMERICA
+IRAN	ASIA
+IRAN	EUROPE
+IRAN	MIDDLE EAST
+IRAQ	AFRICA
+IRAQ	AMERICA
+IRAQ	ASIA
+IRAQ	EUROPE
+IRAQ	MIDDLE EAST
+JAPAN	AFRICA
+JAPAN	AMERICA
+JAPAN	ASIA
+JAPAN	EUROPE
+JAPAN	MIDDLE EAST
+JORDAN	AFRICA
+JORDAN	AMERICA
+JORDAN	ASIA
+JORDAN	EUROPE
+JORDAN	MIDDLE EAST
+KENYA	AFRICA
+KENYA	AMERICA
+KENYA	ASIA
+KENYA	EUROPE
+KENYA	MIDDLE EAST
+MOROCCO	AFRICA
+MOROCCO	AMERICA
+MOROCCO	ASIA
+MOROCCO	EUROPE
+MOROCCO	MIDDLE EAST
+MOZAMBIQUE	AFRICA
+MOZAMBIQUE	AMERICA
+MOZAMBIQUE	ASIA
+MOZAMBIQUE	EUROPE
+MOZAMBIQUE	MIDDLE EAST
+PERU	AFRICA
+PERU	AMERICA
+PERU	ASIA
+PERU	EUROPE
+PERU	MIDDLE EAST
+ROMANIA	AFRICA
+ROMANIA	AMERICA
+ROMANIA	ASIA
+ROMANIA	EUROPE
+ROMANIA	MIDDLE EAST
+RUSSIA	AFRICA
+RUSSIA	AMERICA
+RUSSIA	ASIA
+RUSSIA	EUROPE
+RUSSIA	MIDDLE EAST
+SAUDI ARABIA	AFRICA
+SAUDI ARABIA	AMERICA
+SAUDI ARABIA	ASIA
+SAUDI ARABIA	EUROPE
+SAUDI ARABIA	MIDDLE EAST
+UNITED KINGDOM	AFRICA
+UNITED KINGDOM	AMERICA
+UNITED KINGDOM	ASIA
+UNITED KINGDOM	EUROPE
+UNITED KINGDOM	MIDDLE EAST
+UNITED STATES	AFRICA
+UNITED STATES	AMERICA
+UNITED STATES	ASIA
+UNITED STATES	EUROPE
+UNITED STATES	MIDDLE EAST
+VIETNAM	AFRICA
+VIETNAM	AMERICA
+VIETNAM	ASIA
+VIETNAM	EUROPE
+VIETNAM	MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/join/explicit_inner_implicit_same_tables_order.out b/regression-test/data/trino_p0/sql/join/explicit_inner_implicit_same_tables_order.out
new file mode 100644
index 0000000000..04a7b36a2b
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/explicit_inner_implicit_same_tables_order.out
@@ -0,0 +1,27 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !explicit_inner_implicit_same_tables_order --
+1	ARGENTINA
+10	IRAN
+11	IRAQ
+12	JAPAN
+13	JORDAN
+14	KENYA
+15	MOROCCO
+16	MOZAMBIQUE
+17	PERU
+18	CHINA
+19	ROMANIA
+2	BRAZIL
+20	SAUDI ARABIA
+21	VIETNAM
+22	RUSSIA
+23	UNITED KINGDOM
+24	UNITED STATES
+3	CANADA
+4	EGYPT
+5	ETHIOPIA
+6	FRANCE
+7	GERMANY
+8	INDIA
+9	INDONESIA
+
diff --git a/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_columns_order.out b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_columns_order.out
new file mode 100644
index 0000000000..a2bd161d83
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_columns_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !explicit_inner_join_select_columns_order --
+ALGERIA	AFRICA
+ARGENTINA	AMERICA
+BRAZIL	AMERICA
+CANADA	AMERICA
+CHINA	ASIA
+EGYPT	MIDDLE EAST
+ETHIOPIA	AFRICA
+FRANCE	EUROPE
+GERMANY	EUROPE
+INDIA	ASIA
+INDONESIA	ASIA
+IRAN	MIDDLE EAST
+IRAQ	MIDDLE EAST
+JAPAN	ASIA
+JORDAN	MIDDLE EAST
+KENYA	AFRICA
+MOROCCO	AFRICA
+MOZAMBIQUE	AFRICA
+PERU	AMERICA
+ROMANIA	EUROPE
+RUSSIA	EUROPE
+SAUDI ARABIA	MIDDLE EAST
+UNITED KINGDOM	EUROPE
+UNITED STATES	AMERICA
+VIETNAM	ASIA
+
diff --git a/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_count_order.out b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_count_order.out
new file mode 100644
index 0000000000..ff821179f8
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_count_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !explicit_inner_join_select_count_order --
+25
+
diff --git a/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_star_order.out b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_star_order.out
new file mode 100644
index 0000000000..337ac01fab
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_star_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !explicit_inner_join_select_star_order --
+0	ALGERIA	0	 haggle. carefully final deposits detect slyly agai	0	AFRICA	lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 
+1	ARGENTINA	1	al foxes promise slyly according to the regular accounts. bold requests alon	1	AMERICA	hs use ironic, even requests. s
+10	IRAN	4	efully alongside of the slyly final dependencies. 	4	MIDDLE EAST	uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl
+11	IRAQ	4	nic deposits boost atop the quickly final requests? quickly regula	4	MIDDLE EAST	uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl
+12	JAPAN	2	ously. final, express gifts cajole a	2	ASIA	ges. thinly even pinto beans ca
+13	JORDAN	4	ic deposits are blithely about the carefully regular pa	4	MIDDLE EAST	uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl
+14	KENYA	0	 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t	0	AFRICA	lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 
+15	MOROCCO	0	rns. blithely bold courts among the closely regular packages use furiously bold platelets?	0	AFRICA	lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 
+16	MOZAMBIQUE	0	s. ironic, unusual asymptotes wake blithely r	0	AFRICA	lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 
+17	PERU	1	platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun	1	AMERICA	hs use ironic, even requests. s
+18	CHINA	2	c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos	2	ASIA	ges. thinly even pinto beans ca
+19	ROMANIA	3	ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account	3	EUROPE	ly final courts cajole furiously final excuse
+2	BRAZIL	1	y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special 	1	AMERICA	hs use ironic, even requests. s
+20	SAUDI ARABIA	4	ts. silent requests haggle. closely express packages sleep across the blithely	4	MIDDLE EAST	uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl
+21	VIETNAM	2	hely enticingly express accounts. even, final 	2	ASIA	ges. thinly even pinto beans ca
+22	RUSSIA	3	 requests against the platelets use never according to the quickly regular pint	3	EUROPE	ly final courts cajole furiously final excuse
+23	UNITED KINGDOM	3	eans boost carefully special requests. accounts are. carefull	3	EUROPE	ly final courts cajole furiously final excuse
+24	UNITED STATES	1	y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be	1	AMERICA	hs use ironic, even requests. s
+3	CANADA	1	eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold	1	AMERICA	hs use ironic, even requests. s
+4	EGYPT	4	y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d	4	MIDDLE EAST	uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl
+5	ETHIOPIA	0	ven packages wake quickly. regu	0	AFRICA	lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 
+6	FRANCE	3	refully final requests. regular, ironi	3	EUROPE	ly final courts cajole furiously final excuse
+7	GERMANY	3	l platelets. regular accounts x-ray: unusual, regular acco	3	EUROPE	ly final courts cajole furiously final excuse
+8	INDIA	2	ss excuses cajole slyly across the packages. deposits print aroun	2	ASIA	ges. thinly even pinto beans ca
+9	INDONESIA	2	 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull	2	ASIA	ges. thinly even pinto beans ca
+
diff --git a/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_where_order.out b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_where_order.out
new file mode 100644
index 0000000000..a455496e91
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/explicit_inner_join_select_where_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !explicit_inner_join_select_where_order --
+EGYPT	MIDDLE EAST
+ETHIOPIA	AFRICA
+FRANCE	EUROPE
+GERMANY	EUROPE
+INDIA	ASIA
+INDONESIA	ASIA
+IRAN	MIDDLE EAST
+IRAQ	MIDDLE EAST
+JAPAN	ASIA
+JORDAN	MIDDLE EAST
+KENYA	AFRICA
+MOROCCO	AFRICA
+MOZAMBIQUE	AFRICA
+PERU	AMERICA
+ROMANIA	EUROPE
+RUSSIA	EUROPE
+SAUDI ARABIA	MIDDLE EAST
+UNITED KINGDOM	EUROPE
+UNITED STATES	AMERICA
+VIETNAM	ASIA
+
diff --git a/regression-test/data/trino_p0/sql/join/explicit_left_implicit_same_tables_order.out b/regression-test/data/trino_p0/sql/join/explicit_left_implicit_same_tables_order.out
new file mode 100644
index 0000000000..48050d9e79
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/explicit_left_implicit_same_tables_order.out
@@ -0,0 +1,27 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !explicit_left_implicit_same_tables_order --
+1	ARGENTINA
+10	IRAN
+11	IRAQ
+12	JAPAN
+13	JORDAN
+14	KENYA
+15	MOROCCO
+16	MOZAMBIQUE
+17	PERU
+18	CHINA
+19	ROMANIA
+2	BRAZIL
+20	SAUDI ARABIA
+21	VIETNAM
+22	RUSSIA
+23	UNITED KINGDOM
+24	UNITED STATES
+3	CANADA
+4	EGYPT
+5	ETHIOPIA
+6	FRANCE
+7	GERMANY
+8	INDIA
+9	INDONESIA
+
diff --git a/regression-test/data/trino_p0/sql/join/implicit_explicit_inner_order.out b/regression-test/data/trino_p0/sql/join/implicit_explicit_inner_order.out
new file mode 100644
index 0000000000..618451cb6b
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/implicit_explicit_inner_order.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !implicit_explicit_inner_order --
+1	ARGENTINA	AMERICA
+2	BRAZIL	ASIA
+3	CANADA	EUROPE
+4	EGYPT	MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/join/implicit_explicit_left_order.out b/regression-test/data/trino_p0/sql/join/implicit_explicit_left_order.out
new file mode 100644
index 0000000000..d60a1ed73c
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/implicit_explicit_left_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !implicit_explicit_left_order --
+\N	ALGERIA	AFRICA
+1	ARGENTINA	AMERICA
+2	BRAZIL	ASIA
+3	CANADA	EUROPE
+4	EGYPT	MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/join/implicit_inner_join_table_alias_order.out b/regression-test/data/trino_p0/sql/join/implicit_inner_join_table_alias_order.out
new file mode 100644
index 0000000000..4b7ff7dfcd
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/implicit_inner_join_table_alias_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !implicit_inner_join_table_alias_order --
+ALGERIA	AFRICA
+ARGENTINA	AMERICA
+BRAZIL	AMERICA
+CANADA	AMERICA
+CHINA	ASIA
+EGYPT	MIDDLE EAST
+ETHIOPIA	AFRICA
+FRANCE	EUROPE
+GERMANY	EUROPE
+INDIA	ASIA
+INDONESIA	ASIA
+IRAN	MIDDLE EAST
+IRAQ	MIDDLE EAST
+JAPAN	ASIA
+JORDAN	MIDDLE EAST
+KENYA	AFRICA
+MOROCCO	AFRICA
+MOZAMBIQUE	AFRICA
+PERU	AMERICA
+ROMANIA	EUROPE
+RUSSIA	EUROPE
+SAUDI ARABIA	MIDDLE EAST
+UNITED KINGDOM	EUROPE
+UNITED STATES	AMERICA
+VIETNAM	ASIA
+
diff --git a/regression-test/data/trino_p0/sql/join/implicit_less_then_order.out b/regression-test/data/trino_p0/sql/join/implicit_less_then_order.out
new file mode 100644
index 0000000000..98b6faf0c7
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/implicit_less_then_order.out
@@ -0,0 +1,13 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !implicit_less_then_order --
+ALGERIA	AMERICA
+ALGERIA	ASIA
+ALGERIA	EUROPE
+ALGERIA	MIDDLE EAST
+ARGENTINA	ASIA
+ARGENTINA	EUROPE
+ARGENTINA	MIDDLE EAST
+BRAZIL	EUROPE
+BRAZIL	MIDDLE EAST
+CANADA	MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/join/implicit_not_equal_order.out b/regression-test/data/trino_p0/sql/join/implicit_not_equal_order.out
new file mode 100644
index 0000000000..61700423d1
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/implicit_not_equal_order.out
@@ -0,0 +1,123 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !implicit_not_equal_order --
+ALGERIA	AMERICA
+ALGERIA	ASIA
+ALGERIA	EUROPE
+ALGERIA	MIDDLE EAST
+ARGENTINA	AFRICA
+ARGENTINA	ASIA
+ARGENTINA	EUROPE
+ARGENTINA	MIDDLE EAST
+BRAZIL	AFRICA
+BRAZIL	AMERICA
+BRAZIL	EUROPE
+BRAZIL	MIDDLE EAST
+CANADA	AFRICA
+CANADA	AMERICA
+CANADA	ASIA
+CANADA	MIDDLE EAST
+CHINA	AFRICA
+CHINA	AMERICA
+CHINA	ASIA
+CHINA	EUROPE
+CHINA	MIDDLE EAST
+EGYPT	AFRICA
+EGYPT	AMERICA
+EGYPT	ASIA
+EGYPT	EUROPE
+ETHIOPIA	AFRICA
+ETHIOPIA	AMERICA
+ETHIOPIA	ASIA
+ETHIOPIA	EUROPE
+ETHIOPIA	MIDDLE EAST
+FRANCE	AFRICA
+FRANCE	AMERICA
+FRANCE	ASIA
+FRANCE	EUROPE
+FRANCE	MIDDLE EAST
+GERMANY	AFRICA
+GERMANY	AMERICA
+GERMANY	ASIA
+GERMANY	EUROPE
+GERMANY	MIDDLE EAST
+INDIA	AFRICA
+INDIA	AMERICA
+INDIA	ASIA
+INDIA	EUROPE
+INDIA	MIDDLE EAST
+INDONESIA	AFRICA
+INDONESIA	AMERICA
+INDONESIA	ASIA
+INDONESIA	EUROPE
+INDONESIA	MIDDLE EAST
+IRAN	AFRICA
+IRAN	AMERICA
+IRAN	ASIA
+IRAN	EUROPE
+IRAN	MIDDLE EAST
+IRAQ	AFRICA
+IRAQ	AMERICA
+IRAQ	ASIA
+IRAQ	EUROPE
+IRAQ	MIDDLE EAST
+JAPAN	AFRICA
+JAPAN	AMERICA
+JAPAN	ASIA
+JAPAN	EUROPE
+JAPAN	MIDDLE EAST
+JORDAN	AFRICA
+JORDAN	AMERICA
+JORDAN	ASIA
+JORDAN	EUROPE
+JORDAN	MIDDLE EAST
+KENYA	AFRICA
+KENYA	AMERICA
+KENYA	ASIA
+KENYA	EUROPE
+KENYA	MIDDLE EAST
+MOROCCO	AFRICA
+MOROCCO	AMERICA
+MOROCCO	ASIA
+MOROCCO	EUROPE
+MOROCCO	MIDDLE EAST
+MOZAMBIQUE	AFRICA
+MOZAMBIQUE	AMERICA
+MOZAMBIQUE	ASIA
+MOZAMBIQUE	EUROPE
+MOZAMBIQUE	MIDDLE EAST
+PERU	AFRICA
+PERU	AMERICA
+PERU	ASIA
+PERU	EUROPE
+PERU	MIDDLE EAST
+ROMANIA	AFRICA
+ROMANIA	AMERICA
+ROMANIA	ASIA
+ROMANIA	EUROPE
+ROMANIA	MIDDLE EAST
+RUSSIA	AFRICA
+RUSSIA	AMERICA
+RUSSIA	ASIA
+RUSSIA	EUROPE
+RUSSIA	MIDDLE EAST
+SAUDI ARABIA	AFRICA
+SAUDI ARABIA	AMERICA
+SAUDI ARABIA	ASIA
+SAUDI ARABIA	EUROPE
+SAUDI ARABIA	MIDDLE EAST
+UNITED KINGDOM	AFRICA
+UNITED KINGDOM	AMERICA
+UNITED KINGDOM	ASIA
+UNITED KINGDOM	EUROPE
+UNITED KINGDOM	MIDDLE EAST
+UNITED STATES	AFRICA
+UNITED STATES	AMERICA
+UNITED STATES	ASIA
+UNITED STATES	EUROPE
+UNITED STATES	MIDDLE EAST
+VIETNAM	AFRICA
+VIETNAM	AMERICA
+VIETNAM	ASIA
+VIETNAM	EUROPE
+VIETNAM	MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/join/inner_join_null_data_order.out b/regression-test/data/trino_p0/sql/join/inner_join_null_data_order.out
new file mode 100644
index 0000000000..390e795e8d
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/inner_join_null_data_order.out
@@ -0,0 +1,13 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !inner_join_null_data_order --
+BRAZIL	2	R&D	5000
+BRAZIL	2	R&D	5000
+EGYPT	4	IT	4000
+ETHIOPIA	5	HR	2000
+ETHIOPIA	5	HR	2000
+GERMANY	7	CustomerService	2300
+INDIA	8	Production	2400
+INDONESIA	9	Quality	3400
+IRAQ	11	\N	\N
+JAPAN	12	\N	\N
+
diff --git a/regression-test/data/trino_p0/sql/join/inner_join_right_outer_join_order.out b/regression-test/data/trino_p0/sql/join/inner_join_right_outer_join_order.out
new file mode 100644
index 0000000000..e15f9561ea
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/inner_join_right_outer_join_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !inner_join_right_outer_join_order --
+\N	\N	AFRICA
+1	ARGENTINA	AMERICA
+1	BRAZIL	ASIA
+1	CANADA	EUROPE
+4	EGYPT	MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/join/left_join_on_multiple_predicates_order.out b/regression-test/data/trino_p0/sql/join/left_join_on_multiple_predicates_order.out
new file mode 100644
index 0000000000..177ba00d40
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/left_join_on_multiple_predicates_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !left_join_on_multiple_predicates_order --
+ALGERIA	\N
+ARGENTINA	\N
+BRAZIL	\N
+CANADA	\N
+CHINA	\N
+EGYPT	\N
+ETHIOPIA	\N
+FRANCE	\N
+GERMANY	\N
+INDIA	\N
+INDONESIA	\N
+IRAN	\N
+IRAQ	\N
+JAPAN	\N
+JORDAN	\N
+KENYA	\N
+MOROCCO	\N
+MOZAMBIQUE	\N
+PERU	\N
+ROMANIA	\N
+RUSSIA	\N
+SAUDI ARABIA	\N
+UNITED KINGDOM	\N
+UNITED STATES	\N
+VIETNAM	\N
+
diff --git a/regression-test/data/trino_p0/sql/join/left_join_where_constant_order.out b/regression-test/data/trino_p0/sql/join/left_join_where_constant_order.out
new file mode 100644
index 0000000000..9fe1997a17
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/left_join_where_constant_order.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !left_join_where_constant_order --
+EGYPT	MIDDLE EAST
+
diff --git a/regression-test/data/trino_p0/sql/join/left_join_where_is_not_null_order.out b/regression-test/data/trino_p0/sql/join/left_join_where_is_not_null_order.out
new file mode 100644
index 0000000000..1fb0f9b5fd
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/left_join_where_is_not_null_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !left_join_where_is_not_null_order --
+ALGERIA
+ARGENTINA
+BRAZIL
+CANADA
+EGYPT
+
diff --git a/regression-test/data/trino_p0/sql/join/left_join_where_is_null_order.out b/regression-test/data/trino_p0/sql/join/left_join_where_is_null_order.out
new file mode 100644
index 0000000000..7785706ca8
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/left_join_where_is_null_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !left_join_where_is_null_order --
+CHINA
+ETHIOPIA
+FRANCE
+GERMANY
+INDIA
+INDONESIA
+IRAN
+IRAQ
+JAPAN
+JORDAN
+KENYA
+MOROCCO
+MOZAMBIQUE
+PERU
+ROMANIA
+RUSSIA
+SAUDI ARABIA
+UNITED KINGDOM
+UNITED STATES
+VIETNAM
+
diff --git a/regression-test/data/trino_p0/sql/join/left_outer_join_inner_join_order.out b/regression-test/data/trino_p0/sql/join/left_outer_join_inner_join_order.out
new file mode 100644
index 0000000000..ea9cb65e3a
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/left_outer_join_inner_join_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !left_outer_join_inner_join_order --
+1	ARGENTINA	AMERICA
+1	BRAZIL	ASIA
+1	CANADA	EUROPE
+1	PERU	\N
+1	UNITED STATES	\N
+2	CHINA	\N
+2	INDIA	\N
+2	INDONESIA	\N
+2	JAPAN	\N
+2	VIETNAM	\N
+3	FRANCE	\N
+3	GERMANY	\N
+3	ROMANIA	\N
+3	RUSSIA	\N
+3	UNITED KINGDOM	\N
+4	EGYPT	MIDDLE EAST
+4	IRAN	\N
+4	IRAQ	\N
+4	JORDAN	\N
+4	SAUDI ARABIA	\N
+
diff --git a/regression-test/data/trino_p0/sql/join/left_outer_join_order.out b/regression-test/data/trino_p0/sql/join/left_outer_join_order.out
new file mode 100644
index 0000000000..b30268a156
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/left_outer_join_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !left_outer_join_order --
+ALGERIA	AFRICA
+ARGENTINA	AMERICA
+BRAZIL	ASIA
+CANADA	EUROPE
+CHINA	\N
+EGYPT	MIDDLE EAST
+ETHIOPIA	\N
+FRANCE	\N
+GERMANY	\N
+INDIA	\N
+INDONESIA	\N
+IRAN	\N
+IRAQ	\N
+JAPAN	\N
+JORDAN	\N
+KENYA	\N
+MOROCCO	\N
+MOZAMBIQUE	\N
+PERU	\N
+ROMANIA	\N
+RUSSIA	\N
+SAUDI ARABIA	\N
+UNITED KINGDOM	\N
+UNITED STATES	\N
+VIETNAM	\N
+
diff --git a/regression-test/data/trino_p0/sql/join/right_join_left_join_order.out b/regression-test/data/trino_p0/sql/join/right_join_left_join_order.out
new file mode 100644
index 0000000000..c9371d6266
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/right_join_left_join_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !right_join_left_join_order --
+\N	ALGERIA	AFRICA
+\N	ETHIOPIA	\N
+\N	KENYA	\N
+\N	MOROCCO	\N
+\N	MOZAMBIQUE	\N
+1	ARGENTINA	AMERICA
+1	BRAZIL	ASIA
+1	CANADA	EUROPE
+1	PERU	\N
+1	UNITED STATES	\N
+2	CHINA	\N
+2	INDIA	\N
+2	INDONESIA	\N
+2	JAPAN	\N
+2	VIETNAM	\N
+3	FRANCE	\N
+3	GERMANY	\N
+3	ROMANIA	\N
+3	RUSSIA	\N
+3	UNITED KINGDOM	\N
+4	EGYPT	MIDDLE EAST
+4	IRAN	\N
+4	IRAQ	\N
+4	JORDAN	\N
+4	SAUDI ARABIA	\N
+
diff --git a/regression-test/data/trino_p0/sql/join/right_join_null_data_order.out b/regression-test/data/trino_p0/sql/join/right_join_null_data_order.out
new file mode 100644
index 0000000000..23605ecc5e
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/right_join_null_data_order.out
@@ -0,0 +1,17 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !right_join_null_data_order --
+\N	\N	Finance	3000
+\N	\N	Marketing	4000
+\N	\N	PR	3000
+\N	\N	Sales	3500
+BRAZIL	2	R&D	5000
+BRAZIL	2	R&D	5000
+EGYPT	4	IT	4000
+ETHIOPIA	5	HR	2000
+ETHIOPIA	5	HR	2000
+GERMANY	7	CustomerService	2300
+INDIA	8	Production	2400
+INDONESIA	9	Quality	3400
+IRAQ	11	\N	\N
+JAPAN	12	\N	\N
+
diff --git a/regression-test/data/trino_p0/sql/join/right_outer_join_order.out b/regression-test/data/trino_p0/sql/join/right_outer_join_order.out
new file mode 100644
index 0000000000..d85cf40e6a
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/right_outer_join_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !right_outer_join_order --
+ALGERIA	AFRICA
+ARGENTINA	AMERICA
+BRAZIL	ASIA
+CANADA	EUROPE
+CHINA	\N
+EGYPT	MIDDLE EAST
+ETHIOPIA	\N
+FRANCE	\N
+GERMANY	\N
+INDIA	\N
+INDONESIA	\N
+IRAN	\N
+IRAQ	\N
+JAPAN	\N
+JORDAN	\N
+KENYA	\N
+MOROCCO	\N
+MOZAMBIQUE	\N
+PERU	\N
+ROMANIA	\N
+RUSSIA	\N
+SAUDI ARABIA	\N
+UNITED KINGDOM	\N
+UNITED STATES	\N
+VIETNAM	\N
+
diff --git a/regression-test/data/trino_p0/sql/join/sub_select_in_order.out b/regression-test/data/trino_p0/sql/join/sub_select_in_order.out
new file mode 100644
index 0000000000..25eb0e0f13
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/join/sub_select_in_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sub_select_in_order --
+ALGERIA
+ARGENTINA
+BRAZIL
+CANADA
+EGYPT
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByAggregate_order.out b/regression-test/data/trino_p0/sql/order_by/orderByAggregate_order.out
new file mode 100644
index 0000000000..00459ae4e8
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByAggregate_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByAggregate_order --
+0	0	ALGERIA
+0	14	KENYA
+0	15	MOROCCO
+0	16	MOZAMBIQUE
+0	5	ETHIOPIA
+1	1	ARGENTINA
+1	17	PERU
+1	2	BRAZIL
+1	3	CANADA
+2	12	JAPAN
+2	18	CHINA
+2	8	INDIA
+2	9	INDONESIA
+3	19	ROMANIA
+3	6	FRANCE
+3	7	GERMANY
+4	10	IRAN
+4	11	IRAQ
+4	13	JORDAN
+4	4	EGYPT
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByAliasSameAsColumn_order.out b/regression-test/data/trino_p0/sql/order_by/orderByAliasSameAsColumn_order.out
new file mode 100644
index 0000000000..41e06b170b
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByAliasSameAsColumn_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByAliasSameAsColumn_order --
+0	0	ALGERIA
+0	14	KENYA
+0	15	MOROCCO
+0	16	MOZAMBIQUE
+0	5	ETHIOPIA
+1	1	ARGENTINA
+1	17	PERU
+1	2	BRAZIL
+1	3	CANADA
+2	12	JAPAN
+2	18	CHINA
+2	8	INDIA
+2	9	INDONESIA
+3	19	ROMANIA
+3	6	FRANCE
+3	7	GERMANY
+4	10	IRAN
+4	11	IRAQ
+4	13	JORDAN
+4	4	EGYPT
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByDistinctColumnDesc_order.out b/regression-test/data/trino_p0/sql/order_by/orderByDistinctColumnDesc_order.out
new file mode 100644
index 0000000000..11387e0c72
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByDistinctColumnDesc_order.out
@@ -0,0 +1,15 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByDistinctColumnDesc_order --
+Brand#11
+Brand#13
+Brand#24
+Brand#25
+Brand#32
+Brand#33
+Brand#34
+Brand#42
+Brand#43
+Brand#44
+Brand#54
+Brand#55
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByExpression_order.out b/regression-test/data/trino_p0/sql/order_by/orderByExpression_order.out
new file mode 100644
index 0000000000..11db1c85ec
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByExpression_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByExpression_order --
+1034.9175	634
+1048.294375	301
+1054.48875	482
+1066.293125	691
+1069.225625	328
+1106.583125	862
+1135.015625	250
+1174.21125	1412
+1336.975625	1436
+1372.973125	392
+1382.3975	1400
+1400.130625	1318
+1401.07625	608
+1420.095	1120
+1443.140625	520
+1490.676875	215
+1494.40625	797
+929.570625	334
+982.100625	1351
+987.094375	862
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByMixOfColumnsAscDesc_order.out b/regression-test/data/trino_p0/sql/order_by/orderByMixOfColumnsAscDesc_order.out
new file mode 100644
index 0000000000..a6e07bbe9f
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByMixOfColumnsAscDesc_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByMixOfColumnsAscDesc_order --
+1998-07-31	1-URGENT	1480
+1998-07-31	1-URGENT	613
+1998-07-31	2-HIGH	226
+1998-07-31	2-HIGH	28
+1998-07-31	3-MEDIUM	1495
+1998-07-31	4-NOT SPECIFIED	425
+1998-07-31	5-LOW	382
+1998-07-31	5-LOW	758
+1998-08-01	1-URGENT	1114
+1998-08-01	1-URGENT	1228
+1998-08-01	3-MEDIUM	529
+1998-08-01	3-MEDIUM	565
+1998-08-01	3-MEDIUM	865
+1998-08-02	1-URGENT	10
+1998-08-02	3-MEDIUM	1033
+1998-08-02	3-MEDIUM	1168
+1998-08-02	4-NOT SPECIFIED	328
+1998-08-02	4-NOT SPECIFIED	866
+1998-08-02	5-LOW	1489
+1998-08-02	5-LOW	157
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedAggregate_order.out b/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedAggregate_order.out
new file mode 100644
index 0000000000..f821a2ffb9
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedAggregate_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByNonProjectedAggregate_order --
+1382.124533679	Manufacturer#1
+1396.94395	Manufacturer#4
+1400.375984848	Manufacturer#2
+1410.254821429	Manufacturer#5
+1411.609319249	Manufacturer#3
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedColumns_order.out b/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedColumns_order.out
new file mode 100644
index 0000000000..cd0d2e2a19
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedColumns_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByNonProjectedColumns_order --
+0	ALGERIA
+1	ARGENTINA
+10	IRAN
+11	IRAQ
+12	JAPAN
+13	JORDAN
+14	KENYA
+15	MOROCCO
+16	MOZAMBIQUE
+17	PERU
+18	CHINA
+19	ROMANIA
+2	BRAZIL
+20	SAUDI ARABIA
+21	VIETNAM
+22	RUSSIA
+23	UNITED KINGDOM
+24	UNITED STATES
+3	CANADA
+4	EGYPT
+5	ETHIOPIA
+6	FRANCE
+7	GERMANY
+8	INDIA
+9	INDONESIA
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedExpression_order.out b/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedExpression_order.out
new file mode 100644
index 0000000000..7a009c2ba9
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByNonProjectedExpression_order.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByNonProjectedExpression_order --
+1120	F
+1318	O
+1351	F
+1400	O
+1412	O
+1436	F
+215	F
+250	F
+301	O
+328	O
+334	F
+392	F
+482	O
+520	F
+608	O
+634	O
+691	F
+797	F
+862	F
+862	O
+
diff --git a/regression-test/data/trino_p0/sql/order_by/orderByOrdinals_order.out b/regression-test/data/trino_p0/sql/order_by/orderByOrdinals_order.out
new file mode 100644
index 0000000000..0eac4517e7
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/orderByOrdinals_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !orderByOrdinals_order --
+0	0
+0	14
+0	15
+0	16
+0	5
+1	1
+1	17
+1	2
+1	24
+1	3
+2	12
+2	18
+2	21
+2	8
+2	9
+3	19
+3	22
+3	23
+3	6
+3	7
+4	10
+4	11
+4	13
+4	20
+4	4
+
diff --git a/regression-test/data/trino_p0/sql/order_by/runOrderByWithFromSubq_order.out b/regression-test/data/trino_p0/sql/order_by/runOrderByWithFromSubq_order.out
new file mode 100644
index 0000000000..08efdcc793
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/order_by/runOrderByWithFromSubq_order.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !runOrderByWithFromSubq_order --
+15	0	MOROCCO
+16	0	MOZAMBIQUE
+17	1	PERU
+18	2	CHINA
+19	3	ROMANIA
+
diff --git a/regression-test/data/trino_p0/sql/union/unionAllSameTable_order.out b/regression-test/data/trino_p0/sql/union/unionAllSameTable_order.out
new file mode 100644
index 0000000000..ab5cebac0c
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/union/unionAllSameTable_order.out
@@ -0,0 +1,53 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unionAllSameTable_order --
+0	ALGERIA	0	 haggle. carefully final deposits detect slyly agai
+0	ALGERIA	0	 haggle. carefully final deposits detect slyly agai
+1	ARGENTINA	1	al foxes promise slyly according to the regular accounts. bold requests alon
+1	ARGENTINA	1	al foxes promise slyly according to the regular accounts. bold requests alon
+10	IRAN	4	efully alongside of the slyly final dependencies. 
+10	IRAN	4	efully alongside of the slyly final dependencies. 
+11	IRAQ	4	nic deposits boost atop the quickly final requests? quickly regula
+11	IRAQ	4	nic deposits boost atop the quickly final requests? quickly regula
+12	JAPAN	2	ously. final, express gifts cajole a
+12	JAPAN	2	ously. final, express gifts cajole a
+13	JORDAN	4	ic deposits are blithely about the carefully regular pa
+13	JORDAN	4	ic deposits are blithely about the carefully regular pa
+14	KENYA	0	 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
+14	KENYA	0	 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
+15	MOROCCO	0	rns. blithely bold courts among the closely regular packages use furiously bold platelets?
+15	MOROCCO	0	rns. blithely bold courts among the closely regular packages use furiously bold platelets?
+16	MOZAMBIQUE	0	s. ironic, unusual asymptotes wake blithely r
+16	MOZAMBIQUE	0	s. ironic, unusual asymptotes wake blithely r
+17	PERU	1	platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
+17	PERU	1	platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
+18	CHINA	2	c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
+18	CHINA	2	c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
+19	ROMANIA	3	ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
+19	ROMANIA	3	ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
+2	BRAZIL	1	y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special 
+2	BRAZIL	1	y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special 
+20	SAUDI ARABIA	4	ts. silent requests haggle. closely express packages sleep across the blithely
+20	SAUDI ARABIA	4	ts. silent requests haggle. closely express packages sleep across the blithely
+21	VIETNAM	2	hely enticingly express accounts. even, final 
+21	VIETNAM	2	hely enticingly express accounts. even, final 
+22	RUSSIA	3	 requests against the platelets use never according to the quickly regular pint
+22	RUSSIA	3	 requests against the platelets use never according to the quickly regular pint
+23	UNITED KINGDOM	3	eans boost carefully special requests. accounts are. carefull
+23	UNITED KINGDOM	3	eans boost carefully special requests. accounts are. carefull
+24	UNITED STATES	1	y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
+24	UNITED STATES	1	y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
+3	CANADA	1	eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
+3	CANADA	1	eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
+4	EGYPT	4	y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
+4	EGYPT	4	y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
+5	ETHIOPIA	0	ven packages wake quickly. regu
+5	ETHIOPIA	0	ven packages wake quickly. regu
+6	FRANCE	3	refully final requests. regular, ironi
+6	FRANCE	3	refully final requests. regular, ironi
+7	GERMANY	3	l platelets. regular accounts x-ray: unusual, regular acco
+7	GERMANY	3	l platelets. regular accounts x-ray: unusual, regular acco
+8	INDIA	2	ss excuses cajole slyly across the packages. deposits print aroun
+8	INDIA	2	ss excuses cajole slyly across the packages. deposits print aroun
+9	INDONESIA	2	 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
+9	INDONESIA	2	 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
+
diff --git a/regression-test/data/trino_p0/sql/union/unionDistinctSameTable_order.out b/regression-test/data/trino_p0/sql/union/unionDistinctSameTable_order.out
new file mode 100644
index 0000000000..76942cc0ee
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/union/unionDistinctSameTable_order.out
@@ -0,0 +1,28 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unionDistinctSameTable_order --
+0	ALGERIA	0	 haggle. carefully final deposits detect slyly agai
+1	ARGENTINA	1	al foxes promise slyly according to the regular accounts. bold requests alon
+10	IRAN	4	efully alongside of the slyly final dependencies. 
+11	IRAQ	4	nic deposits boost atop the quickly final requests? quickly regula
+12	JAPAN	2	ously. final, express gifts cajole a
+13	JORDAN	4	ic deposits are blithely about the carefully regular pa
+14	KENYA	0	 pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
+15	MOROCCO	0	rns. blithely bold courts among the closely regular packages use furiously bold platelets?
+16	MOZAMBIQUE	0	s. ironic, unusual asymptotes wake blithely r
+17	PERU	1	platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
+18	CHINA	2	c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
+19	ROMANIA	3	ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
+2	BRAZIL	1	y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special 
+20	SAUDI ARABIA	4	ts. silent requests haggle. closely express packages sleep across the blithely
+21	VIETNAM	2	hely enticingly express accounts. even, final 
+22	RUSSIA	3	 requests against the platelets use never according to the quickly regular pint
+23	UNITED KINGDOM	3	eans boost carefully special requests. accounts are. carefull
+24	UNITED STATES	1	y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be
+3	CANADA	1	eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
+4	EGYPT	4	y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
+5	ETHIOPIA	0	ven packages wake quickly. regu
+6	FRANCE	3	refully final requests. regular, ironi
+7	GERMANY	3	l platelets. regular accounts x-ray: unusual, regular acco
+8	INDIA	2	ss excuses cajole slyly across the packages. deposits print aroun
+9	INDONESIA	2	 slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
+
diff --git a/regression-test/data/trino_p0/sql/union/unionMoreThanTwoTables_order.out b/regression-test/data/trino_p0/sql/union/unionMoreThanTwoTables_order.out
new file mode 100644
index 0000000000..56680f355a
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/union/unionMoreThanTwoTables_order.out
@@ -0,0 +1,34 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unionMoreThanTwoTables_order --
+0
+0
+0
+0
+0
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+25
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+47
+50
+58
+68
+77
+
diff --git a/regression-test/data/trino_p0/sql/union/unionOrderBy_order.out b/regression-test/data/trino_p0/sql/union/unionOrderBy_order.out
new file mode 100644
index 0000000000..d2f9a6a33f
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/union/unionOrderBy_order.out
@@ -0,0 +1,34 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unionOrderBy_order --
+0
+0
+0
+0
+0
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+25
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+47
+50
+58
+68
+77
+
diff --git a/regression-test/data/trino_p0/sql/union/unionWithAggregation_order.out b/regression-test/data/trino_p0/sql/union/unionWithAggregation_order.out
new file mode 100644
index 0000000000..821d71fc63
--- /dev/null
+++ b/regression-test/data/trino_p0/sql/union/unionWithAggregation_order.out
@@ -0,0 +1,9 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !unionWithAggregation_order --
+25
+47
+50
+58
+68
+77
+
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
index 56f2c24106..1b21ebe639 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
@@ -418,9 +418,13 @@ class Config {
         // e.g.
         // suites/tpcds_sf1/load.groovy
         // suites/tpcds_sf1/sql/q01.sql
+        // suites/tpcds_sf1/sql/dir/q01.sql
         if (dir.indexOf(File.separator + "sql", dir.length() - 4) > 0 && dir.endsWith("sql")) {
             dir = dir.substring(0, dir.indexOf(File.separator + "sql", dir.length() - 4))
         }
+        if (dir.indexOf(File.separator + "sql" + File.separator) > 0) {
+            dir = dir.substring(0, dir.indexOf(File.separator + "sql" + File.separator))
+        }
 
         dir = dir.replace('-', '_')
 
diff --git a/regression-test/suites/trino_p0/ddl/nation.sql b/regression-test/suites/trino_p0/ddl/nation.sql
new file mode 100644
index 0000000000..86d7da4a61
--- /dev/null
+++ b/regression-test/suites/trino_p0/ddl/nation.sql
@@ -0,0 +1,8 @@
+CREATE TABLE `nation` (
+  `n_nationkey` integer NOT NULL,
+  `n_name` char(25) NOT NULL,
+  `n_regionkey` integer NOT NULL,
+  `n_comment` varchar(152)
+)
+DISTRIBUTED BY HASH(`n_nationkey`) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
diff --git a/regression-test/suites/trino_p0/ddl/orders.sql b/regression-test/suites/trino_p0/ddl/orders.sql
new file mode 100644
index 0000000000..dbf1b7c320
--- /dev/null
+++ b/regression-test/suites/trino_p0/ddl/orders.sql
@@ -0,0 +1,13 @@
+CREATE TABLE `orders` (
+  `o_orderkey` bigint(20) NOT NULL,
+  `o_custkey` int(11) NOT NULL,
+  `o_orderstatus` varchar(1) NOT NULL,
+  `o_totalprice` decimal(12,2) NOT NULL,
+  `o_orderdate` date NOT NULL,
+  `o_orderprioriTY` varchar(15) NOT NULL,
+  `o_clerk` varchar(15) NOT NULL,
+  `o_shipprioritY` int(11) NOT NULL,
+  `o_comment` varchar(79) NOT NULL
+  ) 
+DISTRIBUTED BY HASH(`o_orderkey`) BUCKETS 10
+PROPERTIES("replication_num" = "1");
diff --git a/regression-test/suites/trino_p0/ddl/part.sql b/regression-test/suites/trino_p0/ddl/part.sql
new file mode 100644
index 0000000000..db44cdc6a0
--- /dev/null
+++ b/regression-test/suites/trino_p0/ddl/part.sql
@@ -0,0 +1,13 @@
+CREATE TABLE `part` (
+  `p_partkey` integer NOT NULL,
+  `p_name` varchar(55) NOT NULL,
+  `p_mfgr` char(25) NOT NULL,
+  `p_brand` char(10) NOT NULL,
+  `p_type` varchar(25) NOT NULL,
+  `p_size` integer NOT NULL,
+  `p_container` char(10) NOT NULL,
+  `p_retailprice` decimal(12, 2) NOT NULL,
+  `p_comment` varchar(23) NOT NULL
+)
+DISTRIBUTED BY HASH(`p_partkey`) BUCKETS 32
+PROPERTIES ("replication_num" = "1");
diff --git a/regression-test/suites/trino_p0/ddl/region.sql b/regression-test/suites/trino_p0/ddl/region.sql
new file mode 100644
index 0000000000..8a8cc1f942
--- /dev/null
+++ b/regression-test/suites/trino_p0/ddl/region.sql
@@ -0,0 +1,7 @@
+CREATE TABLE `region` (
+  `r_regionkey` int(11) NOT NULL,
+  `r_name` varchar(25) NOT NULL,
+  `r_comment` varchar(152) DEFAULT NULL
+  )
+DISTRIBUTED BY HASH(`r_regionkey`) BUCKETS 10
+PROPERTIES("replication_num" = "1");
diff --git a/regression-test/suites/trino_p0/ddl/workers.sql b/regression-test/suites/trino_p0/ddl/workers.sql
new file mode 100644
index 0000000000..0fa5fca86e
--- /dev/null
+++ b/regression-test/suites/trino_p0/ddl/workers.sql
@@ -0,0 +1,12 @@
+CREATE TABLE `workers` (
+  id_employee INT,
+  first_name VARCHAR(32),
+  last_name VARCHAR(32),
+  date_of_employment DATE,
+  department TINYINT(1),
+  id_department INT,
+  name VARCHAR(32),
+  salary INT
+)
+DISTRIBUTED BY HASH(`id_employee`) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
diff --git a/regression-test/suites/trino_p0/load.groovy b/regression-test/suites/trino_p0/load.groovy
new file mode 100644
index 0000000000..7b13281051
--- /dev/null
+++ b/regression-test/suites/trino_p0/load.groovy
@@ -0,0 +1,70 @@
+// 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.
+
+// The cases is copied from https://github.com/trinodb/trino/tree/master
+// /testing/trino-product-tests/src/main/resources/sql-tests/testcases
+// and modified by Doris.
+
+suite("load") {
+    def tables=["nation", "region", "part", "workers", "orders"]
+
+    for (String table in tables) {
+        sql """ DROP TABLE IF EXISTS $table """
+    }
+
+    // prepare tables
+    for (String table in tables) {
+        sql new File("""${context.file.parent}/ddl/${table}.sql""").text
+    }
+
+    for (String tableName in tables) {
+        streamLoad {
+            // you can skip declare db, because a default db already specify in ${DORIS_HOME}/conf/regression-conf.groovy
+            // db 'regression_test'
+            table tableName 
+
+            // default label is UUID:
+            // set 'label' UUID.randomUUID().toString()
+
+            // default column_separator is specify in doris fe config, usually is '\t'.
+            // this line change to '|'
+            set 'column_separator', '|'
+            set 'compress_type', 'GZ'
+
+            // relate to ${DORIS_HOME}/regression-test/data/demo/streamload_input.csv.
+            // also, you can stream load a http stream, e.g. http://xxx/some.csv
+            file """${getS3Url() + '/regression/tpch/sf0.01/' + tableName}.csv.gz"""
+
+            time 10000 // limit inflight 10s
+
+            // stream load action will check result, include Success status, and NumberTotalRows == NumberLoadedRows
+
+            // if declared a check callback, the default check condition will ignore.
+            // So you must check all condition
+            check { result, exception, startTime, endTime ->
+                if (exception != null) {
+                    throw exception
+                }
+                log.info("Stream load result: ${result}".toString())
+                def json = parseJson(result)
+                assertEquals("success", json.Status.toLowerCase())
+                assertEquals(json.NumberTotalRows, json.NumberLoadedRows)
+                assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0)
+            }
+        }
+    }
+}
diff --git a/regression-test/suites/trino_p0/sql/distinct/multipleDistinctAgg_order.sql b/regression-test/suites/trino_p0/sql/distinct/multipleDistinctAgg_order.sql
new file mode 100644
index 0000000000..36bdcc1859
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/multipleDistinctAgg_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(DISTINCT n_regionkey), COUNT(DISTINCT n_name), MIN(DISTINCT n_nationkey) FROM nation
diff --git a/regression-test/suites/trino_p0/sql/distinct/repeatedDistinctAgg_order.sql b/regression-test/suites/trino_p0/sql/distinct/repeatedDistinctAgg_order.sql
new file mode 100644
index 0000000000..7b26b077bf
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/repeatedDistinctAgg_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(DISTINCT n_regionkey), COUNT(DISTINCT n_regionkey) FROM nation
diff --git a/regression-test/suites/trino_p0/sql/distinct/withCount_order.sql b/regression-test/suites/trino_p0/sql/distinct/withCount_order.sql
new file mode 100644
index 0000000000..e7c2edf0ec
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/withCount_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(DISTINCT n_regionkey), COUNT(*) FROM nation
diff --git a/regression-test/suites/trino_p0/sql/distinct/withDuplicates_order.sql b/regression-test/suites/trino_p0/sql/distinct/withDuplicates_order.sql
new file mode 100644
index 0000000000..1f69c704b6
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/withDuplicates_order.sql
@@ -0,0 +1 @@
+SELECT DISTINCT n_regionkey FROM nation
diff --git a/regression-test/suites/trino_p0/sql/distinct/withGroupByDistinctAgg_order.sql b/regression-test/suites/trino_p0/sql/distinct/withGroupByDistinctAgg_order.sql
new file mode 100644
index 0000000000..2d99734cf0
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/withGroupByDistinctAgg_order.sql
@@ -0,0 +1,3 @@
+SELECT n_regionkey, COUNT(DISTINCT n_name) FROM nation
+GROUP BY n_regionkey
+HAVING n_regionkey < 4
diff --git a/regression-test/suites/trino_p0/sql/distinct/withGroupBy_order.sql b/regression-test/suites/trino_p0/sql/distinct/withGroupBy_order.sql
new file mode 100644
index 0000000000..d639bc1f55
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/withGroupBy_order.sql
@@ -0,0 +1,5 @@
+/*
+SELECT DISTINCT n_regionkey, COUNT(*) FROM nation
+WHERE n_nationkey > 0
+GROUP BY n_regionkey
+*/
diff --git a/regression-test/suites/trino_p0/sql/distinct/withNoDuplicates_order.sql b/regression-test/suites/trino_p0/sql/distinct/withNoDuplicates_order.sql
new file mode 100644
index 0000000000..f0c214350e
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/withNoDuplicates_order.sql
@@ -0,0 +1 @@
+SELECT DISTINCT r_name FROM region
diff --git a/regression-test/suites/trino_p0/sql/distinct/withOrderBy_order.sql b/regression-test/suites/trino_p0/sql/distinct/withOrderBy_order.sql
new file mode 100644
index 0000000000..da73571ba2
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/distinct/withOrderBy_order.sql
@@ -0,0 +1 @@
+SELECT DISTINCT n_regionkey FROM nation ORDER BY n_regionkey
diff --git a/regression-test/suites/trino_p0/sql/group_by/runAggrWithoutGroupBy_order.sql b/regression-test/suites/trino_p0/sql/group_by/runAggrWithoutGroupBy_order.sql
new file mode 100644
index 0000000000..62c3ed4b17
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runAggrWithoutGroupBy_order.sql
@@ -0,0 +1 @@
+select count(*), count(n_regionkey), min(n_regionkey), max(n_regionkey), sum(n_regionkey) from nation
diff --git a/regression-test/suites/trino_p0/sql/group_by/runAggregatesGroupByOridnalAndHaving_order.sql b/regression-test/suites/trino_p0/sql/group_by/runAggregatesGroupByOridnalAndHaving_order.sql
new file mode 100644
index 0000000000..5fe30a4567
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runAggregatesGroupByOridnalAndHaving_order.sql
@@ -0,0 +1 @@
+select n_regionkey, count(*) from nation group by 1 having sum(n_regionkey) > 5 and sum(n_regionkey) < 20
diff --git a/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithGroupByOrdinal_order.sql b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithGroupByOrdinal_order.sql
new file mode 100644
index 0000000000..ae79ace676
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithGroupByOrdinal_order.sql
@@ -0,0 +1 @@
+select n_regionkey, count(*), sum(n_nationkey) from nation group by 1
diff --git a/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithGroupByWithFalseWherePredicate_order.sql b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithGroupByWithFalseWherePredicate_order.sql
new file mode 100644
index 0000000000..97182abf4d
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithGroupByWithFalseWherePredicate_order.sql
@@ -0,0 +1 @@
+select count(*), sum(n_nationkey) from nation where 1=2 group by n_regionkey
diff --git a/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithWherePredicatesAndGroupByOrdinal_order.sql b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithWherePredicatesAndGroupByOrdinal_order.sql
new file mode 100644
index 0000000000..224ce51790
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithWherePredicatesAndGroupByOrdinal_order.sql
@@ -0,0 +1 @@
+select n_regionkey, count(*), sum(n_regionkey) from nation where n_regionkey > 2 group by 1
diff --git a/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithoutGroupByButWithPredicates_order.sql b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithoutGroupByButWithPredicates_order.sql
new file mode 100644
index 0000000000..f9494da5fe
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runAggregatesWithoutGroupByButWithPredicates_order.sql
@@ -0,0 +1 @@
+select count(*), sum(n_nationkey) from nation where 1=2
diff --git a/regression-test/suites/trino_p0/sql/group_by/runConstantGroupBy_order.sql b/regression-test/suites/trino_p0/sql/group_by/runConstantGroupBy_order.sql
new file mode 100644
index 0000000000..d90f03a34d
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runConstantGroupBy_order.sql
@@ -0,0 +1 @@
+select 2 from nation group by 1
diff --git a/regression-test/suites/trino_p0/sql/group_by/runCountNull_order.sql b/regression-test/suites/trino_p0/sql/group_by/runCountNull_order.sql
new file mode 100644
index 0000000000..edd1ae2c7e
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runCountNull_order.sql
@@ -0,0 +1 @@
+SELECT n_regionkey, COUNT(null) FROM nation WHERE n_nationkey > 5 GROUP BY n_regionkey
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingOnEmptyResult_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingOnEmptyResult_order.sql
new file mode 100644
index 0000000000..0b3c1cacd1
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingOnEmptyResult_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(n_regionkey) FROM nation WHERE 1=2 HAVING SUM(n_regionkey) IS NULL
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingOutsideSubq_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingOutsideSubq_order.sql
new file mode 100644
index 0000000000..874b4719d3
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingOutsideSubq_order.sql
@@ -0,0 +1 @@
+SELECT n_regionkey FROM (SELECT n_regionkey, COUNT(*) cnt FROM nation GROUP BY n_regionkey) t GROUP BY n_regionkey HAVING n_regionkey < 3 AND COUNT(cnt) > 0
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingWithAggExpr_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingWithAggExpr_order.sql
new file mode 100644
index 0000000000..af976848d3
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingWithAggExpr_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(*) FROM workers HAVING SUM(salary * 2)/COUNT(*) > 0
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingWithExpr_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingWithExpr_order.sql
new file mode 100644
index 0000000000..9a46942cc7
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingWithExpr_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(*) FROM workers GROUP BY id_department * 2 HAVING SUM(log10(salary + 1)) > 0
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingWithGrpExpr_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingWithGrpExpr_order.sql
new file mode 100644
index 0000000000..50e00bdf97
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingWithGrpExpr_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(*) FROM workers GROUP BY salary * id_department HAVING salary * id_department IS NOT NULL
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingWithMultipleAggs_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingWithMultipleAggs_order.sql
new file mode 100644
index 0000000000..cebbabd1cc
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingWithMultipleAggs_order.sql
@@ -0,0 +1 @@
+SELECT p_type, COUNT(*) FROM part GROUP BY p_type HAVING COUNT(*) > 20 and AVG(p_retailprice) > 1000
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingWithNullCheck_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingWithNullCheck_order.sql
new file mode 100644
index 0000000000..8e4b6775f9
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingWithNullCheck_order.sql
@@ -0,0 +1 @@
+SELECT first_name, COUNT(*) FROM workers GROUP BY first_name HAVING first_name IS NULL
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingWithOrderBy_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingWithOrderBy_order.sql
new file mode 100644
index 0000000000..36e5371c13
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingWithOrderBy_order.sql
@@ -0,0 +1 @@
+SELECT id_department, COUNT(*) FROM workers GROUP BY id_department HAVING COUNT(*) > 1 ORDER BY id_department desc
diff --git a/regression-test/suites/trino_p0/sql/group_by/runHavingWithoutGroupBy_order.sql b/regression-test/suites/trino_p0/sql/group_by/runHavingWithoutGroupBy_order.sql
new file mode 100644
index 0000000000..f32cd7e3e2
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runHavingWithoutGroupBy_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(*) FROM nation HAVING COUNT(*) > 20
diff --git a/regression-test/suites/trino_p0/sql/group_by/runMultipleGroupBy_order.sql b/regression-test/suites/trino_p0/sql/group_by/runMultipleGroupBy_order.sql
new file mode 100644
index 0000000000..cc508c055a
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/group_by/runMultipleGroupBy_order.sql
@@ -0,0 +1 @@
+SELECT COUNT(*), n_regionkey, n_nationkey FROM nation WHERE n_regionkey < 2 GROUP BY n_nationkey, n_regionkey ORDER BY n_regionkey, n_nationkey DESC
diff --git a/regression-test/suites/trino_p0/sql/join/cross_join_order.sql b/regression-test/suites/trino_p0/sql/join/cross_join_order.sql
new file mode 100644
index 0000000000..b059206782
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/cross_join_order.sql
@@ -0,0 +1,2 @@
+select n_name, r_name from nation cross join region
+
diff --git a/regression-test/suites/trino_p0/sql/join/explicit_inner_implicit_same_tables_order.sql b/regression-test/suites/trino_p0/sql/join/explicit_inner_implicit_same_tables_order.sql
new file mode 100644
index 0000000000..dcad57a3b4
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/explicit_inner_implicit_same_tables_order.sql
@@ -0,0 +1,7 @@
+SELECT p_partkey,
+       n_name
+FROM   nation
+       INNER JOIN part
+              ON n_nationkey = p_partkey
+WHERE  n_name < p_name
+
diff --git a/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_columns_order.sql b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_columns_order.sql
new file mode 100644
index 0000000000..e8b9f52f1f
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_columns_order.sql
@@ -0,0 +1,2 @@
+select n_name, r_name from nation join region on nation.n_regionkey = region.r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_count_order.sql b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_count_order.sql
new file mode 100644
index 0000000000..d83acdb40e
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_count_order.sql
@@ -0,0 +1,2 @@
+select count(*) from nation join region on nation.n_regionkey = region.r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_star_order.sql b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_star_order.sql
new file mode 100644
index 0000000000..a9bda67c7f
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_star_order.sql
@@ -0,0 +1,2 @@
+select * from nation join region on nation.n_regionkey = region.r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_where_order.sql b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_where_order.sql
new file mode 100644
index 0000000000..ae8811e746
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/explicit_inner_join_select_where_order.sql
@@ -0,0 +1,2 @@
+select n_name, r_name from nation join region on nation.n_regionkey = region.r_regionkey where n_name > 'E'
+
diff --git a/regression-test/suites/trino_p0/sql/join/explicit_left_implicit_same_tables_order.sql b/regression-test/suites/trino_p0/sql/join/explicit_left_implicit_same_tables_order.sql
new file mode 100644
index 0000000000..95b6df8572
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/explicit_left_implicit_same_tables_order.sql
@@ -0,0 +1,7 @@
+SELECT p_partkey,
+       n_name
+FROM   nation
+       LEFT JOIN part
+              ON n_nationkey = p_partkey
+WHERE  n_name < p_name 
+
diff --git a/regression-test/suites/trino_p0/sql/join/implicit_explicit_inner_order.sql b/regression-test/suites/trino_p0/sql/join/implicit_explicit_inner_order.sql
new file mode 100644
index 0000000000..d749087077
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/implicit_explicit_inner_order.sql
@@ -0,0 +1,9 @@
+SELECT p_partkey,
+       n_name,
+       r_name
+FROM   nation,
+       region
+       JOIN part
+         ON r_regionkey = p_partkey
+WHERE  n_nationkey = r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/implicit_explicit_left_order.sql b/regression-test/suites/trino_p0/sql/join/implicit_explicit_left_order.sql
new file mode 100644
index 0000000000..f6b4ab8e37
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/implicit_explicit_left_order.sql
@@ -0,0 +1,9 @@
+SELECT p_partkey,
+       n_name,
+       r_name
+FROM   nation,
+       region
+       LEFT OUTER JOIN part
+         ON r_regionkey = p_partkey
+WHERE  n_nationkey = r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/implicit_inner_join_table_alias_order.sql b/regression-test/suites/trino_p0/sql/join/implicit_inner_join_table_alias_order.sql
new file mode 100644
index 0000000000..222f486563
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/implicit_inner_join_table_alias_order.sql
@@ -0,0 +1,2 @@
+select n.n_name, r.r_name from nation n, region r where n.n_regionkey = r.r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/implicit_less_then_order.sql b/regression-test/suites/trino_p0/sql/join/implicit_less_then_order.sql
new file mode 100644
index 0000000000..1a92088f0f
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/implicit_less_then_order.sql
@@ -0,0 +1,5 @@
+SELECT n_name,
+       r_name
+FROM   nation,
+       region
+WHERE  r_regionkey > n_nationkey 
diff --git a/regression-test/suites/trino_p0/sql/join/implicit_not_equal_order.sql b/regression-test/suites/trino_p0/sql/join/implicit_not_equal_order.sql
new file mode 100644
index 0000000000..c7fc4de521
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/implicit_not_equal_order.sql
@@ -0,0 +1,6 @@
+SELECT n_name,
+       r_name
+FROM   nation,
+       region
+WHERE  r_regionkey != n_nationkey 
+
diff --git a/regression-test/suites/trino_p0/sql/join/inner_join_null_data_order.sql b/regression-test/suites/trino_p0/sql/join/inner_join_null_data_order.sql
new file mode 100644
index 0000000000..80f56f3caa
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/inner_join_null_data_order.sql
@@ -0,0 +1 @@
+select n_name, department, name, salary from nation, workers where n_nationkey = department
diff --git a/regression-test/suites/trino_p0/sql/join/inner_join_right_outer_join_order.sql b/regression-test/suites/trino_p0/sql/join/inner_join_right_outer_join_order.sql
new file mode 100644
index 0000000000..6f1aa5eecf
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/inner_join_right_outer_join_order.sql
@@ -0,0 +1,9 @@
+SELECT p_partkey,
+       n_name,
+       r_name
+FROM   part
+       INNER JOIN nation
+               ON n_regionkey = p_partkey
+       RIGHT JOIN region
+               ON n_nationkey = r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/left_join_on_multiple_predicates_order.sql b/regression-test/suites/trino_p0/sql/join/left_join_on_multiple_predicates_order.sql
new file mode 100644
index 0000000000..31dfeeaf42
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/left_join_on_multiple_predicates_order.sql
@@ -0,0 +1 @@
+select n_name, p_name from nation left outer join part on n_regionkey = p_partkey and n_name = p_name
diff --git a/regression-test/suites/trino_p0/sql/join/left_join_where_constant_order.sql b/regression-test/suites/trino_p0/sql/join/left_join_where_constant_order.sql
new file mode 100644
index 0000000000..94b0e9eed8
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/left_join_where_constant_order.sql
@@ -0,0 +1,6 @@
+SELECT n_name, r_name
+FROM   nation
+       LEFT JOIN region
+              ON n_nationkey = r_regionkey
+WHERE  r_name > 'G'
+
diff --git a/regression-test/suites/trino_p0/sql/join/left_join_where_is_not_null_order.sql b/regression-test/suites/trino_p0/sql/join/left_join_where_is_not_null_order.sql
new file mode 100644
index 0000000000..a629255fb8
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/left_join_where_is_not_null_order.sql
@@ -0,0 +1,6 @@
+SELECT n_name
+FROM   nation
+       LEFT JOIN region
+              ON n_nationkey = r_regionkey
+WHERE  r_name is not null
+
diff --git a/regression-test/suites/trino_p0/sql/join/left_join_where_is_null_order.sql b/regression-test/suites/trino_p0/sql/join/left_join_where_is_null_order.sql
new file mode 100644
index 0000000000..5657b94ccf
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/left_join_where_is_null_order.sql
@@ -0,0 +1,6 @@
+SELECT n_name
+FROM   nation
+       LEFT JOIN region
+              ON n_nationkey = r_regionkey
+WHERE  r_name is null
+
diff --git a/regression-test/suites/trino_p0/sql/join/left_outer_join_inner_join_order.sql b/regression-test/suites/trino_p0/sql/join/left_outer_join_inner_join_order.sql
new file mode 100644
index 0000000000..ad31deb20e
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/left_outer_join_inner_join_order.sql
@@ -0,0 +1,9 @@
+SELECT p_partkey,
+       n_name,
+       r_name
+FROM   nation
+       LEFT JOIN region
+              ON n_nationkey = r_regionkey
+       INNER JOIN part
+              ON n_regionkey = p_partkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/left_outer_join_order.sql b/regression-test/suites/trino_p0/sql/join/left_outer_join_order.sql
new file mode 100644
index 0000000000..7ab192a593
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/left_outer_join_order.sql
@@ -0,0 +1,2 @@
+select n_name, r_name  from nation left outer join region on n_nationkey = r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/right_join_left_join_inner_join_parentheses_order.sql b/regression-test/suites/trino_p0/sql/join/right_join_left_join_inner_join_parentheses_order.sql
new file mode 100644
index 0000000000..7c40a9818c
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/right_join_left_join_inner_join_parentheses_order.sql
@@ -0,0 +1,12 @@
+/*
+SELECT p_partkey,
+       n2.n_name,
+       r_name
+FROM   ( ( part
+           RIGHT OUTER JOIN nation n1
+                         ON n1.n_regionkey = p_partkey )
+         LEFT OUTER JOIN region
+                      ON n1.n_nationkey = r_regionkey )
+       INNER JOIN nation n2
+               ON n2.n_nationkey = r_regionkey
+*/
diff --git a/regression-test/suites/trino_p0/sql/join/right_join_left_join_order.sql b/regression-test/suites/trino_p0/sql/join/right_join_left_join_order.sql
new file mode 100644
index 0000000000..a4badbffa9
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/right_join_left_join_order.sql
@@ -0,0 +1,9 @@
+SELECT p_partkey,
+       n_name,
+       r_name
+FROM   part
+       RIGHT OUTER JOIN nation
+                    ON n_regionkey = p_partkey
+       LEFT OUTER JOIN region
+                    ON n_nationkey = r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/right_join_left_join_parentheses_order.sql b/regression-test/suites/trino_p0/sql/join/right_join_left_join_parentheses_order.sql
new file mode 100644
index 0000000000..f9b9bf5f5d
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/right_join_left_join_parentheses_order.sql
@@ -0,0 +1,10 @@
+/*
+SELECT p_partkey,
+       n_name,
+       r_name
+FROM   (part
+        RIGHT OUTER JOIN nation
+                      ON n_regionkey = p_partkey)
+       LEFT OUTER JOIN region
+                    ON n_nationkey = r_regionkey
+*/
diff --git a/regression-test/suites/trino_p0/sql/join/right_join_null_data_order.sql b/regression-test/suites/trino_p0/sql/join/right_join_null_data_order.sql
new file mode 100644
index 0000000000..c225c353d6
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/right_join_null_data_order.sql
@@ -0,0 +1 @@
+select n_name, department, name, salary from nation right outer join workers on n_nationkey = department
diff --git a/regression-test/suites/trino_p0/sql/join/right_outer_join_order.sql b/regression-test/suites/trino_p0/sql/join/right_outer_join_order.sql
new file mode 100644
index 0000000000..cf6058b73a
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/right_outer_join_order.sql
@@ -0,0 +1,2 @@
+select n_name, r_name from region right outer join nation on n_nationkey = r_regionkey
+
diff --git a/regression-test/suites/trino_p0/sql/join/sub_select_in_order.sql b/regression-test/suites/trino_p0/sql/join/sub_select_in_order.sql
new file mode 100644
index 0000000000..30c7f8b18a
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/join/sub_select_in_order.sql
@@ -0,0 +1,2 @@
+select n_name from nation where n_nationkey in (select r_regionkey from region)
+
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByAggregate_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByAggregate_order.sql
new file mode 100644
index 0000000000..f34159ecbf
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByAggregate_order.sql
@@ -0,0 +1,2 @@
+-- database: presto; groups: orderby
+select n_regionkey as n_nationkey, n_nationkey as n_regionkey, n_name from nation where n_nationkey < 20 order by n_nationkey desc, n_regionkey asc
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByAliasSameAsColumn_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByAliasSameAsColumn_order.sql
new file mode 100644
index 0000000000..8f8d3699c9
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByAliasSameAsColumn_order.sql
@@ -0,0 +1,2 @@
+select n_regionkey as n_nationkey, n_nationkey as n_regionkey, n_name from nation where n_nationkey < 20 order by n_nationkey desc, n_regionkey asc
+
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsDefault_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsDefault_order.sql
new file mode 100644
index 0000000000..7d760aa925
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsDefault_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1 asc
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsFirst_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsFirst_order.sql
new file mode 100644
index 0000000000..5a809864e4
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsFirst_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1 asc nulls first
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsLast_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsLast_order.sql
new file mode 100644
index 0000000000..521a5ab9ec
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByAscNullsLast_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1 asc nulls last
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsDefault_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsDefault_order.sql
new file mode 100644
index 0000000000..a87d7561c5
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsDefault_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsFirst_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsFirst_order.sql
new file mode 100644
index 0000000000..d049ce9ba1
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsFirst_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1 nulls first
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsLast_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsLast_order.sql
new file mode 100644
index 0000000000..9c3f01aaa6
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByDefaultNullsLast_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1 nulls last
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByDescNullsFirst_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByDescNullsFirst_order.sql
new file mode 100644
index 0000000000..793294b143
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByDescNullsFirst_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1 desc nulls first
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByDescNullsLast_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByDescNullsLast_order.sql
new file mode 100644
index 0000000000..31e93249ce
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByDescNullsLast_order.sql
@@ -0,0 +1,3 @@
+/*
+select * from (select cast(null as bigint) union all select 1) T order by 1 desc nulls last
+*/
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByDistinctColumnDesc_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByDistinctColumnDesc_order.sql
new file mode 100644
index 0000000000..3fa81c9739
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByDistinctColumnDesc_order.sql
@@ -0,0 +1 @@
+select distinct p_brand from part where p_partkey < 15 order by 1 desc
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByExpression_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByExpression_order.sql
new file mode 100644
index 0000000000..9547e30ea0
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByExpression_order.sql
@@ -0,0 +1 @@
+select o_totalprice*1.0625, o_custkey from orders order by 1 limit 20
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByMixOfColumnsAscDesc_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByMixOfColumnsAscDesc_order.sql
new file mode 100644
index 0000000000..d8edd32595
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByMixOfColumnsAscDesc_order.sql
@@ -0,0 +1,2 @@
+select o_orderdate, o_orderpriority, o_custkey from orders order by 1 desc, 2, 3 desc limit 20
+
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedAggregate_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedAggregate_order.sql
new file mode 100644
index 0000000000..64c63d9574
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedAggregate_order.sql
@@ -0,0 +1 @@
+select avg(p_retailprice), p_mfgr from part group by 2 order by count(*) limit 20
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedColumns_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedColumns_order.sql
new file mode 100644
index 0000000000..d2238f3a82
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedColumns_order.sql
@@ -0,0 +1 @@
+select n_nationkey, n_name from nation order by n_regionkey, n_nationkey
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedExpression_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedExpression_order.sql
new file mode 100644
index 0000000000..30c447bda8
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByNonProjectedExpression_order.sql
@@ -0,0 +1 @@
+select o_custkey, o_orderstatus from orders order by o_totalprice*1.0625 limit 20
diff --git a/regression-test/suites/trino_p0/sql/order_by/orderByOrdinals_order.sql b/regression-test/suites/trino_p0/sql/order_by/orderByOrdinals_order.sql
new file mode 100644
index 0000000000..549bf657d8
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/orderByOrdinals_order.sql
@@ -0,0 +1 @@
+select n_regionkey, n_nationkey from nation order by 1, 2
diff --git a/regression-test/suites/trino_p0/sql/order_by/runOrderByWithFromSubq_order.sql b/regression-test/suites/trino_p0/sql/order_by/runOrderByWithFromSubq_order.sql
new file mode 100644
index 0000000000..a66ebd8d5a
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/order_by/runOrderByWithFromSubq_order.sql
@@ -0,0 +1 @@
+select n_nationkey, n_regionkey, n_name from (select n_regionkey, n_nationkey, n_name from nation where n_nationkey < 20 order by 2 desc limit 5) t order by 2, 1 asc
diff --git a/regression-test/suites/trino_p0/sql/union/unionAllSameTable_order.sql b/regression-test/suites/trino_p0/sql/union/unionAllSameTable_order.sql
new file mode 100644
index 0000000000..963b1b7635
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/union/unionAllSameTable_order.sql
@@ -0,0 +1,5 @@
+SELECT *
+FROM nation
+UNION ALL
+SELECT *
+FROM nation
diff --git a/regression-test/suites/trino_p0/sql/union/unionDistinctSameTable_order.sql b/regression-test/suites/trino_p0/sql/union/unionDistinctSameTable_order.sql
new file mode 100644
index 0000000000..5aa8cae98b
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/union/unionDistinctSameTable_order.sql
@@ -0,0 +1,5 @@
+SELECT *
+FROM nation
+UNION DISTINCT
+SELECT *
+FROM nation
diff --git a/regression-test/suites/trino_p0/sql/union/unionMoreThanTwoTables_order.sql b/regression-test/suites/trino_p0/sql/union/unionMoreThanTwoTables_order.sql
new file mode 100644
index 0000000000..aff62c85b6
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/union/unionMoreThanTwoTables_order.sql
@@ -0,0 +1,9 @@
+SELECT count(*)
+FROM nation
+UNION ALL
+SELECT sum(n_nationkey)
+FROM nation
+GROUP BY n_regionkey
+UNION ALL
+SELECT n_regionkey
+FROM nation
diff --git a/regression-test/suites/trino_p0/sql/union/unionOrderBy_order.sql b/regression-test/suites/trino_p0/sql/union/unionOrderBy_order.sql
new file mode 100644
index 0000000000..eeb7fdf323
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/union/unionOrderBy_order.sql
@@ -0,0 +1,10 @@
+SELECT count(*)
+FROM nation
+UNION ALL
+SELECT sum(n_nationkey)
+FROM nation
+GROUP BY n_regionkey
+UNION ALL
+SELECT n_regionkey
+FROM nation
+ORDER BY 1 DESC
diff --git a/regression-test/suites/trino_p0/sql/union/unionWithAggregation_order.sql b/regression-test/suites/trino_p0/sql/union/unionWithAggregation_order.sql
new file mode 100644
index 0000000000..f7d779644e
--- /dev/null
+++ b/regression-test/suites/trino_p0/sql/union/unionWithAggregation_order.sql
@@ -0,0 +1,6 @@
+SELECT count(*)
+FROM nation
+UNION ALL
+SELECT sum(n_nationkey)
+FROM nation
+GROUP BY n_regionkey


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