Changeset: 5dfa01fdb753 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5dfa01fdb753
Modified Files:
sql/backends/monet5/rel_bin.c
sql/test/SQLancer/Tests/sqlancer06.sql
Branch: Oct2020
Log Message:
fix incorrect code generation in case of outer joins and case/coalesce join
expressions
diffs (48 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
@@ -1246,20 +1246,16 @@ exp_bin(backend *be, sql_exp *e, stmt *l
r = exp_bin(be, re, right, NULL, grp, ext, cnt, sel,
depth+1, 0, push);
is_select = 1;
}
- if (re2)
- r2 = exp_bin(be, re2, left, right, grp, ext, cnt, sel,
depth+1, 0, push);
+ if (re2 && (swapped || !right || !reduce))
+ r2 = exp_bin(be, re2, left, (!reduce)?right:NULL, grp,
ext, cnt, sel, depth+1, 0, push);
+ else if (re2)
+ r2 = exp_bin(be, re2, right, NULL, grp, ext, cnt, sel,
depth+1, 0, push);
if (!l || !r || (re2 && !r2)) {
TRC_ERROR(SQL_EXECUTION, "Query: '%s'\n",
be->client->query);
return NULL;
}
- /*
- if (left && right && !is_select &&
- ((l->nrcols && (r->nrcols || (r2 && r2->nrcols))) ||
- re->card > CARD_ATOM ||
- (re2 && re2->card > CARD_ATOM))) {
- */
(void)is_select;
if (reduce && left && right) {
if (l->nrcols == 0)
diff --git a/sql/test/SQLancer/Tests/sqlancer06.sql
b/sql/test/SQLancer/Tests/sqlancer06.sql
--- a/sql/test/SQLancer/Tests/sqlancer06.sql
+++ b/sql/test/SQLancer/Tests/sqlancer06.sql
@@ -68,11 +68,11 @@ COPY 3 RECORDS INTO "sys"."t1" FROM stdi
"1969-12-24 08:07:10.000000"
CREATE TABLE "sys"."t2" ("c0" INTERVAL MONTH,"c1" DOUBLE,"c2" BOOLEAN);
-COPY 4 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"';
-1293946112 0.3251224351379446 true
-1293946112 0.3251224351379446 true
-540568573 NULL false
-NULL NULL false
+COPY 4 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E',',E'\n','"';
+1293946112,0.3251224351379446,true
+1293946112,0.3251224351379446,true
+540568573,NULL,false
+NULL,NULL,false
SELECT 1 FROM t2 LEFT JOIN t0 ON CASE CAST(t2.c0 AS VARCHAR(32)) WHEN
CAST(t2.c2 AS VARCHAR(32)) THEN 4 WHEN COALESCE('a', 'b') THEN 3 END IS NOT
NULL;
-- 1
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list