Changeset: 69b3788e639e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/69b3788e639e
Modified Files:
gdk/gdk_aggr.c
gdk/gdk_unique.c
Branch: Jan2022
Log Message:
Update properties.
min/max positions can be perhaps be set in BATmin/max and key in BATunique.
diffs (88 lines):
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3824,7 +3824,21 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
if (is_oid_nil(pos)) {
res = ATOMnilptr(b->ttype);
} else {
- res = BUNtail(bi, pos - b->hseqbase);
+ bi.minpos = pos - b->hseqbase;
+ res = BUNtail(bi, bi.minpos);
+ MT_lock_set(&b->theaplock);
+ if (bi.count == BATcount(b) && bi.h == b->theap)
+ b->tminpos = bi.minpos;
+ MT_lock_unset(&b->theaplock);
+ bat pbid = VIEWtparent(b);
+ if (pbid) {
+ BAT *pb = BBP_cache(pbid);
+ MT_lock_set(&pb->theaplock);
+ if (bi.count == BATcount(pb) &&
+ bi.h == pb->theap)
+ pb->tminpos = bi.minpos;
+ MT_lock_unset(&pb->theaplock);
+ }
}
}
if (aggr == NULL) {
@@ -3964,7 +3978,21 @@ BATmax_skipnil(BAT *b, void *aggr, bit s
if (is_oid_nil(pos)) {
res = ATOMnilptr(b->ttype);
} else {
- res = BUNtail(bi, pos - b->hseqbase);
+ bi.maxpos = pos - b->hseqbase;
+ res = BUNtail(bi, bi.maxpos);
+ MT_lock_set(&b->theaplock);
+ if (bi.count == BATcount(b) && bi.h == b->theap)
+ b->tmaxpos = bi.maxpos;
+ MT_lock_unset(&b->theaplock);
+ bat pbid = VIEWtparent(b);
+ if (pbid) {
+ BAT *pb = BBP_cache(pbid);
+ MT_lock_set(&pb->theaplock);
+ if (bi.count == BATcount(pb) &&
+ bi.h == pb->theap)
+ pb->tmaxpos = bi.maxpos;
+ MT_lock_unset(&pb->theaplock);
+ }
}
}
if (aggr == NULL) {
diff --git a/gdk/gdk_unique.c b/gdk/gdk_unique.c
--- a/gdk/gdk_unique.c
+++ b/gdk/gdk_unique.c
@@ -273,6 +273,21 @@ BATunique(BAT *b, BAT *s)
TIMEOUT_CHECK(timeoffset,
GOTO_LABEL_TIMEOUT_HANDLER(bunins_failed));
}
+ if (BATcount(bn) == bi.count) {
+ /* it turns out all values are distinct */
+ MT_lock_set(&b->theaplock);
+ if (BATcount(b) == bi.count) {
+ /* and the input hasn't changed in the mean
+ * time--the only allowed change being appends;
+ * updates not allowed since the candidate list
+ * covers the complete bat */
+ assert(b->tnokey[0] == 0);
+ assert(b->tnokey[1] == 0);
+ b->tkey = true;
+ b->batDirtydesc = true;
+ }
+ MT_lock_unset(&b->theaplock);
+ }
bat_iterator_end(&bi);
bn->theap->dirty = true;
@@ -281,13 +296,6 @@ BATunique(BAT *b, BAT *s)
bn->tkey = true;
bn->tnil = false;
bn->tnonil = true;
- if (BATcount(bn) == bi.count) {
- /* it turns out all values are distinct */
- assert(b->tnokey[0] == 0);
- assert(b->tnokey[1] == 0);
- b->tkey = true;
- b->batDirtydesc = true;
- }
bn = virtualize(bn);
MT_thread_setalgorithm(algomsg);
TRC_DEBUG(ALGO, "b=" ALGOBATFMT
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list