Changeset: eea9d152bf87 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eea9d152bf87
Modified Files:
        monetdb5/modules/kernel/group.c
        monetdb5/optimizer/opt_deadcode.c
Branch: default
Log Message:

Avoid producing the histogram
If the histogram produced as a side effect in BATgroup is not
used, then it is removed from the MAL instruction call as well.


diffs (46 lines):

diff --git a/monetdb5/modules/kernel/group.c b/monetdb5/modules/kernel/group.c
--- a/monetdb5/modules/kernel/group.c
+++ b/monetdb5/modules/kernel/group.c
@@ -40,10 +40,12 @@ GRPsubgroup5(bat *ngid, bat *next, bat *
        if ((r = BATgroup(&gn, &en, &hn, b, s, g, e, h)) == GDK_SUCCEED) {
                *ngid = gn->batCacheid;
                *next = en->batCacheid;
-               *nhis = hn->batCacheid;
+               if (nhis){
+                       *nhis = hn->batCacheid;
+                       BBPkeepref(*nhis);
+               }
                BBPkeepref(*ngid);
                BBPkeepref(*next);
-               BBPkeepref(*nhis);
        }
        BBPunfix(b->batCacheid);
        if (s)
diff --git a/monetdb5/optimizer/opt_deadcode.c 
b/monetdb5/optimizer/opt_deadcode.c
--- a/monetdb5/optimizer/opt_deadcode.c
+++ b/monetdb5/optimizer/opt_deadcode.c
@@ -103,6 +103,15 @@ OPTdeadcodeImplementation(Client cntxt, 
                                freeInstruction(p);
                                actions ++;
                        }
+                       if ( getModuleId(p) == groupRef && p->retc == 3 && 
varused[getArg(p,2)] == 0 &&
+                               (getFunctionId(p) == groupRef || 
+                                getFunctionId(p) == subgroupRef || 
+                                getFunctionId(p) == groupdoneRef || 
+                                getFunctionId(p) == subgroupdoneRef)){
+                               // remove the histogram unless needed
+                               delArgument(p,2);
+                               actions++;
+                       }
                }
        }
        for(; i<slimit; i++)
@@ -111,7 +120,7 @@ OPTdeadcodeImplementation(Client cntxt, 
     /* Defense line against incorrect plans */
        /* we don't create or change existing structures */
     //if( actions > 0){
-        //chkTypes(cntxt->usermodule, mb, FALSE);
+        chkTypes(cntxt->usermodule, mb, FALSE);
         chkFlow(mb);
         //chkDeclarations(mb);
     //}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to