Changeset: 7fc2646e7cd7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7fc2646e7cd7
Modified Files:
        monetdb5/modules/mal/extensions.c
        monetdb5/modules/mal/extensions.h
        monetdb5/modules/mal/extensions.mal
Branch: headless
Log Message:

Remove old fashioned BAT projections.


diffs (280 lines):

diff --git a/monetdb5/modules/mal/extensions.c 
b/monetdb5/modules/mal/extensions.c
--- a/monetdb5/modules/mal/extensions.c
+++ b/monetdb5/modules/mal/extensions.c
@@ -47,14 +47,14 @@
 
        (void) cntxt;
        res = (int *) getArgReference(s, p, 0);
-       ht = getArgType(m, p, 1);
+       ht = getArgType(m, p, 1).type;
        if (p->argc > 2) {
                lng lcap = *(lng*) getArgReference(s, p, 2);
                if (lcap < 0)
                        throw(MAL, "col.new", POSITIVE_EXPECTED);
                if (lcap > (lng) BUN_MAX)
                        throw(MAL, "col.new", ILLEGAL_ARGUMENT " Capacity too 
large");
-               cap = (BUN) lcap;
+               cap = (oid) lcap;
        }
 
        if (ht == TYPE_any )
@@ -86,7 +86,7 @@
                        throw(MAL, "col.new", POSITIVE_EXPECTED);
                if (lcap > (lng) BUN_MAX)
                        throw(MAL, "col.new", ILLEGAL_ARGUMENT " Capacity too 
large");
-               cap = (BUN) lcap;
+               cap = (oid) lcap;
        } else
                cap = COLcount(b);
        res = (int *) getArgReference(s, p, 0);
@@ -103,93 +103,15 @@
 
        (void) cntxt;
        res = (int *) getArgReference(s, p, 0);
-       ht = getArgType(m, p, 1);
+       ht = getArgType(m, p, 1).type;
        icap = *(int *) getArgReference(s, p, 2);
        if (icap < 0)
                throw(MAL, "col.new", POSITIVE_EXPECTED);
-       cap = (BUN) icap;
+       cap = (oid) icap;
        res = (int *) getArgReference(s, p, 0);
-
        return (str) BKCnewCOL(res, &ht, &cap);
 }
 
-str
-CMDCBPproject(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       int *result, *bid, tp;
-       ptr *p;
-       COL *b, *bn;
-
-       (void) cntxt;
-       result = (int *) getArgReference(stk, pci, 0);
-       bid = (int *) getArgReference(stk, pci, 1);
-       p = (ptr *) getArgReference(stk, pci, 2);
-       tp = getArgType(mb, pci, 2);
-       if ((b = COLdescriptor(*bid)) == NULL) 
-               throw(MAL, "col.project", INTERNAL_COL_ACCESS);
-
-       if (tp >= TYPE_str) {
-               if (p == 0 || *(str *) p == 0)
-                       p = (ptr *) str_nil;
-               else
-                       p = *(ptr **) p;
-       }
-       bn = COLconst(b, tp, p);
-       CBPreleaseref(b);
-       if (bn) {
-               *result = CBPkeepref(bn);
-               return MAL_SUCCEED;
-       }
-       throw(MAL, "col.project", INTERNAL_OBJ_CREATE);
-}
-
-str
-CMDCOLunpack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       COL *b;
-       int bid;
-       oid p;
-       ValPtr head;
-
-       (void) cntxt;
-       bid = *(int *) getArgReference(stk, pci, 1);
-
-       if ((b = COLdescriptor(bid)) == NULL)
-               throw(MAL, "col.unpack", INTERNAL_COL_ACCESS);
-
-       head =  getArgReference(stk,pci,0); 
-       p = BUNfirst(b);
-       if (p < BUNlast(b)) {
-               COLiter bi = col_iterator(b);
-               VALinit(head, getArgType(mb, pci, 0), BUNhead(bi, p));
-       }
-
-       CBPreleaseref(b);
-       return MAL_SUCCEED;
-}
-
-str
-CMDCOLpack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       COL *b;
-       int *ret;
-       int ht, tt;
-       oid cap = 0;
-
-       (void) cntxt;
-       ht = getArgType(mb, pci, 1);
-       tt = getArgType(mb, pci, 2);
-       ret = (int *) getArgReference(stk, pci, 0);
-
-       if (ht == TYPE_any || tt == TYPE_any)
-               throw(MAL, "col.pack", SEMANTIC_TYPE_ERROR);
-       b = COLnew(ht, cap);
-       BUNappend(b, getArgReference(stk, pci, 2), FALSE);
-       COLsetreadonly(b);
-       *ret = CBPkeepref(b);
-       return MAL_SUCCEED;
-}
-
 /* 
  * COL Iterators
  * Many low level algorithms rely on an iterator to break a
@@ -234,12 +156,12 @@
                throw(MAL, "chop.newChunkIterator", INTERNAL_COL_ACCESS);
        
        cnt = COLcount(b);
-       first = BUNfirst(b);
+       first = COLfirst(b);
        view = VIEWcreate_(b, TRUE);
 
        /* printf("set bat chunk bound to " LLFMT " " BUNFMT " - " BUNFMT "\n",
-        * granule, first, MIN(cnt,(BUN) *granule)); */
-       VIEWbounds(b, view, (BUN) first, first + MIN(cnt, (BUN) * granule));
+        * granule, first, MIN(cnt,(oid) *granule)); */
+       VIEWbounds(b, view, (oid) first, first + MIN(cnt, (oid) * granule));
        COLseqbase(view, first - 1);
        *vid = CBPkeepref(view); 
        CBPreleaseref(b);
@@ -266,7 +188,7 @@
                throw(MAL, "chop.newChunkMoreElements", INTERNAL_COL_ACCESS);
        }
        i = (oid)(*res + COLcount(view));
-       if (i >= BUNlast(b)) {
+       if (i >= COLlast(b)) {
                *res = -1;
                *vid = 0;
                CBPreleaseref(b);
@@ -274,8 +196,8 @@
                return MAL_SUCCEED;
        }
        /* printf("set bat chunk bound to " BUNFMT " - " BUNFMT " \n",
-          i, i+(BUN) *granule-1); */
-       VIEWbounds(b, view, i, i + (BUN) * granule);
+          i, i+(oid) *granule-1); */
+       VIEWbounds(b, view, i, i + (oid) * granule);
        COLseqbase(view, i - 1);
        CBPreleaseref(b);
        *vid = CBPkeepref(view);
@@ -284,7 +206,7 @@
 }
 
 /* 
- * The BUN- and COL-stream manipulate a long handle, i.e.
+ * The  COL-stream manipulate a long handle, i.e.
  * the destination variable. It assumes it has been set to
  * zero as part of runtime stack initialization. Subsequently,
  * it fetches a bun and returns the increment to the control
@@ -312,56 +234,22 @@
 
        /* get head = ... tail = ... */
        assert(0 <= *cursor && *cursor < (lng) BUN_MAX);
-       yy = (BUN)*cursor + 1;
+       yy = (oid)*cursor + 1;
        *cursor = yy;
 
-       if (yy >= BUNlast(b)) {
+       if (yy >= COLlast(b)) {
                *cursor = -1;
                CBPreleaseref(b);
                return MAL_SUCCEED;
        }
        bi = col_iterator(b);
        if( COLtype(b) == TYPE_void){
-               o= (oid) (yy - BUNfirst(b)+  b->seqbase);
+               o= (oid) (yy - COLfirst(b)+  b->seqbase);
                VALinit(head, TYPE_oid, &o);
        } else {
-               assert(b->type == getArgType(mb,pci,1));
-               VALinit(head, getArgType(mb, pci, 1), BUNhead(bi, yy));
+               assert(b->type == getArgType(mb,pci,1).type);
+               VALinit(head, getArgType(mb, pci, 1).type, BUNhead(bi, yy));
        }
        CBPreleaseref(b);
        return MAL_SUCCEED;
 }
-
-str
-ALGprojectCstBody(bat *result, int *bid, ptr *p, int tt){
-       COL *b, *bn;
-
-       if ((b = COLdescriptor(*bid)) == NULL)
-               throw(MAL, "bbp.project", INTERNAL_COL_ACCESS);
-
-       if (ATOMvarsized(tt)) {
-               if (p == 0 || *(str *) p == 0)
-                       p = (ptr *) str_nil;
-               else
-                       p = *(ptr **) p;
-       }
-       bn = COLconst(b, tt, p);
-       CBPreleaseref(b);
-       if (bn) {
-               *result = CBPkeepref(bn);
-               return MAL_SUCCEED;
-       }
-       throw(MAL, "bbp.project", INTERNAL_OBJ_CREATE);
-}
-
-str
-ALGprojectCst(Client cntxt,MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       int *result = (int *) getArgReference(stk, pci, 0);
-       int *bid = (int *) getArgReference(stk, pci, 1);
-       ptr *p = (ptr *) getArgReference(stk, pci, 2);
-       int tt = getArgType(mb, pci, 2);
-
-       (void) cntxt;
-       return ALGprojectCstBody(result, bid, p, tt);
-}
diff --git a/monetdb5/modules/mal/extensions.h 
b/monetdb5/modules/mal/extensions.h
--- a/monetdb5/modules/mal/extensions.h
+++ b/monetdb5/modules/mal/extensions.h
@@ -36,16 +36,11 @@
 be_export str CMDCOLnew(Client cntxt, MalBlkPtr m, MalStkPtr s, InstrPtr p);
 be_export str CMDCOLderived(Client cntxt, MalBlkPtr m, MalStkPtr s, InstrPtr 
p);
 be_export str CMDCOLnewint(Client cntxt, MalBlkPtr m, MalStkPtr s, InstrPtr p);
-be_export str CMDCBPproject(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
-be_export str CMDCOLunpack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 be_export str CMDCOLpartition(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 be_export str CMDCOLpartition2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
-be_export str CMDCOLpack(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 be_export str CMDsetBase(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 
 be_export str CHPnewChunkIterator(oid *res, int *vid, int *bid, lng *granule);
 be_export str CHPhasMoreElements(oid *res, int *vid, int *bid, lng *granule);
 
-be_export str ALGprojectCst(Client cntxt,MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
-be_export str ALGprojectCstBody(bat *result, int *bid, ptr *p, int tt);
 #endif
diff --git a/monetdb5/modules/mal/extensions.mal 
b/monetdb5/modules/mal/extensions.mal
--- a/monetdb5/modules/mal/extensions.mal
+++ b/monetdb5/modules/mal/extensions.mal
@@ -31,13 +31,6 @@
 pattern column.new(b:col[:any_1], size:lng) :col[:any_1]       
 address CMDCOLnewDerived;
 
-pattern column.unpack(b:col[:any_1]):any_1
-address CMDCOLunpack
-comment "Extract the first tuple from a COL.";
-pattern column.pack(t:any_1):col[:any_1]
-address CMDCOLpack
-comment "Pack a pair of values into a COL.";
-
 command column.newIterator(b:col[:any_2], size:lng)
        (:oid,:col[:any_2])
 address CHPnewChunkIterator
@@ -48,10 +41,3 @@
        (:oid, :col[:any_1])
 address CHPhasMoreElements
 comment "Produce the next chunk for processing.";
-
-pattern algebra.project( b:col[:any_1], val:any_2) :col[:any_2]
-address ALGprojectCst
-comment "Fill the tail column with a newly typed constant.";
-pattern algebra.project(b:col[:any_1], val:col[:any_2]) :col[:any_2]
-address ALGprojectCst
-comment "Fill the tail column with a constant taken from the aligned COL.";
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to