Changeset: f142a60fef9d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f142a60fef9d
Modified Files:
gdk/gdk_select.c
Branch: Aug2024
Log Message:
For sorted bats we can easily find how it overlaps with a search range.
diffs (27 lines):
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1379,11 +1379,21 @@ BATrange(BATiter *bi, const void *tl, co
/* keep locked while we look at the property values */
MT_lock_set(&bi->b->theaplock);
- if (bi->minpos != BUN_NONE)
+ if (bi->sorted && (bi->nonil || atomcmp(BUNtail(*bi, 0),
ATOMnilptr(bi->type)) != 0))
+ minval = BUNtail(*bi, 0);
+ else if (bi->revsorted && (bi->nonil || atomcmp(BUNtail(*bi, bi->count
- 1), ATOMnilptr(bi->type)) != 0))
+ minval = BUNtail(*bi, bi->count - 1);
+ else if (bi->minpos != BUN_NONE)
minval = BUNtail(*bi, bi->minpos);
else if ((minprop = BATgetprop_nolock(bi->b, GDK_MIN_BOUND)) != NULL)
minval = VALptr(minprop);
- if (bi->maxpos != BUN_NONE) {
+ if (bi->sorted && (bi->nonil || atomcmp(BUNtail(bi2, bi->count - 1),
ATOMnilptr(bi->type)) != 0)) {
+ maxval = BUNtail(bi2, bi->count - 1);
+ maxincl = true;
+ } else if (bi->revsorted && (bi->nonil || atomcmp(BUNtail(bi2, 0),
ATOMnilptr(bi->type)) != 0)) {
+ maxval = BUNtail(bi2, 0);
+ maxincl = true;
+ } else if (bi->maxpos != BUN_NONE) {
maxval = BUNtail(bi2, bi->maxpos);
maxincl = true;
} else if ((maxprop = BATgetprop_nolock(bi->b, GDK_MAX_BOUND)) != NULL)
{
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]