Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17580
Modified Files:
batExtensions.mx
Log Message:
Cloning should also take the properties.
Index: batExtensions.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/batExtensions.mx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- batExtensions.mx 3 Jan 2007 12:20:23 -0000 1.17
+++ batExtensions.mx 19 Aug 2007 19:41:18 -0000 1.18
@@ -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
@@ -414,3 +433,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;
+}
-------------------------------------------------------------------------
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