Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7513

Modified Files:
        opt_mergetable.mx 
Log Message:
added first steps of pushing mat's through group.new and derive.


Index: opt_mergetable.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_mergetable.mx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- opt_mergetable.mx   12 Nov 2007 20:12:58 -0000      1.20
+++ opt_mergetable.mx   12 Nov 2007 22:16:53 -0000      1.21
@@ -186,6 +186,45 @@
        return r;
 }
 
+static InstrPtr
+mat_group(InstrPtr *ext, MalBlkPtr mb, InstrPtr p, InstrPtr *mat, int m, int 
n, int o)
+{
+       int tp0 = getArgType(mb,p,0);
+       int tp1 = getArgType(mb,p,1);
+       int k;
+       InstrPtr r0 = newInstruction(mb, ASSIGNsymbol);
+       InstrPtr r1 = newInstruction(mb, ASSIGNsymbol);
+
+       setModuleId(r0,matRef);
+       setFunctionId(r0,newRef);
+       getArg(r0,0) = getArg(p,0);
+
+       setModuleId(r1,matRef);
+       setFunctionId(r1,newRef);
+       getArg(r1,0) = getArg(p,1);
+       
+       for(k=1; k<mat[m]->argc; k++) {
+               InstrPtr q = copyInstruction(p);
+               getArg(q,0) = newTmpVariable(mb, tp0);
+               getArg(q,1) = newTmpVariable(mb, tp1);
+               getArg(q,2) = getArg(mat[m],k);
+               if (n)
+                       getArg(q,3) = getArg(mat[n],k);
+               if (o)
+                       getArg(q,4) = getArg(mat[o],k);
+               pushInstruction(mb,q);
+
+               /* add result to mat */
+               r0 = pushArgument(mb,r0,getArg(q,0));
+               r1 = pushArgument(mb,r1,getArg(q,1));
+       }
+       freeInstruction(p);
+       pushInstruction(mb, r0);
+       pushInstruction(mb, r1);
+       *ext = r1;
+       return r0;
+}
+
 /* todo make general re-name func function */
 static InstrPtr
 mat_union(MalBlkPtr mb, InstrPtr p, InstrPtr *mat, int m)
@@ -354,6 +393,7 @@
        memset((char*) mvar, 0, mb->vtop * sizeof(int));
 
        for( i=0; i<oldtop; i++){
+               int n = 0, o = 0;
                p = old[i];
                if (getModuleId(p)== matRef && 
                   (getFunctionId(p)==newRef || getFunctionId(p)==packRef)) {
@@ -389,7 +429,6 @@
 and for fetch joins we can use this information to do per part joins only.
 @c
                if (match == 2) {
-                       int n;
                        if (getModuleId(p) == algebraRef &&
                            getFunctionId(p) == joinRef &&
                                (m=isMATalias(getArg(p,1),mvar,mtop)) >= 0 &&
@@ -399,9 +438,27 @@
                                mtop= mat_add(mat, mvar, mtop, mat_join(mb, p, 
mat, m, n));
                                actions++;
                                continue;
-                               
                        }       
                }
[EMAIL PROTECTED] 
+Now we handle group.new (and derive) statements
[EMAIL PROTECTED]
+               if (getModuleId(p) == groupRef && 
+                  ((match == 1 && getFunctionId(p) == newRef &&
+                  ((m=isMATalias(getArg(p,2),mvar,mtop)) >= 0)) ||
+                  (match == 3 && getFunctionId(p) == deriveRef &&
+                  ((m=isMATalias(getArg(p,2),mvar,mtop)) >= 0) &&
+                  ((n=isMATalias(getArg(p,3),mvar,mtop)) >= 0) &&
+                  ((o=isMATalias(getArg(p,4),mvar,mtop)) >= 0)))) {
+                       InstrPtr ext, grp;
+               
+                       printf("%s %d %d %d\n", getFunctionId(p), m, n, o);
+                       grp = mat_group(&ext, mb, p, mat, m, n, o);
+                       mtop= mat_add(mat, mvar, mtop, grp);
+                       mtop= mat_add(mat, mvar, mtop, ext);
+                       actions++;
+                       continue;
+               }
 @-
 Pack MAT arguments, except one, to limit plan explosion.
 The preferred partitioned one is the first argment as it


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to