Changeset: a9c8b1c47049 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a9c8b1c47049
Modified Files:
        sql/server/rel_exp.c
        sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test
        sql/test/astro/Tests/astro.test
        sql/test/miscellaneous/Tests/simple_plans.test
Branch: label
Log Message:

small fix for finding matching expressions


diffs (88 lines):

diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -1278,6 +1278,8 @@ exp_match( sql_exp *e1, sql_exp *e2)
        if (exp_cmp(e1, e2) == 0)
                return 1;
        if (e1->type == e2->type && e1->type == e_column) {
+               if (e1->nid && e1->nid == e2->nid)
+                       return 1;
                if (e1->alias.label != e2->alias.label || !e1->alias.label || 
!e2->alias.label)
                        return 0;
 #if 0
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
@@ -65,17 +65,17 @@ project (
 | | | | | | | table("sys"."plantest0") [ "plantest0"."id" ]
 | | | | | | ) [ ("plantest0"."id") >= (bigint(28) "150000000") ]
 | | | | | ) [ "sys"."sql_div"("plantest0"."id" NOT NULL, int(24) "10000000") 
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 ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ],
 | | | | group by (
 | | | | | project (
 | | | | | | select (
 | | | | | | | table("sys"."plantest1") [ "plantest1"."id" ]
 | | | | | | ) [ ("plantest1"."id") >= (bigint(28) "150000000") ]
 | | | | | ) [ "sys"."sql_div"("plantest1"."id" NOT NULL, int(24) "10000000") 
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" ]
-| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "10000000") NOT NULL 
as "id_range_base", "%6"."%6" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
+| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ]
+| | | ) [ "t"."id_r" NOT NULL, "%1"."%1" NOT NULL ]
+| | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."sum" no nil 
("%1"."%1" NOT NULL) NOT NULL as "%1"."%1" ]
+| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "10000000") NOT NULL 
as "id_range_base", "%1"."%1" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
 ) [ "id_range_base" NOT NULL, "nrows" NOT NULL ] [ "t"."id_r" ASC NOT NULL 
UNIQUE ]
 
 query II rowsort
@@ -127,7 +127,7 @@ project (
 | | | | | | | ) [ ("plantest0"."id") >= (bigint(28) "150000000") ]
 | | | | | | ) [ "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" ],
+| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ],
 | | | | group by (
 | | | | | project (
 | | | | | | project (
@@ -136,10 +136,10 @@ project (
 | | | | | | | ) [ ("plantest1"."id") >= (bigint(28) "150000000") ]
 | | | | | | ) [ "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" ]
-| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "10000000") NOT NULL 
as "id_range_base", "%6"."%6" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
+| | | | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."count" no nil 
("t"."id_r" NOT NULL) NOT NULL as "%1"."%1" ]
+| | | ) [ "t"."id_r" NOT NULL, "%1"."%1" NOT NULL ]
+| | ) [ "t"."id_r" NOT NULL ] [ "t"."id_r" NOT NULL, "sys"."sum" no nil 
("%1"."%1" NOT NULL) NOT NULL as "%1"."%1" ]
+| ) [ "sys"."sql_mul"("t"."id_r" NOT NULL UNIQUE, int(24) "10000000") NOT NULL 
as "id_range_base", "%1"."%1" NOT NULL as "nrows", "t"."id_r" NOT NULL UNIQUE ]
 ) [ "id_range_base" NOT NULL, "nrows" NOT NULL ] [ "t"."id_r" ASC NOT NULL 
UNIQUE ]
 
 query II rowsort
diff --git a/sql/test/astro/Tests/astro.test b/sql/test/astro/Tests/astro.test
--- a/sql/test/astro/Tests/astro.test
+++ b/sql/test/astro/Tests/astro.test
@@ -84,7 +84,7 @@ update(
 | | | | ) [ ("cm_flux"."active" NOT NULL UNIQUE) = (boolean(1) "true"), 
(varchar(1)["cm_flux"."filter" NOT NULL UNIQUE] NOT NULL) = (varchar(1) "g") ]
 | | | ) [ "cm_flux"."filter" NOT NULL UNIQUE, "cm_flux"."f_datapoints" NOT 
NULL UNIQUE, "cm_flux"."avg_flux" NOT NULL UNIQUE, "cm_flux"."avg_fluxsq" NOT 
NULL UNIQUE, "cm_flux"."avg_w" NOT NULL UNIQUE, "cm_flux"."avg_wflux" NOT NULL 
UNIQUE, "cm_flux"."avg_wfluxsq" NOT NULL UNIQUE, "cm_flux"."avg_dec_zone_deg" 
NOT NULL UNIQUE, "cm_flux"."runcat" NOT NULL UNIQUE ]
 | | ) [ ("fluxz"."runcat" NOT NULL UNIQUE) = ("cm_flux"."runcat" NOT NULL 
UNIQUE), ("fluxz"."filter" NOT NULL UNIQUE) = ("cm_flux"."filter" NOT NULL 
UNIQUE) ]
-| ) [ "fluxz"."%TID%" NOT NULL, "cm_flux"."filter" as "fluxz"."filter", 
"cm_flux"."f_datapoints" as "fluxz"."f_datapoints", "cm_flux"."avg_flux" as 
"fluxz"."avg_flux", "cm_flux"."avg_fluxsq" as "fluxz"."avg_fluxsq", 
"cm_flux"."avg_w" as "fluxz"."avg_w", "cm_flux"."avg_wflux" as 
"fluxz"."avg_wflux", "cm_flux"."avg_wfluxsq" as "fluxz"."avg_wfluxsq", 
"cm_flux"."avg_dec_zone_deg" as "fluxz"."avg_dec_zone_deg" ]
+| ) [ "fluxz"."%TID%" NOT NULL, "cm_flux"."filter" UNIQUE as "fluxz"."filter", 
"cm_flux"."f_datapoints" as "fluxz"."f_datapoints", "cm_flux"."avg_flux" as 
"fluxz"."avg_flux", "cm_flux"."avg_fluxsq" as "fluxz"."avg_fluxsq", 
"cm_flux"."avg_w" as "fluxz"."avg_w", "cm_flux"."avg_wflux" as 
"fluxz"."avg_wflux", "cm_flux"."avg_wfluxsq" as "fluxz"."avg_wfluxsq", 
"cm_flux"."avg_dec_zone_deg" as "fluxz"."avg_dec_zone_deg" ]
 ) [ "fluxz"."%TID%" NOT NULL UNIQUE, "fluxz"."filter" NOT NULL, 
"fluxz"."f_datapoints" NOT NULL, "fluxz"."avg_flux" NOT NULL, 
"fluxz"."avg_fluxsq" NOT NULL, "fluxz"."avg_w" NOT NULL, "fluxz"."avg_wflux" 
NOT NULL, "fluxz"."avg_wfluxsq" NOT NULL, "fluxz"."avg_dec_zone_deg" NOT NULL ]
 
 statement ok
diff --git a/sql/test/miscellaneous/Tests/simple_plans.test 
b/sql/test/miscellaneous/Tests/simple_plans.test
--- a/sql/test/miscellaneous/Tests/simple_plans.test
+++ b/sql/test/miscellaneous/Tests/simple_plans.test
@@ -385,7 +385,9 @@ PLAN SELECT 1 FROM view1 s INNER JOIN vi
 ----
 project (
 | join (
-| | table("sys"."tabel3") [ "tabel3"."id_nr" as "a"."id_nr" ],
+| | project (
+| | | table("sys"."tabel3") [ "tabel3"."id_nr" as "a"."id_nr" ]
+| | ) [ "a"."id_nr" ],
 | | project (
 | | | left outer join (
 | | | | join (
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to