Changeset: 8c68e0f1eed0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c68e0f1eed0
Removed Files:
        monetdb5/tests/gdkTests/Tests/refcnt.mal
        monetdb5/tests/gdkTests/Tests/refcnt.stable.err
        monetdb5/tests/gdkTests/Tests/refcnt.stable.out
Modified Files:
        monetdb5/modules/kernel/algebra.mx
        monetdb5/modules/mal/batExtensions.mal
        monetdb5/modules/mal/chopper.mal
        monetdb5/tests/gdkTests/Tests/All
Branch: default
Log Message:

Removing BAT of BATs.
Some routines may have to be replaced with proper MAL patterns
that make the number of returned elements explicit.


diffs (truncated from 432 to 300 lines):

diff --git a/monetdb5/modules/kernel/algebra.mx 
b/monetdb5/modules/kernel/algebra.mx
--- a/monetdb5/modules/kernel/algebra.mx
+++ b/monetdb5/modules/kernel/algebra.mx
@@ -634,33 +634,6 @@ comment "Reuse a temporary BAT if you ca
        allocate enough storage to accept result of an
        operation (not involving the heap)";
 
-# @- Hash Split
-# The commands below is temporarilly postponed, because
-# we don;t handle nested bats
-command hashsplit( b:bat[:any_1,:any_2], buckects:int ) 
-               :bat[:int,:bat] 
-address ALGhashsplit
-comment "Split a BAT on tail column according (hash-value MOD buckets). 
-               Returns a recursive BAT, containing the fragments in the tail, 
-               their bucket number in the head.";
-
-command uhashsplit ( b:bat[:any_1,:any_2], buckets:int ) :bat[:int,:bat] 
-address ALGuhashsplit
-comment "Same as hashsplit, but only collect the head values in the fragments";
-# @- Range Split
-command rangesplit ( b:bat[:any_1,:any_2], ranges:int ) 
-               :bat[:any_2,:bat] 
-address ALGrangesplit
-comment "Split a BAT on tail column in 'ranges' equally sized consecutive 
-               ranges. Returns a recursive BAT, containing the fragments in 
the tail, 
-               the higher-bound of the range in the head. The higher bound of 
the last 
-       range is 'nil'.";
-
-command urangesplit( b:bat[:any_1,:any_2], ranges:int ) 
-               :bat[:any_2,:bat] 
-address ALGurangesplit
-comment "Same as rangesplit, but only collect the head values in the 
fragments" ;
-
 # @+ Common BAT Aggregates
 # These operations examine a BAT, and compute some simple aggregate result
 # over it.
@@ -1060,9 +1033,6 @@ algebra_export str ALGmarkHead_default(i
 algebra_export str ALGhmarkp(int *result, int *bid, int *nr_parts, int 
*part_nr);
 algebra_export str ALGmark_grp_1(int *result, int *bid, int *gid);
 algebra_export str ALGmark_grp_2(int *result, int *bid, int *gid, oid *base);
-algebra_export str ALGhashsplit(int *result, int *bid, int *nfrag);
-algebra_export str ALGrangesplit(int *result, int *bid, int *nfrag);
-algebra_export str ALGurangesplit(int *result, int *bid, int *nfrag);
 algebra_export str ALGhistogram_rev(int *result, int *bid);
 algebra_export str ALGlike(int *ret, int *bid, str *k);
 algebra_export str ALGslice(int *ret, bat *bid, lng *start, lng *end);
@@ -3233,86 +3203,6 @@ ALGmark_grp_2(int *result, int *bid, int
 }
 
 str
-ALGhashsplit(int *result, int *bid, int *nfrag)
-{
-       BAT *b, *bn = NULL;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.hashsplit", RUNTIME_OBJECT_MISSING);
-       }
-       CMDhashsplit(&bn, b, nfrag);
-       if (bn) {
-               if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
-               *result = bn->batCacheid;
-               BBPkeepref(*result);
-               BBPreleaseref(b->batCacheid);
-               return MAL_SUCCEED;
-       }
-       BBPreleaseref(b->batCacheid);
-       throw(MAL, "algebra.hashsplit", GDK_EXCEPTION);
-}
-
-str
-ALGuhashsplit(int *result, int *bid, int *nfrag)
-{
-       BAT *b, *bn = NULL;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.uhashsplit", RUNTIME_OBJECT_MISSING);
-       }
-       CMDuhashsplit(&bn, b, nfrag);
-       if (bn) {
-               if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
-               *result = bn->batCacheid;
-               BBPkeepref(*result);
-               BBPreleaseref(b->batCacheid);
-               return MAL_SUCCEED;
-       }
-       BBPreleaseref(b->batCacheid);
-       throw(MAL, "algebra.uhashsplit", GDK_EXCEPTION);
-}
-
-str
-ALGrangesplit(int *result, int *bid, int *nfrag)
-{
-       BAT *b, *bn = NULL;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.rangesplit", RUNTIME_OBJECT_MISSING);
-       }
-       CMDrangesplit(&bn, b, nfrag);
-       if (bn) {
-               if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
-               *result = bn->batCacheid;
-               BBPkeepref(*result);
-               BBPreleaseref(b->batCacheid);
-               return MAL_SUCCEED;
-       }
-       BBPreleaseref(b->batCacheid);
-       throw(MAL, "algebra.rangesplit", GDK_EXCEPTION);
-}
-
-str
-ALGurangesplit(int *result, int *bid, int *nfrag)
-{
-       BAT *b, *bn = NULL;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.urangesplit", RUNTIME_OBJECT_MISSING);
-       }
-       CMDurangesplit(&bn, b, nfrag);
-       if (bn) {
-               if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
-               *result = bn->batCacheid;
-               BBPkeepref(*result);
-               BBPreleaseref(b->batCacheid);
-               return MAL_SUCCEED;
-       }
-       BBPreleaseref(b->batCacheid);
-       throw(MAL, "algebra.urangesplit", GDK_EXCEPTION);
-}
-
-str
 ALGhistogram_rev(int *result, int *bid)
 {
        BAT *b, *bn = NULL;
diff --git a/monetdb5/modules/mal/batExtensions.mal 
b/monetdb5/modules/mal/batExtensions.mal
--- a/monetdb5/modules/mal/batExtensions.mal
+++ b/monetdb5/modules/mal/batExtensions.mal
@@ -23,10 +23,6 @@ pattern bat.new(ht:any_1, tt:any_2) :bat
 address CMDBATnew
 comment "Creates a new empty transient BAT,
        with head- and tail-types as indicated.";
-pattern bat.new(ht:any_1, tt:bat[:any_2,:any_3]) :bat[:any_1,:bat]
-address CMDBATnew
-comment "Creates a new empty transient BAT,
-       with head- and tail-types as indicated.";
 pattern bat.new(ht:any_1, tt:any_2, size:int) :bat[:any_1,:any_2]
 address CMDBATnewint
 comment "Creates a new BAT with sufficient space.";
diff --git a/monetdb5/modules/mal/chopper.mal b/monetdb5/modules/mal/chopper.mal
--- a/monetdb5/modules/mal/chopper.mal
+++ b/monetdb5/modules/mal/chopper.mal
@@ -30,18 +30,12 @@ comment "Produce the next chunk for proc
 pattern bat.newIterator(b:bat[:any_1,:any_2]) (:lng, h:any_1, t:any_2)
 address CHPbunIterator
 comment "Process the buns one by one extracted from a void table.";
-pattern bat.newIterator(b:bat[:any_1,:bat]) (:lng, h:any_1, t:any_2)
-address CHPbunIterator
-comment "Process the buns one by one extracted from a void table.";
 
 pattern bat.hasMoreElements(b:bat[:any_1,:any_2]) (:lng, h:any_1, t:any_2)
 address CHPbunHasMoreElements;
 pattern bat.hasMoreElements(b:bat[:oid,:any_2]) (:lng, h:oid, t:any_2)
 address CHPbunHasMoreElements
 comment "Produce the next bun for processing.";
-pattern bat.hasMoreElements(b:bat[:any_1,:bat]) (:lng, h:any_1, t:any_2)
-address CHPbunHasMoreElements
-comment "Produce the next bun for processing.";
 
 # @-
 # The head and tail values can also be extracted using the cursor.
diff --git a/monetdb5/tests/gdkTests/Tests/All 
b/monetdb5/tests/gdkTests/Tests/All
--- a/monetdb5/tests/gdkTests/Tests/All
+++ b/monetdb5/tests/gdkTests/Tests/All
@@ -9,7 +9,6 @@ cross
 intersect_diff_void
 intersect_diff_nil
 qsort
-refcnt
 reload
 semijoin
 str_heap
diff --git a/monetdb5/tests/gdkTests/Tests/refcnt.mal 
b/monetdb5/tests/gdkTests/Tests/refcnt.mal
deleted file mode 100644
--- a/monetdb5/tests/gdkTests/Tests/refcnt.mal
+++ /dev/null
@@ -1,100 +0,0 @@
-function tmp():void;
-       d:= bbp.getRefCount();
-       dl:=bbp.getLRefCount();
-       dn:= bbp.getNames();
-       #io.print(dn,d,dl);
-end tmp;
-
-#NOTE: the reference counter of bat(name) is during insertion
-#      into bat(b) correctly increased
-#PROC addBAT(bat b,str name) : void {
-#      VAR add := new(int,int);
-#      add.rename(name);
-#      b.insert(name,add);
-#}
-function addBAT(b:bat[:str,:bat],name:str):void;
-       add:= bat.new(:int,:int);
-       bat.setName(add,name);
-       bat.insert(b,name,add);
-end addBAT;
-#
-##BUG: bat(name) will not be deleted in the garbage collection
-##     because the delete doesn't decrease the reference counter
-#PROC delBAT(bat b,str name) : void {
-#      b.delete(name);
-#}
-function delBAT(b:bat[:any_1,:any_2],name:str):void;
-       bat.delete(b,name);
-end delBAT;
-#
-#PROC createBAT(str name) : bat[int,int] {
-#      VAR res := new(int,int);
-#      res.rename(name);
-#      RETURN res;
-#}
-#NOTE we can not return  (yet) a (:bat,:bat[:int,:int])
-#into a multiplex. This means that the BATs created
-# are immediately garbage collected when leaving the
-#function. A hack would be to provide explicit incref/decref
-function createBAT(name:str):bat;
-       res:= bat.new(:int,:int);
-       bat.setName(res,name);  
-       i:= calc.getBATidentifier(res);
-       return i;
-end createBAT;
-#
-#tmp();
-user.tmp();
-#
-#{
-#
-#VAR top := new(str,bat);
-#top.rename("top");
-top := bat.new(:str,:bat);
-bat.setName(top,"top");
-
-#
-#addBAT(top,"one");
-#addBAT(top,"two");
-user.addBAT(top,"one");
-user.tmp();
-user.addBAT(top,"two");
-#tmp();
-user.tmp();
-#
-#delBAT(top,"one");
-user.delBAT(top,"one");
-io.print("one droppped");
-#tmp();
-user.tmp();
-#
-#VAR i := new(oid,str);
-m:= bat.new(:oid,:str);
-#i.insert(oid(10),"ten");
-bat.insert(m,10:oid,"ten");
-#i.insert(oid(20),"twenty");
-bat.insert(m,20:oid,"twenty");
-#VAR res := [createBAT](i);
-io.print("do multiplex");
-r:bat[:oid,:bat]:= mal.multiplex("user","createBAT",m);
-io.print(r);
-#tmp();
-io.print("done multiplex");
-#
-#top := nil;
-#res := nil;
-#
-#}
-#
-##BUGS:
-# in M5 this bug does not appear, because there is one reference
-# returned from createBAT.
-##- bat("one") still exists, due to not decreasing the reference counter
-##  at the delete from bat("top")
-##- bat("ten") and bat("twenty") still exist, due to creation during multiplex
-##  operation (?)
-# moreover, due to multiplex code inlining the reference count of "twenty" is 2
-# instead of the initial expected 1.
-#tmp();
-#quit();
-clients.quit();
diff --git a/monetdb5/tests/gdkTests/Tests/refcnt.stable.err 
b/monetdb5/tests/gdkTests/Tests/refcnt.stable.err
deleted file mode 100644
--- a/monetdb5/tests/gdkTests/Tests/refcnt.stable.err
+++ /dev/null
@@ -1,12 +0,0 @@
-stderr of test 'refcnt` in directory 'tests/gdkTests` itself:
-
-
-# 20:39:36 >  
-# 20:39:36 >  Mtimeout -timeout 60 mserver5 
"--config=/ufs/mk/monet5/Linux/etc/MonetDB5.conf" --debug=10 --set 
"monet_mod_path=/ufs/mk/monet5/Linux/lib/MonetDB5:/ufs/mk/opensource/MonetDB/Linux/lib/MonetDB"
 --set "gdk_dbfarm=/ufs/mk/monet5/Linux/var/MonetDB5/dbfarm" --set 
"sql_logdir=/ufs/mk/monet5/Linux/var/MonetDB5/dblogs" --set mapi_port=36290 
--set monet_prompt= --trace --dbname=mTests_tests_gdkTests  refcnt.mal < 
/dev/null
-# 20:39:36 >  
-
-
-# 20:39:37 >  
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to