Changeset: f2e6d24a4f31 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2e6d24a4f31
Modified Files:
        gdk/gdk_align.c
        gdk/gdk_relop.mx
Branch: default
Log Message:

Relax alignment requirements when creating view of multiple bats.
When creating a view consisting of the head of one bat and the tail of
another, we don't need to require that both have the same BUNfirst
value: by manipulating the base address of the two columns in the new
view we can still have them share the same BUNfirst value.


diffs (37 lines):

diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -277,8 +277,10 @@ VIEWcreate_(BAT *h, BAT *t, int slice_vi
         * data, though. */
        *bn->U = *h->U;
        *bn->H = *h->H;
-       /* we need aligned bats */
-       assert(h->U->first == t->U->first);
+       if (bn->U->first > 0) {
+               bn->H->heap.base += h->U->first * h->H->width;
+               bn->U->first = 0;
+       }
        if (h->H == t->T) {
                vc = 1;
                tp = hp;
@@ -287,6 +289,8 @@ VIEWcreate_(BAT *h, BAT *t, int slice_vi
                *bn->T = *t->T;
                if (bn->U->capacity > t->U->capacity)
                        bn->U->capacity = t->U->capacity;
+               if (t->U->first > 0)
+                       bn->T->heap.base += t->U->first * t->T->width;
        }
 
        if (hp)
diff --git a/gdk/gdk_relop.mx b/gdk/gdk_relop.mx
--- a/gdk/gdk_relop.mx
+++ b/gdk/gdk_relop.mx
@@ -1230,7 +1230,7 @@ batjoin(BAT *l, BAT *r, BUN estimate, bi
                @:return_empty_join_result(l,r, BATjoin: |l|==0 or |r|==0 or 
tail(l)==NIL or head(r)==NIL,0)@
        }
        if (BATtdense(l) && BAThdense(r) && l->tseqbase == r->hseqbase &&
-           lcount == rcount && BUNfirst(l) == BUNfirst(r) &&
+           lcount == rcount &&
            l->batRestricted == BAT_READ && r->batRestricted == BAT_READ)
                return VIEWcreate(l, r);
        /*
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to