Changeset: 2286e72d1b33 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2286e72d1b33 Modified Files: sql/backends/monet5/UDF/80_udf.sql sql/backends/monet5/datacell/Makefile.ag sql/backends/monet5/datacell/README sql/backends/monet5/datacell/Tests/poc.sql sql/backends/monet5/datacell/opt_datacell.mx sql/backends/monet5/datacell/opt_dataflow.mx Branch: default Log Message:
Intermittent state check diffs (truncated from 336 to 300 lines): diff --git a/sql/backends/monet5/UDF/80_udf.sql b/sql/backends/monet5/UDF/80_udf.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/UDF/80_udf.sql @@ -0,0 +1,21 @@ +/* +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://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html + +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-2011 MonetDB B.V. +All Rights Reserved. +*/ + +create function reverse(src string) +returns string external name udf.reverse; diff --git a/sql/backends/monet5/datacell/Makefile.ag b/sql/backends/monet5/datacell/Makefile.ag --- a/sql/backends/monet5/datacell/Makefile.ag +++ b/sql/backends/monet5/datacell/Makefile.ag @@ -40,7 +40,6 @@ receptor.mx \ petrinet.mx \ dcoperator.mx \ - opt_datacell.mx \ emitter.mx LIBS = ../../../../monetdb5/tools/libmonetdb5 \ @@ -72,7 +71,6 @@ receptor.mal \ emitter.mal \ petrinet.mal \ - opt_datacell.mx \ dcoperator.mal } diff --git a/sql/backends/monet5/datacell/README b/sql/backends/monet5/datacell/README --- a/sql/backends/monet5/datacell/README +++ b/sql/backends/monet5/datacell/README @@ -35,6 +35,7 @@ STOP -> stops the receptor/emitter (closing the connection) These commands allow you to influence tuples movements in the system. +[OBSOLETE] A concrete example is given in the test file: datacell/src/engine/Tests/conveyor/ConveyorScript2.mal.demo diff --git a/sql/backends/monet5/datacell/Tests/poc.sql b/sql/backends/monet5/datacell/Tests/poc.sql --- a/sql/backends/monet5/datacell/Tests/poc.sql +++ b/sql/backends/monet5/datacell/Tests/poc.sql @@ -4,6 +4,7 @@ -- The specific runtime issues are handled by an optimizer create schema datacell; +set optimizer='datacell_pipe'; create table datacell.basket_X( id integer auto_increment, @@ -16,42 +17,44 @@ create function datacell.basket_X() returns table (id integer, tag timestamp, payload integer) begin - return select * from basket_X; + return select * from datacell.basket_X; end; +select * from datacell.basket_X(); + -- to be used by receptor thread create function datacell.receptor_X() returns boolean begin - insert into basket_X(payload) values ( 1); + insert into datacell.basket_X(payload) values ( 1); return true; end; -call register_basket('basket_x'); -call register_receptor('receptor_x','localhost:50100'); -call start_receptor('receptor_x'); +call register_basket('datacell.basket_x'); +call register_receptor('datacell.receptor_x','localhost:50100'); +call start_receptor('datacell.receptor_x'); -create table basket_Y( etag timestamp, like basket_X); +create table datacell.basket_Y( etag timestamp, like datacell.basket_X); -- the continues query is registered and started -create procedure query_X_Y() +create procedure datacell.query_X_Y() begin - insert into basket_Y select now(), * from basket_X() ; + insert into datacell.basket_Y select now(), * from datacell.basket_X() ; end; -call register_query('query_X_Y'); -call start_query('query_X_Y'); +call register_query('datacell.query_X_Y'); +call start_query('datacell.query_X_Y'); -create function basket_Y() +create function datacell.basket_Y() returns table (id integer) begin - return select * from basket_Y; + return select * from datacell.basket_Y; end; -- sent it over the wire. -create function emitter_Y() +create function datacell.emitter_Y() returns boolean; begin - select * from basket_Y(); + select * from datacell.basket_Y(); return true; end; call register_basket('basket_y'); diff --git a/sql/backends/monet5/datacell/opt_datacell.mx b/sql/backends/monet5/datacell/opt_datacell.mx --- a/sql/backends/monet5/datacell/opt_datacell.mx +++ b/sql/backends/monet5/datacell/opt_datacell.mx @@ -20,7 +20,8 @@ @f opt_datacell @a M. Kersten @- Datacell optimizer -Assume simple queries +Assume simple queries . Clear out all non-datacell schema related sql statements, except +for the bare minimum. @{ @mal pattern optimizer.datacell():str @@ -54,24 +55,51 @@ OPTdatacellImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int actions = 0; + int i, j,limit, vlimit, slimit; + InstrPtr p, *old; + + (void) pci; OPTDEBUGdatacell { mnstr_printf(cntxt->fdout, "#Datacell optimizer started\n"); - printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT); + printFunction(cntxt->fdout, mb, stk, LIST_MAL_STMT); + } else (void) stk; + + old= mb->stmt; + limit = mb->stop; + slimit = mb->ssize; + vlimit = mb->vtop; + if ( newMalBlkStmt(mb, slimit) < 0) + return 0; + + for (i = 0; i < limit; i++) { + p = old[i]; + if ( getModuleId(p) == sqlRef ){ + if( getFunctionId(p ) == bindRef && getVarConstant(mb, getArg(p, p->argc-1)).val.ival == 0) { + /* only the primary BAT is used */ + pushInstruction(mb, p); + continue; + } + /* zap all expression arguments */ + clrFunction(p); + p->argc= p->retc; + for ( j=0; j< p->retc; j++ ) + p = pushArgument(mb, p, newTmpVariable(mb, getArgType(mb,p,j)) ); + } + pushInstruction(mb, p); } - (void) stk; - (void) pci; + + for (; i < slimit; i++) + if (old[i]) + freeInstruction(old[i]); - if ( actions) - addPipeDefinition("datacell_pipe", - "inline,remap,datacell,evaluate,costModel,coercions,emptySet,aliases,mitosis," - "mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow," - "history,multiplex,accumulators,garbageCollector" ); - return 0; + return actions; } /* #define _DEBUG_OPTIMIZER_*/ +/* The remainder is the optimizer harnass */ + str OPTdatacell(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){ str modnme; str fcnnme; diff --git a/sql/backends/monet5/datacell/opt_dataflow.mx b/sql/backends/monet5/datacell/opt_dataflow.mx deleted file mode 100644 --- a/sql/backends/monet5/datacell/opt_dataflow.mx +++ /dev/null @@ -1,131 +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://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html - -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-2011 MonetDB B.V. -All Rights Reserved. -@ - -@f opt_datacell -@a M. Kersten -@- Datacell optimizer -Assume simple queries -@{ -@mal -pattern optimizer.datacell():str -address OPTdatacell; -pattern optimizer.datacell(mod:str, fcn:str):str -address OPTdatacell -comment "Datacell expression optimizer"; - -@h -#ifndef _OPT_DATACELL_ -#define _OPT_DATACELL_ -#include "opt_prelude.h" -#include "opt_support.h" - -#define OPTDEBUGdatacell if ( optDebug & (1 <<DEBUG_OPT_DATACELL) ) - -@- -We keep a flow dependency table to detect. -@c -#include "monetdb_config.h" -#include "opt_datacell.h" -#include "opt_deadcode.h" -#include "mal_interpreter.h" /* for showErrors() */ -#include "mal_builder.h" - -static int -OPTdatacellImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) -{ - - addPipeDefinition("default_pipe", - "inline,remap,datacell,evaluate,costModel,coercions,emptySet,aliases,mitosis," - "mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow," - "history,multiplex,accumulators,garbageCollector" ); - OPTDEBUGdatacell { - mnstr_printf(cntxt->fdout, "#Datacell optimizer started\n"); - printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT); - } - (void) stk; - (void) pci; - return 0; -} -@= exportOptimizer -opt_export str OPT@1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); - -@= wrapOptimizer -/* #define _DEBUG_OPTIMIZER_*/ - -str OPT@1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){ - str modnme; - str fcnnme; - str msg= MAL_SUCCEED; - Symbol s= NULL; - lng t,clk= GDKusec(); - int actions = 0; - - optimizerInit(); - if( p ) - removeInstruction(mb, p); - OPTDEBUG@1 mnstr_printf(cntxt->fdout,"=APPLY OPTIMIZER @1\n"); - if( p && p->argc > 1 ){ - if( getArgType(mb,p,1) != TYPE_str || - getArgType(mb,p,2) != TYPE_str || - !isVarConstant(mb,getArg(p,1)) || - !isVarConstant(mb,getArg(p,2)) - ) { - throw(MAL, "optimizer.@1", ILLARG_CONSTANTS); - } - if( stk != 0){ - modnme= *(str*)getArgReference(stk,p,1); - fcnnme= *(str*)getArgReference(stk,p,2); - } else { - modnme= getArgDefault(mb,p,1); _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
