Changeset: fffc48ef72c1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fffc48ef72c1
Modified Files:
sql/backends/monet5/iot/Tests/iot06.stable.out
sql/backends/monet5/iot/Tests/webtest.sql
sql/backends/monet5/iot/basket.c
sql/backends/monet5/iot/iot.c
sql/backends/monet5/iot/petrinet.c
Branch: iot
Log Message:
Fix iot.show
diffs (244 lines):
diff --git a/sql/backends/monet5/iot/Tests/iot06.stable.out
b/sql/backends/monet5/iot/Tests/iot06.stable.out
--- a/sql/backends/monet5/iot/Tests/iot06.stable.out
+++ b/sql/backends/monet5/iot/Tests/iot06.stable.out
@@ -37,8 +37,18 @@ Ready.
% .explain # table_name
% mal # name
% clob # type
+% 29 # length
+function user.petri_0():void;
+ sql.transaction();
+ user.iot_cq06();
+ sql.commit();
+end user.petri_0;
+#call iot.show('iot','cq06');
+% .explain # table_name
+% mal # name
+% clob # type
% 63 # length
-unsafe function iot.cq06():void;
+unsafe function user.iot_cq06():void;
X_0 := sql.mvc();
X_32 := basket.register(X_0,"iot","tmp06",0);
barrier X_60 := language.dataflow();
@@ -63,8 +73,8 @@ exit SQLexception:str;
catch MALexception:str;
iot.error("user","cq06",MALexception);
exit MALexception:str;
-end iot.cq06;
-#inline actions= 0 time=4 usec
+end user.iot_cq06;
+#inline actions= 0 time=2 usec
#candidates actions= 1 time=1 usec
#remap actions= 1 time=15 usec
#iot actions= 1 time=34 usec
diff --git a/sql/backends/monet5/iot/Tests/webtest.sql
b/sql/backends/monet5/iot/Tests/webtest.sql
--- a/sql/backends/monet5/iot/Tests/webtest.sql
+++ b/sql/backends/monet5/iot/Tests/webtest.sql
@@ -16,6 +16,7 @@ begin
end;
call iot.query('iot','web00');
+call iot.show('iot','web00');
call iot.stop();
--select * from iot.baskets();
diff --git a/sql/backends/monet5/iot/basket.c b/sql/backends/monet5/iot/basket.c
--- a/sql/backends/monet5/iot/basket.c
+++ b/sql/backends/monet5/iot/basket.c
@@ -516,13 +516,20 @@ BSKTimportInternal(Client cntxt, int bsk
for( i=0; i < MAXCOLS && baskets[bskt].cols[i]; i++){
b = baskets[bskt].bats[i];
assert( b );
- BATsettrivprop(b);
if( first){
first = 0;
cnt = BATcount(b);
} else
if( cnt != BATcount(b))
msg= createException(MAL,"iot.basket","Columns
mis-aligned %s\n",baskets[bskt].cols[i]);
+ b->tnil= 0;
+ b->tnonil= 0;
+ b->tnokey[0] = 0;
+ b->tnokey[1] = 0;
+ b->tsorted = 0;
+ b->tnosorted = 0;
+ b->tnorevsorted = 0;
+ BATsettrivprop(b);
}
/* remove the basket files */
for( i=0; i < MAXCOLS && baskets[bskt].cols[i]; i++){
diff --git a/sql/backends/monet5/iot/iot.c b/sql/backends/monet5/iot/iot.c
--- a/sql/backends/monet5/iot/iot.c
+++ b/sql/backends/monet5/iot/iot.c
@@ -69,7 +69,6 @@ IOTprocedureStmt(Client cntxt, MalBlkPtr
str
IOTquery(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
- str sch= NULL;
str nme= NULL;
str def= NULL;
int calls = -1;
@@ -78,7 +77,6 @@ IOTquery(Client cntxt, MalBlkPtr mb, Mal
MalBlkPtr qry;
str msg = NULL;
InstrPtr p;
- Module scope;
char buf[BUFSIZ], name[IDLENGTH];
static int iotquerycnt=0;
int i;
@@ -86,14 +84,13 @@ IOTquery(Client cntxt, MalBlkPtr mb, Mal
if( pci->argc > 2)
calls = *getArgReference_int(stk,pci,2);
- _DEBUG_IOT_ fprintf(stderr,"#iot: register the continues query
%s.%s()\n",sch,nme);
+ _DEBUG_IOT_ fprintf(stderr,"#iot: register the continues query
%s.%s()\n",userRef,nme);
// pre-create the new procedure
- sch = "user";
snprintf(name, IDLENGTH,"cquery_%d",iotquerycnt++);
def = *getArgReference_str(stk, pci, 1);
// package it as a procedure in the current schema [todo]
- snprintf(buf,BUFSIZ,"create procedure %s.%s() begin %s;
end",sch,name,def);
+ snprintf(buf,BUFSIZ,"create procedure %s.%s() begin %s;
end",userRef,name,def);
_DEBUG_IOT_ fprintf(stderr,"#iot.compile: %s\n",buf);
nme = name;
msg = SQLstatementIntern(cntxt, &def, nme, 1, 0, 0);
@@ -106,17 +103,16 @@ IOTquery(Client cntxt, MalBlkPtr mb, Mal
msg = createException(SQL,"iot.query","Error in iot query");
_DEBUG_IOT_ fprintf(stderr,"#iot: register a new continuous query
plan\n");
- scope = findModule(cntxt->nspace, putName(sch));
- s = newFunction(putName(sch), putName(nme), FUNCTIONsymbol);
+ s = newFunction(userRef, putName(nme), FUNCTIONsymbol);
if (s == NULL)
msg = createException(SQL, "iot.query", "Procedure code does
not exist.");
freeMalBlk(s->def);
s->def = copyMalBlk(qry);
p = getInstrPtr(s->def, 0);
- setModuleId(p, putName(sch));
+ setModuleId(p, userRef);
setFunctionId(p, putName(nme));
- insertSymbol(scope, s);
+ insertSymbol(cntxt->nspace, s);
_DEBUG_IOT_ printFunction(cntxt->fdout, s->def, 0, LIST_MAL_ALL);
/* optimize the code and register at scheduler */
if (msg == MAL_SUCCEED)
@@ -146,15 +142,16 @@ IOTqueryProc(Client cntxt, MalBlkPtr mb,
MalBlkPtr qry;
str msg = NULL;
InstrPtr p;
- Module scope;
+ //Module scope;
int i;
-
+ char name[IDLENGTH];
_DEBUG_IOT_ fprintf(stderr,"#iot: register the continues query
%s.%s()\n",sch,nme);
/* check existing of the pre-compiled and activated function */
sch = *getArgReference_str(stk, pci, 1);
nme = *getArgReference_str(stk, pci, 2);
+ snprintf(name,IDLENGTH,"%s_%s",sch,nme);
if( pci->argc > 3)
calls = *getArgReference_int(stk,pci,3);
@@ -167,9 +164,6 @@ IOTqueryProc(Client cntxt, MalBlkPtr mb,
s = findSymbolInModule(cntxt->nspace, putName(nme));
if (s == NULL)
throw(SQL, "iot.query", "Definition missing");
- //snprintf(name, IDLENGTH,"cq_%s",getFunctionId(getInstrPtr(s->def,0)));
- /* re-package the MAL block for the petrinet */
- //nme = name;
qry = s->def;
chkProgram(cntxt->fdout,cntxt->nspace,qry);
@@ -177,17 +171,16 @@ IOTqueryProc(Client cntxt, MalBlkPtr mb,
msg = createException(SQL,"iot.query","Error in iot query");
_DEBUG_IOT_ fprintf(stderr,"#iot: register a new continuous query
plan\n");
- scope = findModule(cntxt->nspace, putName(sch));
- s = newFunction(putName(sch), putName(nme), FUNCTIONsymbol);
+ s = newFunction(userRef, putName(name), FUNCTIONsymbol);
if (s == NULL)
msg = createException(SQL, "iot.query", "Procedure code does
not exist.");
freeMalBlk(s->def);
s->def = copyMalBlk(qry);
p = getInstrPtr(s->def, 0);
- setModuleId(p, putName(sch));
- setFunctionId(p, putName(nme));
- insertSymbol(scope, s);
+ setModuleId(p,userRef);
+ setFunctionId(p, putName(name));
+ insertSymbol(cntxt->nspace, s);
_DEBUG_IOT_ printFunction(cntxt->fdout, s->def, 0, LIST_MAL_ALL);
/* optimize the code and register at scheduler */
if (msg == MAL_SUCCEED)
diff --git a/sql/backends/monet5/iot/petrinet.c
b/sql/backends/monet5/iot/petrinet.c
--- a/sql/backends/monet5/iot/petrinet.c
+++ b/sql/backends/monet5/iot/petrinet.c
@@ -144,8 +144,10 @@ static int
PNlocate(str modname, str fcnname)
{
int i;
+ char name[IDLENGTH];
+ snprintf(name,IDLENGTH,"%s_%s",modname,fcnname);
for (i = 0; i < pnettop; i++)
- if (strcmp(pnet[i].modname, modname) == 0 &&
strcmp(pnet[i].fcnname, fcnname) == 0)
+ if (strcmp(pnet[i].modname, userRef) == 0 &&
strcmp(pnet[i].fcnname, name) == 0)
return i;
return i;
}
@@ -159,10 +161,12 @@ PNshow(Client cntxt, MalBlkPtr mb, MalSt
int i;
InstrPtr p;
Symbol s;
+ char name[IDLENGTH];
(void) cntxt;
(void) mb;
+ snprintf(name,IDLENGTH,"%s_%s",sch,fcn);
idx = PNlocate(sch, fcn);
if( idx == pnettop)
throw(SQL,"basket.commit","Continous query %s.%s not
accessible\n",sch,fcn);
@@ -170,8 +174,8 @@ PNshow(Client cntxt, MalBlkPtr mb, MalSt
printFunction(cntxt->fdout, pnet[idx].mb, 0, LIST_MAL_NAME |
LIST_MAL_VALUE | LIST_MAL_MAPI);
for( i= 1; i< pnet[idx].mb->stop; i++){
p= getInstrPtr(pnet[idx].mb,i);
- if(getFunctionId(p) && strcmp(getFunctionId(p), fcn) ==0){
- s = findSymbol(0,userRef, getFunctionId(p));
+ if(getFunctionId(p) && strcmp(getFunctionId(p), name) ==0){
+ s = findSymbol(cntxt->nspace,userRef, getFunctionId(p));
if( s) {
printFunction(cntxt->fdout, s->def, 0,
LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_MAPI);
return MAL_SUCCEED;
@@ -199,7 +203,7 @@ PNregisterInternal(Client cntxt, MalBlkP
GDKerror("petrinet.register:Too many transitions");
sig = getInstrPtr(mb,0);
- i = PNlocate(getModuleId(sig), getFunctionId(sig));
+ i = PNlocate(userRef, getFunctionId(sig));
if (i != pnettop){
// restart the query
pnet[pnettop].status = PNWAIT;
@@ -208,14 +212,14 @@ PNregisterInternal(Client cntxt, MalBlkP
}
memset((void*) (pnet+pnettop), 0, sizeof(PNnode));
- pnet[pnettop].modname = GDKstrdup(getModuleId(sig));
+ pnet[pnettop].modname = GDKstrdup(userRef);
pnet[pnettop].fcnname = GDKstrdup(getFunctionId(sig));
snprintf(buf,IDLENGTH,"petri_%d",pnettop);
- s = newFunction(iotRef, putName(buf), FUNCTIONsymbol);
+ s = newFunction(userRef, putName(buf), FUNCTIONsymbol);
nmb = s->def;
setArgType(nmb, nmb->stmt[0],0, TYPE_void);
(void) newStmt(nmb, sqlRef, transactionRef);
- (void) newStmt(nmb,pnet[pnettop].modname, pnet[pnettop].fcnname);
+ (void) newStmt(nmb, userRef,getFunctionId(sig));
q = newStmt(nmb, sqlRef, commitRef);
setArgType(nmb,q, 0, TYPE_void);
pushEndInstruction(nmb);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list