Changeset: 9adfe2be57f2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9adfe2be57f2
Modified Files:
        sql/server/rel_optimizer.c
        sql/test/SQLancer/Tests/sqlancer10.test
Branch: default
Log Message:

Small bugfix for rel_dce, leave one column on subrelation only when the 
projection is unsafe


diffs (25 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
@@ -6801,7 +6801,8 @@ rel_exps_mark_used(sql_allocator *sa, sq
                }
        }
        /* for count/rank we need atleast one column */
-       if (subrel && !nr && (is_project(subrel->op) || is_base(subrel->op)) && 
subrel->exps->h) {
+       if (!nr && subrel && (is_project(subrel->op) || is_base(subrel->op)) && 
!list_empty(subrel->exps) &&
+               (is_simple_project(rel->op) && project_unsafe(rel, 0))) {
                sql_exp *e = subrel->exps->h->data;
                e->used = 1;
        }
diff --git a/sql/test/SQLancer/Tests/sqlancer10.test 
b/sql/test/SQLancer/Tests/sqlancer10.test
--- a/sql/test/SQLancer/Tests/sqlancer10.test
+++ b/sql/test/SQLancer/Tests/sqlancer10.test
@@ -382,7 +382,7 @@ PLAN SELECT (SELECT c0 FROM t0) FROM t0
 ----
 project (
 | single left outer join (
-| | table("sys"."t0") [ "t0"."%TID%" NOT NULL ] COUNT ,
+| | table("sys"."t0") [ "t0"."%t0_c3_c0_unique" HASHIDX  ] COUNT ,
 | | project (
 | | | table("sys"."t0") [ "t0"."c0" NOT NULL ] COUNT 
 | | ) [ "t0"."c0" NOT NULL as "%1"."%1" ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to