Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26665/src/modules/mal

Modified Files:
      Tag: GDK-2
        batExtensions.mx language.mx mal_init.mx mat.mx 
Log Message:
propagated changes of Friday Aug 17 2007 - Tuesday Aug 21 2007
from the development trunk to the GDK-2 branch


Index: language.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/language.mx,v
retrieving revision 1.61
retrieving revision 1.61.2.1
diff -u -d -r1.61 -r1.61.2.1
--- language.mx 12 Jun 2007 17:21:26 -0000      1.61
+++ language.mx 21 Aug 2007 13:24:11 -0000      1.61.2.1
@@ -295,23 +295,24 @@
 {
        str s = *fnme;
        Client c = MCgetClient();
-       char buffer[1024];
+       char *msg = NULL;
 
        (void) ret;             /* fool compiler */
-       if (s == 0) {
+       if (s == 0) 
                throw(MAL, "mal.setCwd", "File name missing\n");
-       }
-       if (strlen(s) + strlen(c->cwd) + 2 >= 1024) {
-               throw(MAL, "mal.setCwd", "Evaluation buffer too small\n");
-       }
-       buffer[0] = 0;
 
        if (*s != '/') {
-               strcpy(buffer, c->cwd);
-               strcat(buffer, "/");
+               char *buf = GDKmalloc(strlen(c->cwd) + strlen(s) + 2);
+
+               strcpy(buf, c->cwd);
+               strcat(buf, "/");
+               strcat(buf, s);
+               msg = evalFile(c, buf, 0);
+               GDKfree(buf);
+       } else {
+               msg = evalFile(c, s, 0);
        }
-       strcat(buffer, s);
-       return evalFile(c, buffer, 0);
+       return msg;
 }
 @-
 Calling a BAT is simply translated into a concatenation of

Index: mal_init.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mal_init.mx,v
retrieving revision 1.118.2.1
retrieving revision 1.118.2.2
diff -u -d -r1.118.2.1 -r1.118.2.2
--- mal_init.mx 10 Aug 2007 14:54:51 -0000      1.118.2.1
+++ mal_init.mx 21 Aug 2007 13:24:12 -0000      1.118.2.2
@@ -94,6 +94,8 @@
 library mal_isolation;
 library mal_memorun;
 
+library xml;
+library batxml;
 @-
 The remainder interprets the signatures and resolves the
 address bindings.
@@ -209,6 +211,8 @@
 include opt_remoteQueries;
 #include crackers; 
 
+include xml;
+include batxml;
 @-
 In practice, we have to introduce different startup for each
 client group or database.

Index: batExtensions.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/batExtensions.mx,v
retrieving revision 1.17.6.2
retrieving revision 1.17.6.3
diff -u -d -r1.17.6.2 -r1.17.6.3
--- batExtensions.mx    10 Aug 2007 15:39:44 -0000      1.17.6.2
+++ batExtensions.mx    21 Aug 2007 13:24:10 -0000      1.17.6.3
@@ -16,7 +16,7 @@
 
 @f batExtensions
 @v 2.0
[EMAIL PROTECTED] M.L.Kersten, P. Boncz
[EMAIL PROTECTED] M.L.Kersten
 @+ BAT Extensions
 The kernel libraries are unaware of the MAL runtime semantics.
 This calls for declaring some operations in the MAL module section
@@ -73,6 +73,9 @@
 address CMDbatpack
 comment "Pack a pair into a BAT";
 
+pattern bat.setBase(b:bat[:any_1,:any_2],c:bat[:any_1,:any_2]...):void
+address CMDsetBase
+comment "Give the non-empty BATs consecutive oid bases";
                                                                                
 
 @{
 @{
@@ -111,6 +114,7 @@
 be_export str CMDBBPprojectNil(int *ret, int *bid);
 be_export str CMDbatunpack(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 be_export str CMDbatpack(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+be_export str CMDsetBase(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 
 @-
 Access to a box calls for resolving the first parameter
@@ -195,12 +199,12 @@
 }
 
 @+ BAT enhancements
-The code to enhance thekernel
+The code to enhance the kernel.
 @c
 str
 CMDBATclone(MalBlkPtr m, MalStkPtr s, InstrPtr p)
 {
-       BAT *b;
+       BAT *b, *bn;
        int bid = 0, cap, ht, tt;
        int *res;
 
@@ -214,8 +218,23 @@
        ht = getArgType(m, p, 1);
        tt = getArgType(m, p, 2);
        cap = BATcount(b) + 64;
[EMAIL PROTECTED]
+Cloning should include copying of the properties.
[EMAIL PROTECTED]
        BBPunfix(b->batCacheid);
-       return (str) BKCnewBATint(res, &ht, &tt, &cap);
+       bn= BATnew(ht,tt,cap);
+       if( bn == NULL){
+               BBPunfix(b->batCacheid);
+               throw(MAL,"bat.new","Cannot create BAT");
+       }
+       if( b->hseqbase)
+               BATseqbase(bn, b->hseqbase);
+       bn->hkey= b->hkey;
+       bn->tkey= b->tkey;
+       bn->hsorted= b->hsorted;
+       bn->tsorted= b->tsorted;
+       BBPkeepref(*res = bn->batCacheid);
+       return MAL_SUCCEED;
 }
 
 str
@@ -415,3 +434,21 @@
        BBPkeepref(*ret);
        return MAL_SUCCEED;
 }
+
+str
+CMDsetBase(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       int i;
+       oid o= 0;
+       BAT *b;
+       (void) mb;
+       for( i= pci->retc; i < pci->argc; i++){
+               b= BATdescriptor(*(int*) getArgReference(stk,pci,i));
+               if( b == NULL)
+                       throw(MAL,"bat.setBase","Can not access BAT");
+               BATseqbase(b,o);
+               o= o + (oid) BATcount(b);
+               BBPunfix(b->batCacheid);
+       }
+       return MAL_SUCCEED;
+}

Index: mat.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mat.mx,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -d -r1.14 -r1.14.2.1
--- mat.mx      8 Aug 2007 13:01:33 -0000       1.14
+++ mat.mx      21 Aug 2007 13:24:12 -0000      1.14.2.1
@@ -38,7 +38,7 @@
 
 pattern pack(b:bat[:any_1,:any_2]...):bat[:any_1,:any_2]
 address MATpack
-comment "Materialize the MAT into a single BAT";
+comment "Materialize the MAT into the first BAT";
 
 pattern print(b:bat[:any_1,:any_2]...):void
 address MATprint;
@@ -129,22 +129,24 @@
 @-
 The pack operation could be quite expensive, because it
 may create a really large BAT.
+For the experiments we materialize the BAT in the first
+component. 
 @c
 str
 MATpack(MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
 {
-       int i,*ret,tpe;
+       int i,*ret;
        BAT *b, *bn;
-       tpe= getArgType(mb,p,0);
 
-       bn= BATnew(getHeadType(tpe),getTailType(tpe), 0);
+       bn= BATdescriptor(stk->stk[getArg(p,1)].val.ival);
        if( bn == NULL)
-               throw(MAL, "mat.pack","Could not allocate storage");
-       for(i=1; i<p->argc; i++){
+               throw(MAL, "mat.pack","Could access BAT");
+       for(i=2; i<p->argc; i++){
                b= BATdescriptor(stk->stk[getArg(p,i)].val.ival);
                if( b == NULL)
                        throw(MAL, "mat.pack","Could not access component");
-               BATins(bn,b,FALSE);
+               if( BATcount(b) )
+                       BATins(bn,b,FALSE);
                BBPunfix(b->batCacheid);
        }
        (void) mb;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to