Changeset: a856d795357f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a856d795357f Removed Files: monetdb5/optimizer/opt_prejoin.c monetdb5/optimizer/opt_prejoin.h Modified Files: clients/Tests/exports.stable.out monetdb5/optimizer/Makefile.ag monetdb5/optimizer/opt_support.c monetdb5/optimizer/opt_wrapper.c Branch: default Log Message:
Drop non-used optimizer Decisions about pre-sorting should be done within GDK not as an optimizer. diffs (204 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -774,7 +774,6 @@ str ALGmaxany(ptr result, int *bid); str ALGminany(ptr result, int *bid); str ALGouterjoin(int *result, int *lid, int *rid); str ALGouterjoinestimate(int *result, int *lid, int *rid, lng *estimate); -str ALGprejoin(int *rl, int *rr, int *l, int *r); str ALGprojectNIL(int *ret, int *bid); str ALGprojecthead(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str ALGprojecttail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); @@ -1729,7 +1728,6 @@ int OPToctopusImplementation(Client cntx str OPTorcam(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); int OPTorcamImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); str OPTpeers(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -int OPTprejoinImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTpushrangesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTpushselectImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); int OPTquerylogImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); diff --git a/monetdb5/optimizer/Makefile.ag b/monetdb5/optimizer/Makefile.ag --- a/monetdb5/optimizer/Makefile.ag +++ b/monetdb5/optimizer/Makefile.ag @@ -55,7 +55,6 @@ lib_optimizer = { opt_multiplex.c opt_multiplex.h \ opt_octopus.c opt_octopus.h \ opt_pipes.c opt_pipes.h \ - opt_prejoin.c opt_prejoin.h \ opt_prelude.c opt_prelude.h \ opt_pushranges.c opt_pushranges.h \ opt_qep.c opt_qep.h \ diff --git a/monetdb5/optimizer/opt_prejoin.c b/monetdb5/optimizer/opt_prejoin.c deleted file mode 100644 --- a/monetdb5/optimizer/opt_prejoin.c +++ /dev/null @@ -1,100 +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-2014 MonetDB B.V. - * All Rights Reserved. - */ - -#include "monetdb_config.h" -#include "opt_prejoin.h" -#include "math.h" -/* - * The prejoin implementation should only become active if we - * expect that we may end up with an IO access for each - * possible lookup. - */ -str -ALGprejoin(int *rl, int *rr, int *l, int *r){ - BAT *bl,*br,*bn; - BUN lpages, rpages; - - *rl = *rr = 0; - if( (bl= BATdescriptor(*l)) == NULL ){ - throw(MAL, "algebra.prejoin", INTERNAL_BAT_ACCESS); - } - if( (br= BATdescriptor(*r)) == NULL ){ - BBPreleaseref(bl->batCacheid); - throw(MAL, "algebra.prejoin", INTERNAL_BAT_ACCESS); - } - lpages= (BUN) ((bl->H->heap.size + bl->T->heap.size)/MT_pagesize()); - rpages= (BUN) ((br->H->heap.size + br->T->heap.size)/MT_pagesize()); - - if( bl->batPersistence != TRANSIENT || /* no change in persistent */ - BATtordered(bl) || /* ordered tails are fine */ - bl->batSharecnt || /* avoid dependent views */ - rpages + lpages <= GDKmem_cursize()/MT_pagesize() || /* small operands are ok*/ - (dbl)BATcount(bl) < ( 2* rpages * log((dbl)rpages)) ){ - BBPkeepref(*rl = bl->batCacheid); - BBPkeepref(*rr = br->batCacheid); - return MAL_SUCCEED; - } - ALGODEBUG{ - fprintf(stderr,"Prejoin tuples=" BUNFMT "pages" BUNFMT "," BUNFMT"\n", - BATcount(bl), lpages, rpages); - } - bn= BATmirror(BATsort(BATmirror(bl))); - BBPkeepref(*rr = br->batCacheid); - BBPkeepref(*rl = bn->batCacheid); - BBPreleaseref(bl->batCacheid); - return MAL_SUCCEED; -} - -int -OPTprejoinImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) -{ - int i, limit; - InstrPtr q, p=0, *old= mb->stmt; - int actions = 0; - - (void) cntxt; - (void) pci; - (void) stk; /* to fool compilers */ - - limit= mb->stop; - if ( newMalBlkStmt(mb, mb->ssize) < 0 ) - return 0; - - pushInstruction(mb, old[0]); - for (i = 1; i < limit; i++) { - p= old[i]; - if( getModuleId(p)== algebraRef && getFunctionId(p)== joinRef && - getHeadType(getArgType(mb,p,1)) == TYPE_oid && - getColumnType(getArgType(mb,p,1)) == TYPE_oid ){ - q= newStmt(mb,algebraRef, "prejoin"); - setArgType(mb,q,0,getArgType(mb,p,1)); - q= pushReturn(mb,q,newTmpVariable(mb, getArgType(mb,p,2))); - q= pushArgument(mb,q,getArg(p,1)); - q= pushArgument(mb,q,getArg(p,2)); - getArg(p,1)= getArg(q,0); - getArg(p,2)= getArg(q,1); - actions++; - } - pushInstruction(mb,p); - } - /* we may have uncovered new use-less operations */ - /*chkProgram(cntxtx->fdout, cntxt->nspace,mb);*/ - GDKfree(old); - return actions; -} diff --git a/monetdb5/optimizer/opt_prejoin.h b/monetdb5/optimizer/opt_prejoin.h deleted file mode 100644 --- a/monetdb5/optimizer/opt_prejoin.h +++ /dev/null @@ -1,34 +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-2014 MonetDB B.V. - * All Rights Reserved. - */ - -#ifndef _OPT_PREJOIN_ -#define _OPT_PREJOIN_ -#include "mal.h" -#include "opt_prelude.h" -#include "opt_support.h" -#include "mal_interpreter.h" -#include "mal_instruction.h" -#include "mal_function.h" - -opt_export str ALGprejoin(int *rl, int *rr, int *l, int *r); -opt_export int OPTprejoinImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); - -#define OPTDEBUGprejoin if ( optDebug & (1 <<DEBUG_OPT_PREJOIN) ) - -#endif diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c --- a/monetdb5/optimizer/opt_support.c +++ b/monetdb5/optimizer/opt_support.c @@ -171,7 +171,6 @@ struct OPTcatalog { {"octopus", 0, 0, 0, DEBUG_OPT_OCTOPUS}, {"origin", 0, 0, 0, DEBUG_OPT_ORIGIN}, {"peephole", 0, 0, 0, DEBUG_OPT_PEEPHOLE}, -{"prejoin", 0, 0, 0, DEBUG_OPT_PREJOIN}, {"pushranges", 0, 0, 0, DEBUG_OPT_PUSHRANGES}, {"recycler", 0, 0, 0, DEBUG_OPT_RECYCLE}, {"reduce", 0, 0, 0, DEBUG_OPT_REDUCE}, diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c --- a/monetdb5/optimizer/opt_wrapper.c +++ b/monetdb5/optimizer/opt_wrapper.c @@ -61,7 +61,6 @@ #include "opt_mitosis.h" #include "opt_multiplex.h" #include "opt_octopus.h" -#include "opt_prejoin.h" #include "opt_pushranges.h" #include "opt_pushselect.h" #include "opt_qep.h" @@ -103,7 +102,6 @@ struct{ {"mitosis", &OPTmitosisImplementation}, {"multiplex", &OPTmultiplexImplementation}, {"octopus", &OPToctopusImplementation}, - {"prejoin", &OPTprejoinImplementation}, {"pushranges", &OPTpushrangesImplementation}, {"pushselect", &OPTpushselectImplementation}, {"querylog", &OPTquerylogImplementation}, _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list