Changeset: 34ddd70cdc0f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/34ddd70cdc0f
Modified Files:
gdk/gdk_group.c
Branch: Jul2021
Log Message:
Figure out max group value in subgrouping; correctly set bit shift count.
Two different fixes for the same problem: sqlancer16.
diffs (37 lines):
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -678,10 +678,9 @@ BATgroup_internal(BAT **groups, BAT **ex
if (prop)
maxgrp = prop->val.oval;
MT_lock_unset(&b->theaplock);
- if (is_oid_nil(maxgrp) &&
- BATordered(g) &&
- BATordered_rev(g))
- maxgrp = 0;
+ if (is_oid_nil(maxgrp) /* && BATcount(g) < 10240 */) {
+ BATmax(g, &maxgrp);
+ }
}
if (maxgrp == 0)
g = NULL; /* single group */
@@ -1120,9 +1119,6 @@ BATgroup_internal(BAT **groups, BAT **ex
nbucket |= nbucket >> 32;
#endif
nbucket++;
- /* nbucket is a power of two, so ctz(nbucket)
- * tells us which power of two */
- bits = 8 * SIZEOF_OID - ctz(nbucket);
} else {
nbucket = MAX(HASHmask(cnt), 1 << 16);
}
@@ -1142,6 +1138,9 @@ BATgroup_internal(BAT **groups, BAT **ex
break;
}
}
+ /* nbucket is a power of two, so ctz(nbucket)
+ * tells us which power of two */
+ bits = 8 * SIZEOF_OID - ctz(nbucket);
if ((hs = GDKzalloc(sizeof(Hash))) == NULL ||
(hs->heaplink.farmid = BBPselectfarm(TRANSIENT, b->ttype,
hashheap)) < 0 ||
(hs->heapbckt.farmid = BBPselectfarm(TRANSIENT, b->ttype,
hashheap)) < 0) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list