Changeset: 49164109a169 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/49164109a169
Modified Files:
gdk/gdk_strimps.c
monetdb5/modules/mal/pcre.c
Branch: string_imprints
Log Message:
Fix mitosis bug in strimp filtering
diffs (70 lines):
diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -472,7 +472,7 @@ STRMPfilter(BAT *b, BAT *s, char *q)
BAT *r = NULL;
BUN i, ncand;
uint64_t qbmask;
- uint64_t *ptr;
+ uint64_t *bitstring_array;
Strimps *strmps;
oid x;
struct canditer ci;
@@ -491,7 +491,6 @@ STRMPfilter(BAT *b, BAT *s, char *q)
ncand = canditer_init(&ci, b, s);
if (ncand == 0)
- /* Is this correct? */
return BATdense(b->hseqbase, 0, 0);
r = COLnew(b->hseqbase, TYPE_oid, ncand, TRANSIENT);
if (r == NULL) {
@@ -504,14 +503,15 @@ STRMPfilter(BAT *b, BAT *s, char *q)
* (see the macro isIgnored).
*/
qbmask = STRMPmakebitstring(q, strmps);
- ptr = (uint64_t *)strmps->strimps_base;
+ bitstring_array = (uint64_t *)strmps->strimps_base;
for (i = 0; i < ncand; i++) {
- x = canditer_next(&ci) - b->hseqbase;
- if ((*(ptr + x) & qbmask) == qbmask) {
- oid pos = x + b->hseqbase;
- if (BUNappend(r, &pos, false) != GDK_SUCCEED)
+ x = canditer_next(&ci);
+ if ((bitstring_array[x] & qbmask) == qbmask) {
+ if (BUNappend(r, &x, false) != GDK_SUCCEED) {
+ BBPunfix(r->batCacheid);
goto sfilter_fail;
+ }
}
}
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -1873,6 +1873,7 @@ PCRElikeselect(bat *ret, const bat *bid,
str msg = MAL_SUCCEED;
char *ppat = NULL;
bool use_re = false, use_strcmp = false, empty = false;
+ bool use_strimps = true;
if ((b = BATdescriptor(*bid)) == NULL) {
msg = createException(MAL, "algebra.likeselect",
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
@@ -1883,6 +1884,17 @@ PCRElikeselect(bat *ret, const bat *bid,
goto bailout;
}
+ if (use_strimps) {
+ if (STRMPcreate(b, NULL) == GDK_SUCCEED) {
+ BAT *tmp_s;
+ tmp_s = STRMPfilter(b, s, *pat);
+ if(s)
+ BBPunfix(s->batCacheid);
+ s = tmp_s;
+ } /* If we cannot create the strimp just continue normally */
+
+ }
+
assert(ATOMstorage(b->ttype) == TYPE_str);
if ((msg = choose_like_path(&ppat, &use_re, &use_strcmp, &empty, pat,
esc)) != MAL_SUCCEED)
goto bailout;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list