Changeset: 792fc5878ca4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=792fc5878ca4
Modified Files:
gdk/gdk_select.c
Branch: Jul2015
Log Message:
Fix for anti select on sorted bat with candidates that point partially outside
bat.
diffs (53 lines):
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1508,15 +1508,22 @@ BATsubselect(BAT *b, BAT *s, const void
if (anti) {
if (b->tsorted) {
BUN first = SORTfndlast(b, nil) - BUNfirst(b);
- /* match: [first..low) + [high..count) */
+ /* match: [first..low) + [high..last) */
if (s) {
+ /* restrict first, last so
+ * that they refer to existing
+ * head values of b whose tail
+ * is not nil */
oid o = (oid) first + b->H->seq;
+ BUN last;
first = SORTfndfirst(s, &o) -
BUNfirst(s);
o = (oid) low + b->H->seq;
low = SORTfndfirst(s, &o) - BUNfirst(s);
o = (oid) high + b->H->seq;
high = SORTfndfirst(s, &o) -
BUNfirst(s);
- bn = doubleslice(s, first, low, high,
BATcount(s));
+ o = b->H->seq + b->batCount;
+ last = SORTfndfirst(s, &o) -
BUNfirst(s);
+ bn = doubleslice(s, first, low, high,
last);
} else {
bn = doublerange(first + b->hseqbase,
low + b->hseqbase,
@@ -1525,15 +1532,22 @@ BATsubselect(BAT *b, BAT *s, const void
}
} else {
BUN last = SORTfndfirst(b, nil) - BUNfirst(b);
- /* match: [0..low) + [high..last) */
+ /* match: [first..low) + [high..last) */
if (s) {
+ /* restrict first, last so
+ * that they refer to existing
+ * head values of b whose tail
+ * is not nil */
oid o = (oid) last + b->H->seq;
+ BUN first;
last = SORTfndfirst(s, &o) -
BUNfirst(s);
o = (oid) low + b->H->seq;
low = SORTfndfirst(s, &o) - BUNfirst(s);
o = (oid) high + b->H->seq;
high = SORTfndfirst(s, &o) -
BUNfirst(s);
- bn = doubleslice(s, 0, low, high, last);
+ o = b->H->seq;
+ first = SORTfndfirst(s, &o) -
BUNfirst(s);
+ bn = doubleslice(s, first, low, high,
last);
} else {
bn = doublerange(0 + b->hseqbase,
low + b->hseqbase,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list