Changeset: d5a49c191286 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d5a49c191286
Removed Files:
        monetdb5/optimizer/opt_centipede.c
        monetdb5/optimizer/opt_centipede.h
        sql/test/centipede/Tests/All
        sql/test/centipede/Tests/olap.sql
        sql/test/centipede/Tests/olap.stable.err
        sql/test/centipede/Tests/olap.stable.out
Modified Files:
        monetdb5/optimizer/Makefile.ag
        monetdb5/optimizer/opt_pipes.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/optimizer/opt_support.c
        monetdb5/optimizer/opt_wrapper.c
        monetdb5/optimizer/optimizer.mal
Branch: default
Log Message:

Drop the centipede experimental optimizer
This functionality will be taken over by the mergtable
and remote tables.


diffs (truncated from 1692 to 300 lines):

diff --git a/monetdb5/optimizer/Makefile.ag b/monetdb5/optimizer/Makefile.ag
--- a/monetdb5/optimizer/Makefile.ag
+++ b/monetdb5/optimizer/Makefile.ag
@@ -67,7 +67,6 @@ lib_optimizer = {
                opt_statistics.c opt_statistics.h \
                opt_strengthReduction.c opt_strengthReduction.h \
                opt_support.c opt_support.h \
-               opt_centipede.c opt_centipede.h \
                opt_pushselect.c opt_pushselect.h \
                opt_wrapper.c
 }
diff --git a/monetdb5/optimizer/opt_centipede.c 
b/monetdb5/optimizer/opt_centipede.c
deleted file mode 100644
--- a/monetdb5/optimizer/opt_centipede.c
+++ /dev/null
@@ -1,1132 +0,0 @@
-/*
- * The contents of this file are subject to the MonetDB Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.monetdb.org/Legal/MonetDBLicense
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the MonetDB Database System.
- *
- * The Initial Developer of the Original Code is CWI.
- * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2015 MonetDB B.V.
- * All Rights Reserved.
- */
-
-/*
- * M. Kersten
- * Centipede
- * Documentation in accompanying paper.
- */
-#include "monetdb_config.h"
-#include "opt_centipede.h"
-#include "opt_deadcode.h"
-#include "opt_aliases.h"
-#include "opt_garbageCollector.h"
-#include "mal_builder.h"
-#include "mal_recycle.h"
-#include "mal_interpreter.h"
-#include "algebra.h"
-
-//#define DEBUG_OPT_DETAIL
-//#define _DEBUG_OPT_CENTIPEDE_ 
-
-#define BLOCKED 1      // Instruction should remain in main routine
-#define PARTITION 2    // Instruction is part of the fragment routine
-#define PIVOT    3     // Instruction is part of the consolidation routine
-#define SUPPORTIVE 4// Instruction is part of fragment routine
-
-/*
- * The columns are broken using fixed OID ranges.
- * Currently, we assume that all slices are of equal length.
- * The target instruction around which the query is broken.
- */
-typedef        struct{
-       InstrPtr target;
-       str schema, table, column;
-       int type, slice;        
-       int lslices, hslices;  /* variables holding the range bound */
-       lng rowcnt;
-} Slices;
-
-static int nrservers;
-
-/*
- * The query will be controlled from the coordinator with a plan
- * geared at parallel execution 
-*/
-static MalBlkPtr
-OPTexecController(Client cntxt, MalBlkPtr mb, MalBlkPtr pmb, InstrPtr ret, 
InstrPtr packs, Slices *slices, oid plantag, int *status)
-{
-       MalBlkPtr cmb;
-       Symbol s;
-       char nme[BUFSIZ], *plan, *stub;
-       int barrier, x, i, j, k, *alias, nrpack;
-       InstrPtr p=0, q, *pack;
-
-       (void) p;
-       /* define the query controller */
-       //snprintf(nme, BUFSIZ, "%s_plan"OIDFMT, getFunctionId( 
getInstrPtr(mb,0)), plantag);
-       //putName(nme, strlen(nme));
-       plan = getFunctionId(getInstrPtr(pmb,0));
-       snprintf(nme, BUFSIZ, "%s_stub"OIDFMT, getFunctionId( 
getInstrPtr(mb,0)), plantag);
-       stub = putName(nme, strlen(nme));
-       (void) stub;                            /* only used if 
REMOTE_EXECUTION defined */
-
-       snprintf(nme,BUFSIZ,"%s_cntrl"OIDFMT,getFunctionId( getInstrPtr(mb,0)), 
plantag);
-       s = newFunction(userRef, putName(nme, strlen(nme)),FUNCTIONsymbol);
-       if ( s == NULL)
-               return 0;
-       freeMalBlk(s->def);
-       s->def = copyMalBlk(pmb);       /* get variables */
-       cmb = s->def;
-       if ( newMalBlkStmt(cmb,cmb->ssize) < 0 )
-               return 0;
-       nrpack= getInstrPtr(pmb,0)->retc;
-       pack = (InstrPtr *) GDKzalloc(sizeof(InstrPtr) * nrpack);
-       if( pack == NULL){
-               GDKerror("centipede" MAL_MALLOC_FAIL);
-               mb->errors++;
-               return mb;
-       }
-
-       pushInstruction(cmb, copyInstruction(pmb->stmt[0]));
-       getFunctionId( getInstrPtr(cmb,0)) = putName(nme,strlen(nme));
-       insertSymbol(cntxt->nspace,s);
-
-       /* initialize binds */
-       q= newFcnCall(cmb, sqlRef, mvcRef);
-       x= getArg(q,0);
-       alias = (int*) GDKzalloc(nrservers * sizeof(int));
-       if (alias == NULL){
-               GDKerror("centipede" MAL_MALLOC_FAIL);
-               GDKfree(pack);
-               mb->errors++;
-               return mb;
-       }
-       if( slices->column) {
-               q= newInstruction(cmb, ASSIGNsymbol);
-               getModuleId(q) = sqlRef;
-               getFunctionId(q) = bindRef;
-               q = pushArgument(cmb,q,x);
-               j = getArg(q,0) = newTmpVariable(cmb,newBatType(TYPE_oid, 
slices->type));
-               setVarUDFtype(cmb,j);
-               setVarFixed(cmb,j);
-               q= pushStr(cmb,q, slices->schema);
-               q= pushStr(cmb,q, slices->table);
-               q= pushStr(cmb,q, slices->column);
-               q= pushInt(cmb,q, 0);
-               pushInstruction(cmb,q);
-
-               q= newInstruction(cmb, ASSIGNsymbol);
-               getModuleId(q) = centipedeRef;
-               getFunctionId(q) = vectorRef;
-               q = pushArgument(cmb, q, j);
-               for ( j = 0; j < nrservers +1; j++) {
-                       k = alias[j] = newTmpVariable(cmb, TYPE_oid);
-                       q= pushReturn(cmb,q, k);
-               }
-               pushInstruction(cmb,q);
-       }
-       /* pack[i] := mat.pack(x1,...xn) */
-       if ( slices->column) {
-               p = getInstrPtr(pmb,0);
-#ifdef _DEBUG_OPT_CENTIPEDE_
-       //mnstr_printf(cntxt->fdout,"#matpack plan \n");
-       //printInstruction(cntxt->fdout, pmb,0,p,LIST_MAL_STMT);
-       //printInstruction(cntxt->fdout, 
cmb,0,getInstrPtr(cmb,0),LIST_MAL_STMT);
-#endif
-               for ( k=0  ;k < nrpack ; k++)
-               {
-                       pack[k] = newInstruction(cmb,ASSIGNsymbol);
-                       getModuleId(pack[k]) = matRef;
-                       getFunctionId(pack[k]) = packRef;
-                       getArg(pack[k],0) = getArg(packs,k); 
-                       assert(packs->argv[k] >=0);
-               }
-       }
-
-#ifdef REMOTE_EXECUTION
-       q= newFcnCall(cmb,schedulerRef,srvpoolRef);
-#else
-       q= newFcnCall(cmb,languageRef,dataflowRef);
-#endif
-       q->barrier= BARRIERsymbol;
-       barrier = getArg(q,0);
-       setVarType(cmb,x,TYPE_int);
-
-#ifdef REMOTE_EXECUTION
-       /* get servers to execute the query */
-       q= newStmt(cmb,srvpoolRef,putName("query",5));
-       q->retc= q->argc = 0;
-       for( i = 0; i < nrservers; i++)
-               q= pushReturn(cmb,q, newTmpVariable(cmb,TYPE_str));
-       q= pushStr(cmb,q,plan);
-       p= q;
-#endif
-
-       /* Inject the calls to the individual sub plans */
-       for ( i = 0; i < nrservers ; i++) {
-               q= copyInstruction(getInstrPtr(pmb,0));
-               q->token = ASSIGNsymbol;
-               q->barrier = 0;
-               q->argc -= 2; /* remove the bounds */
-               for ( j=0 ; j < q->retc; j++) {
-                       getArg(q,j) = newTmpVariable(cmb, 
getVarType(pmb,getArg(q,j)));
-                       pack[j] = pushArgument(cmb, pack[j], getArg(q,j));
-               }
-
-               if ( slices->column){
-                       /* add the splitter arguments */
-                       q= pushArgument(cmb,q,alias[i]);
-                       q= pushArgument(cmb,q,alias[i+1]);
-               }
-#ifdef REMOTE_EXECUTION
-               /* for distributed execution we use the stub */
-               getFunctionId(q) = stub;
-               q= setArgument(cmb,q,q->retc, getArg(p,i));
-#else
-               getFunctionId(q) = plan;
-#endif
-               pushInstruction(cmb,q);
-       }
-
-       /* put all mat.pack instructions into the program
-         make sure that they have contiguous void headed columns 
-       */
-       p = getInstrPtr(pmb,0);
-       if ( slices->column) {
-               for ( k=0 ; k < nrpack; k++) {
-                       /* after packing we may have to re-do groupings*/
-                       pushInstruction(cmb, pack[k]);
-                       setVarUsed(cmb, getArg(pack[k],0));
-               }
-       }
-#ifdef _DEBUG_OPT_CENTIPEDE_
-       mnstr_printf(cntxt->fdout,"\n#cmb structure\n");
-       printFunction(cntxt->fdout, cmb, 0, LIST_MAL_STMT);
-#endif
-
-       (void) status;
-       /* look for pivot operations in original plan */
-       for ( i=1; i < mb->stop; i++)
-       if (status[i] == PIVOT){
-               char buf[BUFSIZ];
-               q= copyInstruction(getInstrPtr(mb,i));
-#ifdef _DEBUG_OPT_CENTIPEDE_
-               mnstr_printf(cntxt->fdout,"#cmb include stmt %d status 
%d:",i,status[i]);
-               printInstruction(cntxt->fdout, mb, 0, q,LIST_MAL_STMT);
-               for(k=0; k<q->argc;k++)
-                       assert(getArg(q,k) >=0);
-#endif
-               if (getModuleId(q) == groupRef && (getFunctionId(q) == 
subgroupRef || getFunctionId(q) == subgroupdoneRef)){
-                       snprintf(buf,BUFSIZ,"Y_%d",getArg(q,q->retc));
-                       q= copyInstruction(q);
-                       k = findVariable(cmb,buf);
-                       assert(k >=0);
-                       if ( k == -1)
-                               getArg(q,q->retc) = 
newVariable(cmb,GDKstrdup(buf),TYPE_any);
-                       else getArg(q,q->retc) = k;
-                       pushInstruction(cmb,q);
-               } else
-               if (getModuleId(q) == aggrRef && getFunctionId(q) == countRef ){
-                       q= copyInstruction(q);
-                       getFunctionId(q) = sumRef;
-                       // correct the return statement
-                       setVarType(cmb, getArg(q,1), newBatType(TYPE_oid, 
TYPE_wrd));
-                       pushInstruction(cmb,q);
-               } else
-               if (getModuleId(q) == aggrRef && getFunctionId(q) == 
subcountRef ){
-                       q= copyInstruction(q);
-                       getFunctionId(q) = subsumRef;
-                       q= pushBit(cmb,q,1);
-                       getArg(q,1) = getArg(q,0);
-                       pushInstruction(cmb,q);
-               } else
-               if (getModuleId(q) == aggrRef && (getFunctionId(q)==subsumRef 
|| getFunctionId(q) == subminRef ||
-                       getFunctionId(q) == submaxRef || getFunctionId(q) == 
subavgRef)){
-                       q= copyInstruction(q);
-                       getArg(q,1) = getArg(q,0);
-                       pushInstruction(cmb,q);
-               } else
-               if (getModuleId(q) == algebraRef && getFunctionId(q) == 
leftfetchjoinRef ){
-                       snprintf(buf,BUFSIZ,"Y_%d",getArg(q,q->argc-1));
-                       q= copyInstruction(q);
-                       k = findVariable(cmb,buf);
-                       if ( k >=0)
-                               getArg(q,q->argc-1) = k;
-                       pushInstruction(cmb,q);
-               } else{
-                       q= copyInstruction(q);
-                       pushInstruction(cmb,q);
-               }
-       }
-       /* finalize the dataflow block */
-       q= newAssignment(cmb);
-       q->barrier = EXITsymbol;
-       getArg(q,0) = barrier;
-
-
-       /* consolidate the result of the control function */
-       ret = copyInstruction(ret);
-       clrFunction(ret);
-       ret->barrier = RETURNsymbol;
-       for( i=0; i< ret->retc; i++)
-               ret= pushArgument(mb,ret,getArg(ret,i));
-       pushInstruction(cmb,ret);
-       getInstrPtr(cmb,0)->argc-= 2; // remove the bounds
-
-       // fix the calling of the cntrl function
-       while ( cmb->stmt[0]->retc )
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to