Changeset: 003efcdbfa68 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/003efcdbfa68
Modified Files:
gdk/gdk_batop.c
Branch: persistent_sketches
Log Message:
BATappend2 revisited for sketches. (WIP)
diffs (46 lines):
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1155,30 +1155,38 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool
}
if (b->tsketch) {
+ MT_lock_set(&b->theaplock);
if (n->tsketch) {
- if (BATcount(b) == 0) {
+ if (BATcount(b) == ci.ncand) { /* b was empty */
memcpy(b->tsketch->base, n->tsketch->base,
SKETCH_SIZE);
- if (b->tunique_est == 0)
+ if (b->tunique_est == 0) {
+ printf("BATappend2 (n has sketch)
estimating for bat id %d\n", b->batCacheid);
b->tunique_est =
sketch_estimate((uint8_t (*)[CLZ_BUCKETS]) b->tsketch->base);
+ }
} else {
if (sketch_merge((uint8_t (*)[CLZ_BUCKETS])
b->tsketch->base,
(uint8_t (*)[CLZ_BUCKETS])
n->tsketch->base) != GDK_SUCCEED)
goto bailout;
+ b->tunique_est = sketch_estimate((uint8_t
(*)[CLZ_BUCKETS]) b->tsketch->base);
}
} else {
uint8_t tmp_sketch[BUCKETS][CLZ_BUCKETS] = {0};
if (bat_sketch(&ni, &ci, tmp_sketch) != GDK_SUCCEED)
goto bailout;
- if (BATcount(b) == 0) {
+ if (BATcount(b) == ci.ncand) { /* b was empty */
memcpy(b->tsketch->base, tmp_sketch,
SKETCH_SIZE);
- if (b->tunique_est == 0)
+ if (b->tunique_est == 0) {
+ printf("BATappend2 (n does not have
sketch) estimating for bat id %d\n", b->batCacheid);
b->tunique_est =
sketch_estimate((uint8_t (*)[CLZ_BUCKETS]) b->tsketch->base);
+ }
} else {
if (sketch_merge((uint8_t (*)[CLZ_BUCKETS])
b->tsketch->base,
(uint8_t (*)[CLZ_BUCKETS])
tmp_sketch) != GDK_SUCCEED)
goto bailout;
+ b->tunique_est = sketch_estimate((uint8_t
(*)[CLZ_BUCKETS]) b->tsketch->base);
}
}
+ MT_lock_unset(&b->theaplock);
}
doreturn:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]