Changeset: 9272c3dac104 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9272c3dac104
Modified Files:
        gdk/gdk_bat.c
        gdk/gdk_batop.c
Branch: candidate-exceptions
Log Message:

Teach BATslice and BATassertProps about candidates with exceptions.


diffs (49 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2224,10 +2224,29 @@ BATassertProps(BAT *b)
                assert(b->twidth == 0);
                assert(b->tsorted);
                if (is_oid_nil(b->tseqbase)) {
+                       assert(b->tvheap == NULL);
                        assert(BATcount(b) == 0 || !b->tnonil);
                        assert(BATcount(b) <= 1 || !b->tkey);
                        assert(b->trevsorted);
                } else {
+                       if (b->tvheap != NULL) {
+                               /* candidate list with exceptions */
+                               assert(b->batRole == TRANSIENT);
+                               assert(b->tvheap->free <= b->tvheap->size);
+                               assert(b->tvheap->free % SIZEOF_OID == 0);
+                               if (b->tvheap->free > 0) {
+                                       const oid *oids = (const oid *) 
b->tvheap->base;
+                                       q = b->tvheap->free / SIZEOF_OID;
+                                       assert(oids != NULL);
+                                       assert(b->tseqbase + BATcount(b) + q <= 
GDK_oid_max);
+                                       /* exceptions within range */
+                                       assert(oids[0] >= b->tseqbase);
+                                       assert(oids[q - 1] < b->tseqbase + 
BATcount(b) + q);
+                                       /* exceptions sorted */
+                                       for (p = 1; p < q; p++)
+                                               assert(oids[p - 1] < oids[p]);
+                               }
+                       }
                        assert(b->tseqbase + b->batCount <= GDK_oid_max);
                        assert(BATcount(b) == 0 || !b->tnil);
                        assert(BATcount(b) <= 1 || !b->trevsorted);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -926,6 +926,12 @@ BATslice(BAT *b, BUN l, BUN h)
                return NULL;
        }
 
+       if (b->ttype == TYPE_void && b->tvheap != NULL) {
+               /* slicing a candidate list with exceptions */
+               struct canditer ci;
+               canditer_init(&ci, NULL, b);
+               return canditer_slice(&ci, l, h);
+       }
        /* If the source BAT is readonly, then we can obtain a VIEW
         * that just reuses the memory of the source. */
        if (b->batRestricted == BAT_READ &&
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to