Re: [Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/mal batxml.mx, , 1.25, 1.26 clients.mx, , 1.75, 1.76 mal_init.mx, , 1.131, 1.132 tablet.mx, , 1.121, 1.122 txtsim.mx, , 1.4, 1.5
Martin Kersten wrote:
Update of /cvsroot/monetdb/MonetDB5/src/modules/mal In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26834/mal
Modified Files: batxml.mx clients.mx mal_init.mx tablet.mx txtsim.mx Log Message: Just move comments out of the way so they don't end up in the main program while loading the modules. This gives a polluted and confusing listing when e.g. the socket binding fails during the startup.
U batxml.mx Index: batxml.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/batxml.mx,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- batxml.mx 10 Feb 2008 23:48:46 -0000 1.25 +++ batxml.mx 18 Jun 2008 08:54:58 -0000 1.26 @@ -71,10 +71,12 @@ address BATXMLxquery comment "Execute the XQuery against the elements.";
-#todo -#command xml.table(val:bat[:oid,:str],expr:str):bat[:oid,:xml] -#address BATXMLquery -#comment "Execute the XQuery against the elements"; +@- +todo +command xml.table(val:bat[:oid,:str],expr:str):bat[:oid,:xml] +address BATXMLquery +comment "Execute the XQuery against the elements"; +@mal
command xml.pi(operator:str, ret:bat[:oid,:xml]):bat[:oid,:xml] address XMLpi
U clients.mx Index: clients.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/clients.mx,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- clients.mx 26 Apr 2008 22:39:44 -0000 1.75 +++ clients.mx 18 Jun 2008 08:54:58 -0000 1.76 @@ -26,7 +26,6 @@ @mal module clients;
-#Operations for all clients pattern setListing(flag:int):int address CLTsetListing comment "Turn on/off echo of MAL instructions: @@ -62,7 +61,9 @@ address CLTexit comment "Terminate the session for a single client using a soft error.";
-#Administrator operations +@- +Administrator operations +@mal command getLogins( ):bat[:int,:str] address CLTLogin comment "Pseudo bat of client login time.";
U txtsim.mx Index: txtsim.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/txtsim.mx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- txtsim.mx 11 Jan 2008 10:41:38 -0000 1.4 +++ txtsim.mx 18 Jun 2008 08:54:59 -0000 1.5 @@ -1002,11 +1002,9 @@ throw(MAL, "txtsim.qgramselfjoin", "could not realloc\n"); }
-@mal - +@- #mil implementation
-#mil implementation #proc str2qgrams(str s) : bat[oid,str] #{ # s := qgramnormalize(s); @@ -1015,7 +1013,25 @@ # var b := bat(str,void,len+4); # var i := 0; # var last := " "; +# +# b.insert("#",nil); +# b.insert("#",nil); +# while(i < len) { +# b.insert(s.string(i,1), nil); +# if (b.count() > 32764) break; # ignore suffix of >32KB strings +# i :+= 1; +# } +# b.insert("$",nil); +# b.insert("$",nil); +# b.reverse().seqbase(0@0); +# +# var c0 := b.select(0@0, oid(b.count() - 3)).mark(0@0).reverse(); +# var c1 := b.select(1@0, oid(b.count() - 2)).mark(0@0).reverse(); +# var c2 := b.select(2@0, oid(b.count() - 1)).mark(0@0).reverse(); +# return [+](c0, [+](c1, c2)); +#} #mal implementation +@mal function str2qgrams(s:str):bat[:oid,:str]; s := qgramnormalize(s);
@@ -1024,16 +1040,8 @@ b := bat.new(:str,:oid,len); i := 0; last := " "; -# -# b.insert("#",nil); -# b.insert("#",nil); bat.insert(b,"#",nil:oid); bat.insert(b,"#",nil:oid); -# while(i < len) { -# b.insert(s.string(i,1), nil); -# if (b.count() > 32764) break; # ignore suffix of >32KB strings -# i :+= 1; -# } cnt:= 0:int; id := calc.oid(cnt); barrier B:= i < len; @@ -1044,29 +1052,22 @@ i := calc.+(i,1); redo B:= i < len; exit B; -# b.insert("$",nil); -# b.insert("$",nil); -# b.reverse().seqbase(0@0); bat.insert(b,"$",nil:oid); bat.insert(b,"$",nil:oid); rev := bat.reverse (b); alg := algebra.markH(rev, 0@0); -# -# var c0 := b.select(0@0, oid(b.count() - 3)).mark(0@0).reverse(); cnt := aggr.count(alg); cnt := calc.-(cnt,3); sel := algebra.select(b, 0@0, id); mrk := algebra.markT(sel, 0@0); c0 := bat.reverse(mrk);
-# var c1 := b.select(1@0, oid(b.count() - 2)).mark(0@0).reverse(); cnt := aggr.count(alg); cnt := calc.-(cnt,2); id := calc.oid(cnt); sel := algebra.select(b, 1@0, id); mrk := algebra.markT(sel, 0@0); c1 := bat.reverse(mrk); -# var c2 := b.select(2@0, oid(b.count() - 1)).mark(0@0).reverse(); cnt := aggr.count(alg); cnt := calc.-(cnt,1); id := calc.oid(cnt); @@ -1074,8 +1075,6 @@ mrk := algebra.markT(sel, 0@0); c2 := bat.reverse(mrk);
-# return [+](c0, [+](c1, c2)); -#} res := batcalc.+(c1, c2); res := batcalc.+(c0, res);
U tablet.mx Index: tablet.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v retrieving revision 1.121 retrieving revision 1.122 diff -u -d -r1.121 -r1.122 --- tablet.mx 17 Jun 2008 21:58:18 -0000 1.121 +++ tablet.mx 18 Jun 2008 08:54:58 -0000 1.122 @@ -235,7 +235,6 @@ The dump_format scripts dump a format file for a given set of to be dumped bats. These bats can be dumped with dump_data. @mal -# the major tablet shuffling routines module tablet;
command load( names:bat[:oid,:str], seps:bat[:oid,:str], @@ -303,7 +302,9 @@ address TABsetRowBracket comment "Format the brackets around a row";
-# Set the column properties +@- +Set the column properties +@mal pattern setColumn(idx:int, v:any_1) address TABsetColumn comment "Bind i-th output column to a variable"; @@ -443,7 +444,7 @@ Column columns[1]; /* at least one column, enlarged upon need */ } Tablet;
-tablet_export BAT *TABLETload(BAT *names, BAT *seps, BAT *types, char *datafile, size_t nr); +tablet_export BAT *TABLETload(Tablet *as, char *datafile); tablet_export BAT *TABLETinput(BAT *names, BAT *seps, BAT *types, bstream *s, stream *out, size_t nr, size_t est); tablet_export size_t TABLEToutput(BAT *order, BAT *seps, BAT *bats, stream *s); tablet_export void TABLETdump(BAT *names, BAT *seps, BAT *bats, char *datafile, size_t nr); @@ -451,7 +452,7 @@ /* The low level routines are primarilly used by the SQL front-end.*/ tablet_export int TABLETcreate_bats(Tablet * as, size_t est); tablet_export size_t TABLETassign_BATs(Tablet * as, BAT *bats); -tablet_export ssize_t TABLETload_file(Tablet * as, bstream *b, stream *out); +tablet_export ssize_t TABLETload_file(Tablet * as, bstream *b, stream *out, size_t col1, size_t col2); tablet_export BAT *TABLETcollect_bats(Tablet * as); tablet_export void TABLETdestroy_format(Tablet * as); tablet_export int TABLEToutput_file(Tablet * as, BAT *order, stream *s); @@ -459,7 +460,7 @@ tablet_export ptr *TABLETstrFrStr(Column *c, char *s, char *e); tablet_export ptr *TABLETadt_frStr(void *extra, int type, char *s, char *e, char quote); tablet_export int TABLETadt_toStr(void *extra, char **buf, int *len, int type, ptr a); -tablet_export int insert_line(Tablet * as, char *line, ptr key); +tablet_export int insert_line(Tablet * as, char *line, ptr key, size_t col1, size_t col2 ); I do not see any changes on SQL to support these new function signatures.
It seems SQL compilation will be broken tomorrow morning: r-statement -Wundef -Wp,-D_FORTIFY_SOURCE=2 -c sql_result.c -fPIC -DPIC -o .libs/lib_sql_la-sql_result.o /ufs/goncalve/MonetDB/current/sql/src/backends/monet5/sql_result.mx: In function 'mvc_import_table': /ufs/goncalve/MonetDB/current/sql/src/backends/monet5/sql_result.mx:478: error: too few arguments to function 'TABLETload_file' make[7]: *** [lib_sql_la-sql_result.lo] Error 1 Regards, Romulo
tablet_export int output_file_dense(Tablet * as, stream *fd); tablet_export int has_whitespace(char *sep);
@@ -1376,7 +1377,7 @@ }
INLINE int -insert_line(Tablet * as, char *line, ptr key) +insert_line(Tablet * as, char *line, ptr key, size_t col1, size_t col2 ) { int res = 0; Column *fmt = as->format; @@ -1422,7 +1423,8 @@ if (!e && i == (as->nr_attrs-1)) e = line; if (e) { - res |= insert_val(&fmt[i], s, e, quote, key, &as->error, i); + if (i>= col1 && i< col2) + res |= insert_val(&fmt[i], s, e, quote, key, &as->error, i); quote = 0; line = e + fmt[i].seplen; if (as->error && as->complaints) @@ -1606,7 +1608,7 @@
ssize_t -TABLETload_file(Tablet * as, bstream *b, stream *out) +TABLETload_file(Tablet * as, bstream *b, stream *out, size_t col1, size_t col2) { int res = 0, done = 0; size_t i = 0; @@ -1640,7 +1642,7 @@
if (e) { *e = '\0'; - if (i>=offset && insert_line(as, s, NULL) < 0) { + if (i>=offset && insert_line(as, s, NULL, col1,col2) < 0) { s = e + seplen; b->pos = (s - b->buf); res = -1; @@ -1661,7 +1663,7 @@ res = 1; if (b->len > b->pos && i>=offset && - insert_line(as, s, NULL) < 0 && !as->tryall) { + insert_line(as, s, NULL, col1,col2) < 0 && !as->tryall) { GDKerror(as->error); as->error=0; GDKerror("TABLETload_file: read error " @@ -1810,26 +1812,45 @@ }
BAT * -TABLETload(BAT *names, BAT *seps, BAT *types, char *datafile, size_t nr) +TABLETload(Tablet *as,char *datafile) { - BAT *res; - stream *s = open_rastream(datafile); + BAT *res= NULL; + stream *s = NULL; bstream *b = NULL; - size_t est = nr; + size_t est = as->nr; + size_t col,stride=1; + int error= FALSE;
- if (s == NULL || stream_errnr(s)) { - GDKerror("could not open file %s\n", datafile); - if (s) { - stream_destroy(s); + if ( TABLETcreate_bats(as, est) < 0) + return NULL; + + if (as->nr == ~(size_t) 0) + est = estimator(datafile); +@- +Determine a good Stride for the table at hand. It should be based +on the number of records to be expected and the general system resources. +@c + for (col=0; col <as->nr_attrs; col += stride){ + s = open_rastream(datafile); + if (s == NULL || stream_errnr(s)) { + GDKerror("could not open file %s\n", datafile); + if (s) { + stream_destroy(s); + } + return NULL; } - return NULL; + if (TABLETload_file(as, b = bstream_create(s, SIZE), NULL ,col,col+stride) < 0){ + error= TRUE; + break; + } + + bstream_destroy(b); + stream_close(s); + stream_destroy(s); } - if (nr == ~(size_t) 0) - est = estimator(datafile); - res = TABLETinput(names, seps, types, b = bstream_create(s, SIZE), NULL, nr, est); - bstream_destroy(b); - stream_close(s); - stream_destroy(s); + if( error == FALSE) + res = TABLETcollect_bats(as); + TABLETdestroy_format(as); return res; }
@@ -1841,8 +1862,9 @@
as.nr_attrs = 0; as.nr = nr; - if (create_loadformat(&as, names, seps, types) != ~(size_t) 0 && TABLETcreate_bats(&as, est) >= 0) { - if (TABLETload_file(&as, s, out) >= 0) + if (create_loadformat(&as, names, seps, types) != ~(size_t) 0 && + TABLETcreate_bats(&as, est) >= 0) { + if (TABLETload_file(&as, s, out, 0, as.nr_attrs) >= 0) bats = TABLETcollect_bats(&as); } TABLETdestroy_format(&as); @@ -1917,10 +1939,15 @@ tablet_load(BAT **bats, BAT *names, BAT *seps, BAT *types, str datafile, int *N) { size_t nr = ~(size_t)0; + Tablet as;
if (*N >= 0) nr = *N; - *bats = TABLETload(names, seps, types, datafile, nr); + as.nr_attrs = 0; + as.nr = nr; + + if (create_loadformat(&as, names, seps, types) != ~(size_t) 0 ) + *bats = TABLETload(&as, datafile); } static void tablet_input(BAT **bats, BAT *names, BAT *seps, BAT *types, void **s, int *N)
U mal_init.mx Index: mal_init.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mal_init.mx,v retrieving revision 1.131 retrieving revision 1.132 diff -u -d -r1.131 -r1.132 --- mal_init.mx 2 May 2008 07:34:48 -0000 1.131 +++ mal_init.mx 18 Jun 2008 08:54:58 -0000 1.132 @@ -89,7 +89,9 @@ library chopper; library txtsim;
-#library logger; +@- +library logger; +@mal library transaction;
library mal_isolation; @@ -157,9 +159,13 @@ include factory; include recycle;
-# experimental +@- +experimental +@mal include mat; -# the real partition handler +@- +the real partition handler +@mal include bpm; include inspect; include manual; @@ -203,14 +209,20 @@ include chopper; include txtsim;
-#include logger; +@- +include logger; +@mal include transaction;
-#scheduler components +@- +scheduler components +@mal include mal_isolation; include mal_memorun;
-# Cracker schemes +@- + Cracker schemes +@mal include opt_crack; include opt_joinselect; include opt_remoteQueries;
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
participants (1)
-
Romulo Goncalves