Changeset: 951528fbfaec for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/951528fbfaec
Modified Files:
        monetdb5/optimizer/opt_postfix.c
Branch: Jul2021
Log Message:

Defensive lines. Apply postfix optimizer on joins only when 2 results are being 
returned. Also removed assertion about which arguments being used. If the join 
is about to be removed by deadcode optimizer, then both returned values won't 
be used


diffs (20 lines):

diff --git a/monetdb5/optimizer/opt_postfix.c b/monetdb5/optimizer/opt_postfix.c
--- a/monetdb5/optimizer/opt_postfix.c
+++ b/monetdb5/optimizer/opt_postfix.c
@@ -32,7 +32,7 @@ OPTpostfixImplementation(Client cntxt, M
        for( i = 0; i< slimit; i++){
 /* POSTFIX ACTION FOR THE JOIN CASE  */
                p= getInstrPtr(mb, i);
-               if ( getModuleId(p) == algebraRef) {
+               if ( getModuleId(p) == algebraRef && p->retc == 2) {
                        if ( getFunctionId(p) == leftjoinRef || 
getFunctionId(p) == outerjoinRef ||
                                 getFunctionId(p) == bandjoinRef || 
getFunctionId(p) == rangejoinRef ||
                                 getFunctionId(p) == likejoinRef) {
@@ -47,7 +47,6 @@ OPTpostfixImplementation(Client cntxt, M
                                int is_first_ret_not_used = getVarEolife(mb, 
getArg(p, p->retc -2)) == i;
                                int is_second_ret_not_used = getVarEolife(mb, 
getArg(p, p->retc -1)) == i;
 
-                               assert(!is_first_ret_not_used || 
!is_second_ret_not_used);
                                if ( (is_first_ret_not_used || 
is_second_ret_not_used) && getFunctionId(p) == semijoinRef) {
                                        delArgument(p, is_second_ret_not_used ? 
p->retc -1 : p->retc -2);
                                        /* semijoin with a single output is 
called intersect */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to