Changeset: f92a8d3dc3aa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f92a8d3dc3aa
Modified Files:
        sql/server/rel_select.c
        sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
        sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
        sql/test/SQLancer/Tests/sqlancer17.test
Branch: Jun2023
Log Message:

Only op_groupby has an associated list.


diffs (108 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -1000,7 +1000,7 @@ table_ref(sql_query *query, symbol *tabl
                        if (sql->emode != m_deps) {
                                assert(is_project(rel->op));
                                set_processed(rel);
-                               if ((is_set(rel->op) || 
is_simple_project(rel->op) || is_groupby(rel->op)) && !list_empty(rel->r)) {
+                               if (is_set(rel->op) || 
is_simple_project(rel->op) || (is_groupby(rel->op) && !list_empty(rel->r))) {
                                        /* it's unsafe to set the projection 
names because of possible dependent sorting/grouping columns */
                                        rel = rel_project(sql->sa, rel, 
rel_projections(sql, rel, NULL, 1, 0));
                                        set_processed(rel);
diff --git a/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test 
b/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
--- a/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
+++ b/sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test
@@ -45,25 +45,27 @@ PLAN select * from r
 ----
 project (
 | project (
-| | crossproduct (
-| | | table("sys"."v") [ "v"."a1" UNIQUE, "v"."a2" ],
-| | | project (
-| | | | crossproduct (
-| | | | | project (
-| | | | | | select (
-| | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
-| | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "latitude") ]
-| | | | | ) [ "input_double"."a2" UNIQUE as "tmp_2"."a2" ],
-| | | | | project (
-| | | | | | select (
-| | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
-| | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "longitude") ]
-| | | | | ) [ "input_double"."a2" UNIQUE as "tmp_3"."a2" ]
-| | | | ) [  ]
-| | | ) [ "sys"."st_point"("tmp_2"."a2", "tmp_3"."a2") as "p"."a1" ]
-| | ) [  ]
-| ) [ "v"."a1" as "r"."a1", "sys"."st_distance"("v"."a2", "p"."a1") as 
"r"."prob" ]
-) [ "r"."a1", "r"."prob" ]
+| | project (
+| | | crossproduct (
+| | | | table("sys"."v") [ "v"."a1" UNIQUE, "v"."a2" ],
+| | | | project (
+| | | | | crossproduct (
+| | | | | | project (
+| | | | | | | select (
+| | | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
+| | | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "latitude") ]
+| | | | | | ) [ "input_double"."a2" UNIQUE as "tmp_2"."a2" ],
+| | | | | | project (
+| | | | | | | select (
+| | | | | | | | table("sys"."input_double") [ "input_double"."a1" UNIQUE, 
"input_double"."a2" UNIQUE ]
+| | | | | | | ) [ ("input_double"."a1" UNIQUE) = (clob "longitude") ]
+| | | | | | ) [ "input_double"."a2" UNIQUE as "tmp_3"."a2" ]
+| | | | | ) [  ]
+| | | | ) [ "sys"."st_point"("tmp_2"."a2", "tmp_3"."a2") as "a1" ]
+| | | ) [  ]
+| | ) [ "v"."a1", "v"."a2", "a1" as "p"."a1" ]
+| ) [ "v"."a1" as "a1", "sys"."st_distance"("v"."a2", "p"."a1") as "prob" ]
+) [ "a1" as "r"."a1", "prob" as "r"."prob" ]
 
 statement ok
 rollback
diff --git a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test 
b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
--- a/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
+++ b/sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
@@ -125,8 +125,8 @@ project (
 | | | | | | | select (
 | | | | | | | | table("sys"."plantest0") [ "plantest0"."id" ]
 | | | | | | | ) [ ("plantest0"."id") >= (bigint(64) "150000000") ]
-| | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "10000000") 
NOT NULL as "v"."id_div" ]
-| | | | | ) [ "v"."id_div" NOT NULL as "t"."id_r" ]
+| | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "10000000") 
NOT NULL as "id_div" ]
+| | | | | ) [ "id_div" NOT NULL as "t"."id_r" ]
 | | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%6"."%6" ],
 | | | | group by (
 | | | | | project (
@@ -134,8 +134,8 @@ project (
 | | | | | | | select (
 | | | | | | | | table("sys"."plantest1") [ "plantest1"."id" ]
 | | | | | | | ) [ ("plantest1"."id") >= (bigint(64) "150000000") ]
-| | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "10000000") 
NOT NULL as "v"."id_div" ]
-| | | | | ) [ "v"."id_div" NOT NULL as "t"."id_r" ]
+| | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "10000000") 
NOT NULL as "id_div" ]
+| | | | | ) [ "id_div" NOT NULL as "t"."id_r" ]
 | | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%6"."%6" ]
 | | | ) [ "t"."id_r" NOT NULL, "%6"."%6" NOT NULL ]
 | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."sum" no nil 
("%6"."%6" NOT NULL) NOT NULL as "%6"."%6" ]
diff --git a/sql/test/SQLancer/Tests/sqlancer17.test 
b/sql/test/SQLancer/Tests/sqlancer17.test
--- a/sql/test/SQLancer/Tests/sqlancer17.test
+++ b/sql/test/SQLancer/Tests/sqlancer17.test
@@ -80,7 +80,7 @@ project (
 | | | | ) [ ("%6"."%6" NOT NULL) ! <= (tinyint(3) "1") ! <= ("%6"."%6" NOT 
NULL), (tinyint(3) "3") <= ("%6"."%6" NOT NULL) <= (tinyint(3) "5") ]
 | | | ) [ "%6"."%6" NOT NULL as "v0"."vc0" ]
 | | ) [ "v0"."vc0" NOT NULL ]
-| ) [ "sys"."sql_max"(tinyint(1) "1", tinyint(1) "1") NOT NULL as "v20"."vc0" ]
+| ) [ "sys"."sql_max"(tinyint(1) "1", tinyint(1) "1") NOT NULL as "%20"."%20" ]
 ) [ tinyint(1) "1" ]
 
 statement ok
@@ -650,7 +650,7 @@ project (
 | | table("sys"."rt0") [ "rt0"."%TID%" NOT NULL UNIQUE ],
 | | crossproduct (
 | | |  [ boolean(1) "true" as "%1"."%1" ],
-| | |  [ boolean(1) "true" as "%2"."%2" ]
+| | |  [ boolean(1) "true" as "%3"."%3" ]
 | | ) [  ]
 | ) [  ]
 ) [ tinyint(1) "1" ]
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to