Changeset: 563cf17218c4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=563cf17218c4
Modified Files:
        monetdb5/optimizer/opt_postfix.c
Branch: Jun2020
Log Message:

merged


diffs (50 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,25 +32,27 @@ OPTpostfixImplementation(Client cntxt, M
        for( i = 0; i< slimit; i++){
 /* POSTFIX ACTION FOR THE JOIN CASE  */
                p= getInstrPtr(mb, i);
-               if ( getModuleId(p) == algebraRef && getFunctionId(p) == 
joinRef && getVarEolife(mb, getArg(p, p->retc -1)) == i){
-                       delArgument(p, p->retc -1);
-                       typeChecker(cntxt->usermodule, mb, p, i, TRUE);
-                       actions++;
-                       continue;
-               }
-               if ( getModuleId(p) == algebraRef && getFunctionId(p) == 
leftjoinRef && getVarEolife(mb, getArg(p, p->retc -1)) == i){
-                       delArgument(p, p->retc -1);
-                       typeChecker(cntxt->usermodule, mb, p, i, TRUE);
-                       actions++;
-                       continue;
-               }
-               if ( getModuleId(p) == algebraRef && getFunctionId(p) == 
semijoinRef && getVarEolife(mb, getArg(p, p->retc -1)) == i){
-                       delArgument(p, p->retc -1);
-                       /* semijoin with a single output is called intersect */
-                       setFunctionId(p,intersectRef);
-                       typeChecker(cntxt->usermodule, mb, p, i, TRUE);
-                       actions++;
-                       continue;
+               if ( getModuleId(p) == algebraRef) {
+                       if ( getFunctionId(p) == joinRef || getFunctionId(p) == 
leftjoinRef) {
+                               if ( getVarEolife(mb, getArg(p, p->retc -1)) == 
i) {
+                                       delArgument(p, p->retc -1);
+                                       typeChecker(cntxt->usermodule, mb, p, 
i, TRUE);
+                                       actions++;
+                                       continue;
+                               }
+                       } else if ( getFunctionId(p) == semijoinRef) {
+                               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) {
+                                       delArgument(p, is_second_ret_not_used ? 
p->retc -1 : p->retc -2);
+                                       /* semijoin with a single output is 
called intersect */
+                                       setFunctionId(p,intersectRef);
+                                       typeChecker(cntxt->usermodule, mb, p, 
i, TRUE);
+                                       actions++;
+                                       continue;
+                               }
+                       }
                }
 /* POSTFIX ACTION FOR THE EXTENT CASE  */
                if ( getModuleId(p) == groupRef && getFunctionId(p) == groupRef 
&& getVarEolife(mb, getArg(p, p->retc -1)) == i){
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to