Changeset: 8fdd46c994b5 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8fdd46c994b5 Removed Files: sql/backends/monet5/generator/90_generator.mal sql/backends/monet5/generator/90_generator.sql sql/backends/monet5/generator/Makefile.ag sql/backends/monet5/generator/Tests/All sql/backends/monet5/generator/Tests/generator00.sql sql/backends/monet5/generator/Tests/generator00.stable.err sql/backends/monet5/generator/Tests/generator00.stable.out sql/backends/monet5/generator/Tests/generator01.sql sql/backends/monet5/generator/Tests/generator01.stable.err sql/backends/monet5/generator/Tests/generator01.stable.out sql/backends/monet5/generator/Tests/generator02.sql sql/backends/monet5/generator/Tests/generator02.stable.err sql/backends/monet5/generator/Tests/generator02.stable.out sql/backends/monet5/generator/Tests/generator03.sql sql/backends/monet5/generator/Tests/generator03.stable.err sql/backends/monet5/generator/Tests/generator03.stable.out sql/backends/monet5/generator/Tests/joins00.sql sql/backends/monet5/generator/Tests/joins00.stable.err sql/backends/monet5/generator/Tests/joins00.stable.out sql/backends/monet5/generator/generator.c sql/backends/monet5/generator/generator.h sql/backends/monet5/generator/generator.mal Modified Files: gdk/gdk.h gdk/gdk_imprints.c monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/batExtensions.h monetdb5/modules/mal/batExtensions.mal monetdb5/modules/mal/calc.mal.sh sql/backends/monet5/Makefile.ag Branch: transaction-replication Log Message:
Merge with default branch diffs (truncated from 2435 to 300 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2196,9 +2196,6 @@ gdk_export void IMPSdestroy(BAT *b); gdk_export BAT *BATimprints(BAT *b); gdk_export lng IMPSimprintsize(BAT *b); -gdk_export BAT *BATbloom(BAT *b); -gdk_export BAT *BLOOMselect(BAT *b, BAT *s, BAT *bf); - /* * @- Multilevel Storage Modes * diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -28,7 +28,6 @@ #include "gdk.h" #include "gdk_private.h" #include "gdk_imprints.h" -#include "gdk_calc_private.h" #define BINSIZE(B, FUNC, T) do { \ switch (B) { \ @@ -903,240 +902,3 @@ do { \ free(s); } #endif - -/* round hashing */ - -#define smpl_xor_rng(R,X) {\ -R = X; \ -R ^= (R<<13); \ -R ^= (R>>17); \ -R ^= (R<<5); \ -} - -#define hash_init(S,X,Y,Z) {\ -smpl_xor_rng(X,S); \ -smpl_xor_rng(Y,X); \ -smpl_xor_rng(Z,Y); \ -} - -#define next_hash(N,X,Y,Z) {\ -N = (X^(X<<3))^(Y^(Y>>19))^(Z^(Z<<6)); \ -X = Y; \ -Y = Z; \ -Z = N; \ -} - -#define hash_mod(V,MOD) ((V) % (MOD)) - -BAT * -BATbloom(BAT *b) { - BAT *bn; - BUN cnt; - BUN mn; - BUN p; - bit *o; - - assert(BAThdense(b)); /* assert void head */ - - switch (ATOMstorage(b->T->type)) { - case TYPE_bte: - case TYPE_sht: - case TYPE_int: - case TYPE_lng: - case TYPE_flt: - case TYPE_dbl: - break; - default: /* type not supported */ - GDKerror("#BATbloom: col type not " - "suitable for bloom filters.\n"); - return b; /* do nothing */ - } - - BATcheck(b, "BATblooms"); - - cnt = BATcount(b); - mn = 4 * cnt; /* make it power of 2 for faster modulo */ - - bn = BATnew(TYPE_void, TYPE_bit, mn); - if (bn == NULL) { - GDKerror("#BATbloom: memory allocation error"); - return NULL; - } - - o = (bit *) Tloc(bn, BUNfirst(bn)); - for (p = 0; p < mn; p++) { - o[p] = 0; - } - -#define BLOOM_BUILD(TYPE) \ -do { \ - oid key,hv,x,y,z; /* for hashing */ \ - TYPE *ob = (TYPE *)Tloc(b, BUNfirst(b)); \ - for (p = 0; p < cnt; p++) { \ - key = (oid) ob[p]; \ - hash_init(key, x,y,z); \ - next_hash(hv, x,y,z); \ - o[hash_mod(hv,mn)] = 1; \ - next_hash(hv, x,y,z); \ - o[hash_mod(hv,mn)] = 1; \ - next_hash(hv, x,y,z); \ - o[hash_mod(hv,mn)] = 1; \ - } \ -} while (0) - switch (ATOMstorage(b->T->type)) { - case TYPE_bte: - BLOOM_BUILD(bte); - break; - case TYPE_sht: - BLOOM_BUILD(sht); - break; - case TYPE_int: - BLOOM_BUILD(int); - break; - case TYPE_lng: - BLOOM_BUILD(lng); - break; - case TYPE_flt: - BLOOM_BUILD(flt); - break; - case TYPE_dbl: - BLOOM_BUILD(dbl); - break; - default: - /* should never reach here */ - assert(0); - } - - /* property management */ - BATsetcount(bn, mn); - bn->trevsorted = 0; - bn->tsorted = 0; - bn->tkey = 0; - bn->tdense = 0; - bn->hdense = 1; - bn->hseqbase = 0; - bn->hkey = 1; - bn->hrevsorted = bn->batCount <= 1; - - return bn; -} - -BAT * -BLOOMselect(BAT *b, BAT *s, BAT *bf) { - BAT *bn; - BUN start, end, cnt, mn; - const oid *cand = NULL, *candend = NULL; - const bit *bloom; - - assert(BAThdense(b)); /* assert void head */ - assert(BAThdense(bf)); /* assert void head*/ - - switch (ATOMstorage(b->T->type)) { - case TYPE_bte: - case TYPE_sht: - case TYPE_int: - case TYPE_lng: - case TYPE_flt: - case TYPE_dbl: - break; - default: /* type not supported */ - GDKerror("#BATbloom: b col type not " - "suitable for bloom filters.\n"); - return NULL; /* do nothing */ - } - - if (BATttype(bf) != TYPE_bit) { - GDKerror("#BATbloom: bf col type not " - "a bloom filters.\n"); - return NULL; /* do nothing */ - } - - bloom = (bit *) Tloc(bf, BUNfirst(bf)); - mn = BATcount(bf); - - CANDINIT(b, s, start, end, cnt, cand, candend); - - if (start == end) { - /* trivial: empty result */ - bn = BATnew(TYPE_void, TYPE_void, 0); - if (bn == NULL) { - return NULL; - } - BATsetcount(bn, 0); - BATseqbase(bn, 0); - BATseqbase(BATmirror(bn), b->hseqbase); - return bn; - } - - bn = BATnew(TYPE_void, TYPE_oid, 1024); - if (bn == NULL) { - return NULL; - } - -#define TEST_BLOOM(TYPE) \ -do { \ - oid key,hv,x,y,z; /* for hashing */ \ - oid i, o; \ - TYPE *ob = (TYPE *)Tloc(b, BUNfirst(b)); \ - for (;;) { \ - if (cand) { \ - if (cand == candend) \ - break; \ - i = *cand++ - b->hseqbase; \ - if (i >= end) \ - break; \ - } else { \ - i = start++; \ - if (i == end) \ - break; \ - } \ - key = ob[i]; \ - hash_init(key, x,y,z); \ - next_hash(hv, x,y,z); \ - if (bloom[hash_mod(hv,mn)]) { \ - next_hash(hv, x,y,z); \ - if (bloom[hash_mod(hv,mn)]) { \ - next_hash(hv, x,y,z); \ - if (bloom[hash_mod(hv,mn)]) {\ - o = i + b->hseqbase; \ - bunfastapp(bn, &o); \ - } \ - } \ - } \ - } \ -} while (0) - switch (ATOMstorage(b->T->type)) { - case TYPE_bte: - TEST_BLOOM(bte); - break; - case TYPE_sht: - TEST_BLOOM(sht); - break; - case TYPE_int: - TEST_BLOOM(int); - break; - case TYPE_lng: - TEST_BLOOM(lng); - break; - case TYPE_flt: - TEST_BLOOM(flt); - break; - case TYPE_dbl: - TEST_BLOOM(dbl); - break; - default: - /* should never reach here */ - assert(0); - } - - bn->tsorted = 1; - bn->trevsorted = BATcount(bn) <= 1; - bn->tkey = 1; - bn->T->nil = 0; - bn->T->nonil = 1; - return bn; - -bunins_failed: - BBPreclaim(bn); - return NULL; -} diff --git a/monetdb5/modules/mal/batExtensions.c b/monetdb5/modules/mal/batExtensions.c --- a/monetdb5/modules/mal/batExtensions.c +++ b/monetdb5/modules/mal/batExtensions.c @@ -283,7 +283,6 @@ CMDBATimprints(int *ret, int *bid) BBPkeepref(*ret = b->batCacheid); return MAL_SUCCEED; } - str CMDBATimprintsize(lng *ret, int *bid) { @@ -296,45 +295,3 @@ CMDBATimprintsize(lng *ret, int *bid) BBPreleaseref(b->batCacheid); return MAL_SUCCEED; } - -str -CMDBATbloom(int *ret, int *bid) -{ - BAT *b, *bn; - - if ((b = BATdescriptor(*bid)) == NULL) - throw(MAL, "bat.bloom", INTERNAL_BAT_ACCESS); - - bn = BATbloom(b); - BBPkeepref(*ret = bn->batCacheid); - BBPreleaseref(b->batCacheid); - return MAL_SUCCEED; -} - -str -CMDBLOOMselect(int *ret, int *bid, int *sid, int *bfid) -{ - BAT *b, *s, *bf, *bn; - _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list