Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30808
Modified Files:
opt_mergetable.mx
Log Message:
Make the code depent on the variable table.
Index: opt_mergetable.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_mergetable.mx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- opt_mergetable.mx 19 Aug 2007 07:38:02 -0000 1.14
+++ opt_mergetable.mx 19 Aug 2007 19:07:52 -0000 1.15
@@ -112,6 +112,7 @@
exit c;
exit b;
@end example
+
@{
Also consider the MAT as a variable property. This is needed
to pass a MAT as an argument to functions. If the function does
@@ -202,9 +203,10 @@
static int
OPTmergetableImplementation(MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
- InstrPtr *old=0, q,r, mat[256];
- int oldtop,fm,i,k,m,mtop=0, mvar[256],tpe;
+ InstrPtr *old=0, q,r, *mat;
+ int oldtop,fm,i,k,m,mtop=0, *mvar,tpe;
int size,match,actions=0;
+
#ifdef DEBUG_OPT_MERGETABLE
stream_printf(GDKout,"Start MAT optimizer\n");
printFunction(GDKout, mb, 0);
@@ -217,6 +219,11 @@
mb->ssize = size ;
mb->stop = 0;
+ /* the number of MATs is limited to the variable stack*/
+ mat= (InstrPtr*) alloca(mb->vtop * sizeof(InstrPtr));
+ memset((char*) mat, 0, mb->vtop * sizeof(InstrPtr));
+ mvar= (int*) alloca(mb->vtop * sizeof(int));
+ memset((char*) mvar, 0, mb->vtop * sizeof(InstrPtr));
for( i=0; i<oldtop; i++){
p= old[i];
@@ -298,7 +305,7 @@
break;
for( k=fm-1; match > 1 && k >= p->retc ; k--)
- if( (m=isMATalias(getArg(p,k),mvar,mtop)) >= 0){
+ if( (m=isMATalias(getArg(p,k),mvar,mtop)) >= 0 ){
#ifdef DEBUG_OPT_MERGETABLE
stream_printf(GDKout,"Pack k=%d\n",k);
printInstruction(GDKout,mb,p,0);
@@ -316,6 +323,10 @@
The insertions are sent to the first component of the MAT.
Selection of the proper component based on e.g. range descriptors is for
later.
+
+CAVEAT. The MATs that represent partitions in SQL can not
+be packed to facilitate updates. We assume the first
+partition is dominant.
@c
if( getModuleId(p)== batRef &&
( getFunctionId(p)== insertRef ||
@@ -340,11 +351,15 @@
getFunctionId(p) == deleteRef) ) &&
fm == 2 &&
(m=isMATalias(getArg(p,fm),mvar,mtop)) >= 0){
+#ifdef DEBUG_OPT_MERGETABLE
+ stream_printf(GDKout,"kdifference resolution
fm=%d\n",fm);
+ printInstruction(GDKout,mb,p,0);
+#endif
tpe= getVarType(mb,getArg(p,0));
for(k=1; k< mat[m]->argc; k++){
q= copyInstruction(p);
- if( k < mat[m]->argc-1)
+ if( k == mat[m]->argc-1)
getArg(q,0)= getArg(p,0);
else{
getArg(q,0) = newTmpVariable(mb, tpe);
@@ -352,6 +367,9 @@
}
getArg(q,fm) = getArg(mat[m],k);
pushInstruction(mb,q);
+#ifdef DEBUG_OPT_MERGETABLE
+ printInstruction(GDKout,mb,q,0);
+#endif
}
freeInstruction(p);
continue;
-------------------------------------------------------------------------
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