Changeset: 80b0f1dd338f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=80b0f1dd338f
Modified Files:
        sql/server/rel_optimizer.c
        sql/test/SQLancer/Tests/sqlancer01.stable.out
Branch: Jun2020
Log Message:

Fix for bug 6888, ie rel_remove_redundant_join optimizer cannot be applied to 
cross products


diffs (94 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -2627,7 +2627,7 @@ static sql_rel *
 rel_remove_redundant_join(mvc *sql, sql_rel *rel, int *changes)
 {
        (void)sql;
-       if (is_join(rel->op) || is_semi(rel->op)) {
+       if ((is_join(rel->op) || is_semi(rel->op)) && !list_empty(rel->exps)) {
                sql_rel *l = rel->l, *r = rel->r, *b, *p = NULL, *j;
 
                if (is_basetable(l->op) && is_simple_project(r->op) && 
need_distinct(r)) {
diff --git a/sql/test/SQLancer/Tests/sqlancer01.stable.out 
b/sql/test/SQLancer/Tests/sqlancer01.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer01.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer01.stable.out
@@ -113,6 +113,78 @@ stdout of test 'sqlancer01` in directory
 [ 4    ]
 #ALTER TABLE another_t ADD UNIQUE(col8, col1, col6, col3);
 #ROLLBACK;
+#START TRANSACTION; --Bug 6888
+#create view v0(c0) as (select distinct - (tbl_productsales.totalsales) from 
tbl_productsales, another_t);
+#select another_t.col1 from another_t, tbl_productsales cross join v0;
+% sys.another_t # table_name
+% col1 # name
+% int # type
+% 4 # length
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 11   ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 111  ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+[ 1111 ]
+#ROLLBACK;
 #SELECT "sys"."replace"(cast(cast(0.8009925043335998 as clob) as 
clob(169)),cast("sys"."replace"('!','','wtkg춑5,I}楘') as 
clob),"sys"."concat"("sys"."concat"('?dMHr펔2!FU4Rᔎ%',-1194732688),0.7566860950241294));
 % .%2 # table_name
 % %2 # name
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to