Changeset: d058ae4cb458 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d058ae4cb458
Modified Files:
        gdk/gdk_strimps.c
Branch: Jun2023
Log Message:

Fix an off-by-one bug in strimps iteration

This bug would create different bitstrings for the strings 'Karen'
and 'Karen%'. Although running a like query would not be affected
because "like 'Karen'" would not use strimps filtering, now that we
are developing startswith and related functions, patterns like 'Karen'
use strimps and need to be taken into account.


diffs (21 lines):

diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -141,7 +141,7 @@ histogram_index(PairHistogramElem *hist,
 inline static bool
 pair_at(PairIterator *pi, CharPair *p)
 {
-       if (pi->pos >= pi->lim)
+       if (pi->pos >= pi->lim - 1)
                return false;
        p->pbytes = (uint8_t*)pi->s + pi->pos;
        p->psize = 2;
@@ -151,7 +151,7 @@ pair_at(PairIterator *pi, CharPair *p)
 inline static bool
 next_pair(PairIterator *pi)
 {
-       if (pi->pos >= pi->lim)
+       if (pi->pos >= pi->lim - 1)
                return false;
        pi->pos++;
        return true;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to