Changeset: b744d2bbd7d9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b744d2bbd7d9
Modified Files:
gdk/gdk_batop.c
gdk/gdk_private.h
gdk/gdk_select.c
gdk/gdk_unique.c
Branch: Oct2014
Log Message:
More "virtualization" of candidate lists.
diffs (109 lines):
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -2030,18 +2030,7 @@ BATmergecand(BAT *a, BAT *b)
bn->tkey = 1;
bn->T->nil = 0;
bn->T->nonil = 1;
- af = * (const oid *) Tloc(bn, BUNfirst(bn));
- if (af + BATcount(bn) - 1 == *(const oid *) Tloc(bn, BUNlast(bn) - 1)) {
- /* new bat is in fact dense, replace by void column */
- bn->tseqbase = af;
- bn->tdense = 1;
- HEAPfree(&bn->T->heap);
- bn->ttype = TYPE_void;
- bn->tvarsized = 1;
- bn->T->width = 0;
- bn->T->shift = 0;
- }
- return bn;
+ return virtualize(bn);
}
/* intersect two candidate lists and produce a new one
@@ -2131,17 +2120,5 @@ BATintersectcand(BAT *a, BAT *b)
bn->tkey = 1;
bn->T->nil = 0;
bn->T->nonil = 1;
- if (BATcount(bn) == 0 ||
- (af = * (const oid *) Tloc(bn, BUNfirst(bn))) + BATcount(bn) - 1 ==
- * (const oid *) Tloc(bn, BUNlast(bn) - 1)) {
- /* new bat is in fact dense, replace by void column */
- bn->tseqbase = BATcount(bn) == 0 ? 0 : af;
- bn->tdense = 1;
- HEAPfree(&bn->T->heap);
- bn->ttype = TYPE_void;
- bn->tvarsized = 1;
- bn->T->width = 0;
- bn->T->shift = 0;
- }
- return bn;
+ return virtualize(bn);
}
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -197,6 +197,8 @@ void VIEWdestroy(BAT *b)
__attribute__((__visibility__("hidden")));
BAT *VIEWreset(BAT *b)
__attribute__((__visibility__("hidden")));
+BAT *virtualize(BAT *bn)
+ __attribute__((__visibility__("hidden")));
#define BBP_BATMASK 511
#define BBP_THREADMASK 63
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -45,15 +45,17 @@ float nextafterf(float x, float y);
A[(I)] = (V); \
} while (0)
-static BAT *
+BAT *
virtualize(BAT *bn)
{
+ /* input must be a valid candidate list or NULL */
assert(bn == NULL ||
- ((bn->ttype == TYPE_void || bn->ttype == TYPE_oid) &&
+ (((bn->ttype == TYPE_void && bn->tseqbase != oid_nil) ||
+ bn->ttype == TYPE_oid) &&
bn->tkey && bn->tsorted));
/* since bn has unique and strictly ascending tail values, we
* can easily check whether the tail is dense */
- if (bn && !BATtdense(bn) &&
+ if (bn && bn->ttype == TYPE_oid &&
(BATcount(bn) == 0 ||
* (const oid *) Tloc(bn, BUNfirst(bn)) + BATcount(bn) - 1 ==
* (const oid *) Tloc(bn, BUNlast(bn) - 1))) {
@@ -66,8 +68,7 @@ virtualize(BAT *bn)
else
bn->tseqbase = * (const oid *) Tloc(bn, BUNfirst(bn));
bn->tdense = 1;
- if (bn->ttype == TYPE_oid)
- HEAPfree(&bn->T->heap);
+ HEAPfree(&bn->T->heap);
bn->ttype = TYPE_void;
bn->tvarsized = 1;
bn->T->width = 0;
diff --git a/gdk/gdk_unique.c b/gdk/gdk_unique.c
--- a/gdk/gdk_unique.c
+++ b/gdk/gdk_unique.c
@@ -110,7 +110,7 @@ BATsubunique(BAT *b, BAT *s)
nr = BATproject(r, s);
BBPunfix(nb->batCacheid);
BBPunfix(r->batCacheid);
- return nr;
+ return virtualize(nr);
}
assert(b->ttype != TYPE_void);
@@ -310,7 +310,7 @@ BATsubunique(BAT *b, BAT *s)
bn->tkey = 1;
bn->T->nil = 0;
bn->T->nonil = 1;
- return bn;
+ return virtualize(bn);
bunins_failed:
if (seen)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list