Changeset: 44806adbe2db for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/44806adbe2db
Modified Files:
gdk/gdk.h
gdk/gdk_batop.c
gdk/gdk_join.c
monetdb5/modules/kernel/aggr.c
Branch: cnting_sketches
Log Message:
Use unique est in guess_uniques
diffs (57 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -447,7 +447,7 @@ typedef struct BAT {
PROPrec *tprops; /* list of dynamic properties stored in the bat
descriptor */
uint8_t cnting_sketch[BUCKETS][CLZ_BUCKETS];
- uint64_t estimate;
+ double estimate;
MT_Lock sketch_lock;
MT_Lock theaplock; /* lock protecting heap reference changes */
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -813,7 +813,7 @@ estimator(uint8_t cnt_sketch[BUCKETS][CL
double s = sigma((double)C[0] / BUCKETS);
z += (double)BUCKETS * s;
const double alpha = 0.7213475204444817;
- return llroundl(alpha * (double)BUCKETS * BUCKETS / z);
+ return alpha * (double)BUCKETS * BUCKETS / z;
}
static inline void
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3542,6 +3542,8 @@ count_unique(BAT *b, BAT *s, BUN *cnt1,
static double
guess_uniques(BAT *b, struct canditer *ci)
{
+ if (b->estimate)
+ return b->estimate;
BUN cnt1 = 0, cnt2;
BUN max = b->twidth < SIZEOF_BUN ? (BUN) 1 << (8*b->twidth) : BUN_MAX;
BAT *s1;
@@ -3625,6 +3627,8 @@ BATguess_uniques(BAT *b, struct canditer
return 0;
if (b->batCount == 1 || (ci && ci->ncand == 1))
return 1;
+ if (b->estimate)
+ return b->estimate;
struct canditer lci;
if (ci == NULL) {
canditer_init(&lci, b, NULL);
diff --git a/monetdb5/modules/kernel/aggr.c b/monetdb5/modules/kernel/aggr.c
--- a/monetdb5/modules/kernel/aggr.c
+++ b/monetdb5/modules/kernel/aggr.c
@@ -1636,7 +1636,7 @@ AGGRcde(Client c, int *estimate, const b
if (VIEWtparent(b)) {
BAT *pb = BATdescriptor(VIEWtparent(b));
assert(pb);
- printf("cnt dist est prop %lu\n", pb->estimate);
+ printf("cnt dist est prop %f\n", pb->estimate);
BBPreclaim(pb);
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]