Changeset: 8c48c8cbfb73 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c48c8cbfb73 Modified Files: clients/Tests/exports.stable.out clients/mapiclient/tomograph.c gdk/gdk_select.c monetdb5/extras/rdf/rdf.h monetdb5/extras/rdf/rdfalgebra.c monetdb5/extras/rdf/rdfalgebra.mal monetdb5/modules/mal/tokenizer.c monetdb5/modules/mal/tokenizer.h monetdb5/modules/mal/tokenizer.mal sql/backends/monet5/sql.mx sql/storage/bat/bat_storage.c Branch: default Log Message:
merging diffs (truncated from 333 to 300 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 @@ -137,6 +137,7 @@ BUN BATgrows(BAT *b); BAT *BAThash(BAT *b, BUN masksize); BAT *BAThashjoin(BAT *l, BAT *r, BUN estimate); BAT *BAThistogram(BAT *b); +BAT *BATimprints(BAT *b); BAT *BATins(BAT *b, BAT *c, bit force); BAT *BATintersectcand(BAT *a, BAT *b); BAT *BATjoin(BAT *l, BAT *r, BUN estimate); @@ -295,6 +296,7 @@ int HEAPextend(Heap *h, size_t size); int HEAPfree(Heap *h); size_t HEAPmemsize(Heap *h); size_t HEAPvmsize(Heap *h); +void IMPSdestroy(BAT *b); void MRschedule(int taskcnt, void **arg, void( *cmd)(void *p)); int MT_check_nr_cores(void); unsigned long long MT_clock(void); diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c --- a/clients/mapiclient/tomograph.c +++ b/clients/mapiclient/tomograph.c @@ -535,12 +535,12 @@ fixed_colors[] = { { 0, 0, "algebra", "thetajoin", "darkblue" }, { 0, 0, "algebra", "thetasubselect", "lightgreen" }, { 0, 0, "algebra", "tinter", "seagreen" }, - { 0, 0, "algebra", "*", "lightgreen" }, + { 0, 0, "algebra", "*", "green" }, { 0, 0, "batcalc", "dbl", "deeppink" }, { 0, 0, "batcalc", "lng", "deeppink" }, { 0, 0, "batcalc", "hash", "coral" }, { 0, 0, "batcalc", "ifthenelse", "plum" }, - { 0, 0, "batcalc", "*", "lightyellow" }, + { 0, 0, "batcalc", "*", "yellow" }, { 0, 0, "bat", "append", "salmon" }, { 0, 0, "bat", "insert", "salmon" }, { 0, 0, "bat", "mergecand", "orange" }, diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -267,8 +267,10 @@ do { \ hbin = IMPSgetbin(ATOMstorage(b->ttype), imprints->bits, bins, th); \ for (j=lbin; j<=hbin; j++) mask = IMPSsetBit(mask, j); \ innermask = mask; \ - innermask = IMPSunsetBit(innermask, lbin); \ - innermask = IMPSunsetBit(innermask, hbin); \ + if (!b->T->nonil || vl != minval) \ + innermask = IMPSunsetBit(innermask, lbin); \ + if (vh != maxval) \ + innermask = IMPSunsetBit(innermask, hbin); \ if (anti) { \ uint##B##_t tmp = mask; \ mask = ~innermask; \ diff --git a/monetdb5/extras/rdf/rdf.h b/monetdb5/extras/rdf/rdf.h --- a/monetdb5/extras/rdf/rdf.h +++ b/monetdb5/extras/rdf/rdf.h @@ -50,6 +50,10 @@ RDFleftfetchjoin_sortedestimate(int *res rdf_export str RDFleftfetchjoin_sorted(int *result, int* lid, int *rid); +rdf_export str +TKNZRrdf2str (bat *res, bat *bid, bat *map); + +#define RDF_MIN_LITERAL (((oid) 1) << ((sizeof(oid)==8)?62:30)) #define TRIPLE_STORE 1 #define MLA_STORE 2 diff --git a/monetdb5/extras/rdf/rdfalgebra.c b/monetdb5/extras/rdf/rdfalgebra.c --- a/monetdb5/extras/rdf/rdfalgebra.c +++ b/monetdb5/extras/rdf/rdfalgebra.c @@ -23,6 +23,7 @@ #include "rdf.h" #include "algebra.h" #include <gdk.h> +#include "tokenizer.h" str RDFleftfetchjoin_sorted(bat *result, bat *lid, bat *rid) @@ -50,3 +51,66 @@ RDFleftfetchjoin_sorted(bat *result, bat BBPkeepref(*result); return MAL_SUCCEED; } + + +str +TKNZRrdf2str(bat *res, bat *bid, bat *map) +{ + BAT *r, *b, *m; + BATiter bi, mi; + BUN p, q; + str s = NULL; + + b = BATdescriptor(*bid); + if (b == NULL) { + throw(MAL, "rdf.rdf2str", RUNTIME_OBJECT_MISSING " null bat b"); + } + m = BATdescriptor(*map); + if (m == NULL) { + BBPunfix(*bid); + throw(MAL, "rdf.rdf2str", RUNTIME_OBJECT_MISSING "null bat m"); + } + if (!BAThdense(b)) { + BBPunfix(*bid); + BBPunfix(*map); + throw(MAL, "rdf.rdf2str", SEMANTIC_TYPE_ERROR " semantic error"); + } + r = BATnew(TYPE_void, TYPE_str, BATcount(b)); + if (r == NULL) { + BBPunfix(*bid); + BBPunfix(*map); + throw(MAL, "rdf.rdf2str", RUNTIME_OBJECT_MISSING "null bat r"); + } + *res = r->batCacheid; + BATseqbase(r, b->hseqbase); + bi = bat_iterator(b); + mi = bat_iterator(m); + + BATloop(b, p, q) + { + oid id = *(oid *) BUNtloc(bi, p); + if (id >= RDF_MIN_LITERAL) { + BUN pos = BUNfirst(m) + (id - RDF_MIN_LITERAL); + if (pos < BUNfirst(m) || pos >= BUNlast(m)) { + BBPunfix(*bid); + BBPunfix(*map); + BBPunfix(*res); + throw(MAL, "rdf.rdf2str", OPERATION_FAILED " illegal oid"); + } + s = (str) BUNtail(mi, pos); + } else { + str ret = takeOid(id, &s); + if (ret != MAL_SUCCEED) { + BBPunfix(*bid); + BBPunfix(*map); + BBPunfix(*res); + return ret; + } + } + BUNappend(r, s, FALSE); + } + BBPunfix(*bid); + BBPunfix(*map); + BBPkeepref(*res); + return MAL_SUCCEED; +} diff --git a/monetdb5/extras/rdf/rdfalgebra.mal b/monetdb5/extras/rdf/rdfalgebra.mal --- a/monetdb5/extras/rdf/rdfalgebra.mal +++ b/monetdb5/extras/rdf/rdfalgebra.mal @@ -20,3 +20,7 @@ module rdf; command leftfetchjoin_sorted ( left:bat[:any_1,:oid], right:bat[:oid,:any_3] ) :bat[:any_1,:any_3] address RDFleftfetchjoin_sorted comment "like algebra_leftfetchjoin(), but asserts that the resulting tail column is sorted -- ONLY USE IF YOU ARE SURE OF THIS!!! also requires sorted tail left input" + +command rdf2str(i:bat[:oid,:oid],map:bat[:oid,:str]):bat[:oid,:str] +address TKNZRrdf2str +comment "converts id's into strings using the dictionary, but if (id >= RDF_MIN_LITERAL) look it up in a literal map bat"; diff --git a/monetdb5/modules/mal/tokenizer.c b/monetdb5/modules/mal/tokenizer.c --- a/monetdb5/modules/mal/tokenizer.c +++ b/monetdb5/modules/mal/tokenizer.c @@ -448,7 +448,7 @@ TKNZRlocate(Client cntxt, MalBlkPtr mb, return MAL_SUCCEED; } -static str +str takeOid(oid id, str *val) { int i, depth; @@ -505,68 +505,6 @@ TKNZRtakeOid(Client cntxt, MalBlkPtr mb, } str -TKNZRrdf2str(bat *res, bat *bid, bat *map) -{ - BAT *r, *b, *m; - BATiter bi, mi; - BUN p, q; - str s = NULL; - - b = BATdescriptor(*bid); - if (b == NULL) { - throw(MAL, "tokenizer.rdf2str", RUNTIME_OBJECT_MISSING " null bat b"); - } - m = BATdescriptor(*map); - if (m == NULL) { - BBPunfix(*bid); - throw(MAL, "tokenizer.rdf2str", RUNTIME_OBJECT_MISSING "null bat m"); - } - if (!BAThdense(b)) { - BBPunfix(*bid); - BBPunfix(*map); - throw(MAL, "tokenizer.rdf2str", SEMANTIC_TYPE_ERROR " semantic error"); - } - r = BATnew(TYPE_void, TYPE_str, BATcount(b)); - if (r == NULL) { - BBPunfix(*bid); - BBPunfix(*map); - throw(MAL, "tokenizer.rdf2str", RUNTIME_OBJECT_MISSING "null bat r"); - } - *res = r->batCacheid; - BATseqbase(r, b->hseqbase); - bi = bat_iterator(b); - mi = bat_iterator(m); - - BATloop(b, p, q) - { - oid id = *(oid *) BUNtloc(bi, p); - if (id >= RDF_MIN_LITERAL) { - BUN pos = BUNfirst(m) + (id - RDF_MIN_LITERAL); - if (pos < BUNfirst(m) || pos >= BUNlast(m)) { - BBPunfix(*bid); - BBPunfix(*map); - BBPunfix(*res); - throw(MAL, "tokenizer.rdf2str", OPERATION_FAILED " illegal oid"); - } - s = (str) BUNtail(mi, pos); - } else { - str ret = takeOid(id, &s); - if (ret != MAL_SUCCEED) { - BBPunfix(*bid); - BBPunfix(*map); - BBPunfix(*res); - return ret; - } - } - BUNappend(r, s, FALSE); - } - BBPunfix(*bid); - BBPunfix(*map); - BBPkeepref(*res); - return MAL_SUCCEED; -} - -str TKNZRgetIndex(int *r) { if (TRANS == NULL) diff --git a/monetdb5/modules/mal/tokenizer.h b/monetdb5/modules/mal/tokenizer.h --- a/monetdb5/modules/mal/tokenizer.h +++ b/monetdb5/modules/mal/tokenizer.h @@ -22,8 +22,6 @@ #include "mal_client.h" #include "mal_interpreter.h" -#define RDF_MIN_LITERAL (((oid) 1) << ((sizeof(oid)==8)?62:30)) - #ifdef WIN32 #if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && !defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && !defined(LIBMONETDB5) #define tokenizer_export extern __declspec(dllimport) @@ -39,11 +37,11 @@ tokenizer_export str TKNZRclose tokenizer_export str TKNZRappend (oid *pos, str *tuple); tokenizer_export str TKNZRlocate (Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); tokenizer_export str TKNZRtakeOid (Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -tokenizer_export str TKNZRrdf2str (bat *res, bat *bid, bat *map); tokenizer_export str TKNZRdepositFile (int *r, str *fnme); tokenizer_export str TKNZRgetLevel (int *r, int *level); tokenizer_export str TKNZRgetIndex (int *r); tokenizer_export str TKNZRgetCount (int *r); tokenizer_export str TKNZRgetCardinality (int *r); +tokenizer_export str takeOid (oid id, str *val); #endif /* _TKNZR_H */ diff --git a/monetdb5/modules/mal/tokenizer.mal b/monetdb5/modules/mal/tokenizer.mal --- a/monetdb5/modules/mal/tokenizer.mal +++ b/monetdb5/modules/mal/tokenizer.mal @@ -14,10 +14,6 @@ pattern take(i:oid):str address TKNZRtakeOid comment "reconstruct and returns the i-th string"; -command rdf2str(i:bat[:oid,:oid],map:bat[:oid,:str]):bat[:oid,:str] -address TKNZRrdf2str -comment "converts id's into strings using the dictionary, but if (id >= RDF_MIN_LITERAL) look it up in a literal map bat"; - pattern locate(s:str):oid address TKNZRlocate comment "if the given string is in the store returns its oid, otherwise oid_nil"; diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx --- a/sql/backends/monet5/sql.mx +++ b/sql/backends/monet5/sql.mx @@ -3611,11 +3611,7 @@ DELTAproject(bat *result, bat *sub, bat if (i) BBPunfix(i->batCacheid); tres = BATleftfetchjoin(s, res, BATcount(res)); - if (!tres) { - BATprint(s); - BATprint(res); - assert(0); - } + assert(tres); BBPunfix(res->batCacheid); res = tres; @@ -7190,7 +7186,7 @@ SQLrdfShred(Client cntxt, MalBlkPtr mb, if (rid != oid_nil) throw(SQL, "sql.rdfShred", "graph name already exists in rdf.graph"); - id = (int) store_funcs.count_col(gname); + id = (int) store_funcs.count_col(gname, 1); store_funcs.append_col(m->session->tr, gname, *name, TYPE_str); store_funcs.append_col(m->session->tr, gid, &id, TYPE_int); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list