Changeset: c28af6c21fb7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c28af6c21fb7
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/test/SQLancer/Tests/sqlancer03.sql
        sql/test/SQLancer/Tests/sqlancer03.stable.out
Branch: Jun2020
Log Message:

Don't generate the same join conditions twice for cross products


diffs (71 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2306,7 +2306,7 @@ rel2bin_join(backend *be, sql_rel *rel, 
                }
 
                if (join) {
-                       en = rel->exps->h;
+                       en = jexps->h;
                } else {
                        list *lje = sa_list(sql->sa), *rje = sa_list(sql->sa), 
*exps = sa_list(sql->sa);
                        int used_hash = 0, idx = 0,  equality_only = 1;
@@ -2600,7 +2600,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
                }
 
                if (join) {
-                       en = rel->exps->h;
+                       en = jexps->h;
                } else {
                        list *lje = sa_list(sql->sa), *rje = sa_list(sql->sa), 
*exps = sa_list(sql->sa);
                        int idx = 0, equality_only = 1;
diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql 
b/sql/test/SQLancer/Tests/sqlancer03.sql
--- a/sql/test/SQLancer/Tests/sqlancer03.sql
+++ b/sql/test/SQLancer/Tests/sqlancer03.sql
@@ -234,7 +234,7 @@ COPY 2 RECORDS INTO "sys"."t1" FROM stdi
 "Xh{%LTF"      false
 
 SELECT 1 FROM t0 CROSS JOIN t1 WHERE (t1.c1 AND (t0.c0 > t0.c0)) IS NULL;
-SELECT SUM(agg0) FROM (SELECT ALL SUM(ALL 0.97) as agg0 FROM t0 CROSS JOIN t1 
WHERE ((((t1.c1)AND(t1.c1)))AND(((t0.c0)>(t0.c0)))) 
+SELECT cast(SUM(agg0) as decimal(10,2)) FROM (SELECT ALL SUM(ALL 0.97) as agg0 
FROM t0 CROSS JOIN t1 WHERE ((((t1.c1)AND(t1.c1)))AND(((t0.c0)>(t0.c0)))) 
 UNION ALL SELECT SUM(ALL 0.97) as agg0 FROM t0 CROSS JOIN t1 WHERE NOT 
(((((t1.c1)AND(t1.c1)))AND(((t0.c0)>(t0.c0))))) 
 UNION ALL SELECT SUM(ALL 0.97) as agg0 FROM t0 CROSS JOIN t1 WHERE 
(((((t1.c1)AND(t1.c1)))AND(((t0.c0)>(t0.c0))))) IS NULL) as asdf;
 ROLLBACK;
diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out 
b/sql/test/SQLancer/Tests/sqlancer03.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer03.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out
@@ -373,6 +373,34 @@ stdout of test 'sqlancer03` in directory
 % int # type
 % 1 # length
 #ROLLBACK;
+#START TRANSACTION; --Bug 6927
+#CREATE TABLE "sys"."t0" ("c0" CHARACTER LARGE OBJECT NOT NULL,CONSTRAINT 
"t0_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t0_c0_unique" UNIQUE 
("c0"),CONSTRAINT "t0_c0_unique" UNIQUE ("c0"));
+#COPY 5 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+#"1970-01-19"
+#"0.9940522485469018"
+#"Sn"
+#""
+#",骭2T*h[99#஺M\nBCϹ㦚X"
+[ 5    ]
+#CREATE TABLE "sys"."t1" ("c0" CHARACTER LARGE OBJECT,"c1" BOOLEAN NOT 
NULL,CONSTRAINT "t1_c1_unique" UNIQUE ("c1"));
+#COPY 2 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+#"*"   true
+#"Xh{%LTF"     false
+[ 2    ]
+#SELECT 1 FROM t0 CROSS JOIN t1 WHERE (t1.c1 AND (t0.c0 > t0.c0)) IS NULL;
+% .%10 # table_name
+% %10 # name
+% tinyint # type
+% 1 # length
+#SELECT cast(SUM(agg0) as decimal(10,2)) FROM (SELECT ALL SUM(ALL 0.97) as 
agg0 FROM t0 CROSS JOIN t1 WHERE ((((t1.c1)AND(t1.c1)))AND(((t0.c0)>(t0.c0)))) 
+#UNION ALL SELECT SUM(ALL 0.97) as agg0 FROM t0 CROSS JOIN t1 WHERE NOT 
(((((t1.c1)AND(t1.c1)))AND(((t0.c0)>(t0.c0))))) 
+#UNION ALL SELECT SUM(ALL 0.97) as agg0 FROM t0 CROSS JOIN t1 WHERE 
(((((t1.c1)AND(t1.c1)))AND(((t0.c0)>(t0.c0))))) IS NULL) as asdf;
+% .%25 # table_name
+% %25 # name
+% decimal # type
+% 12 # length
+[ 9.70 ]
+#ROLLBACK;
 #START TRANSACTION; -- Bug 6924
 #CREATE TABLE "sys"."t0" ("a" INTEGER, "b" INTEGER NOT NULL, CONSTRAINT 
"t0_a_b_unique" UNIQUE ("a","b"));
 #COPY 39 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"';
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to