Changeset: 9c1864ddbafb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9c1864ddbafb Added Files: monetdb5/modules/mal/Tests/batpartition.mal monetdb5/modules/mal/Tests/batpartition.stable.err monetdb5/modules/mal/Tests/batpartition.stable.out Modified Files: monetdb5/modules/mal/Tests/All monetdb5/modules/mal/Tests/partition.stable.out monetdb5/modules/mal/batExtensions.c Branch: Feb2013 Log Message:
Fixing the bounds in partitioning And addition of a test for fetching specific partitions. diffs (212 lines): diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All --- a/monetdb5/modules/mal/Tests/All +++ b/monetdb5/modules/mal/Tests/All @@ -52,6 +52,7 @@ remote10 sabaoth01 partition +batpartition printf #some remote related tests mapi04 diff --git a/monetdb5/modules/mal/Tests/batpartition.mal b/monetdb5/modules/mal/Tests/batpartition.mal new file mode 100644 --- /dev/null +++ b/monetdb5/modules/mal/Tests/batpartition.mal @@ -0,0 +1,23 @@ +b := bat.new(:oid,:lng); +bat.append(b,0:lng); +bat.append(b,1:lng); +bat.append(b,2:lng); +bat.append(b,3:lng); +bat.append(b,4:lng); +bat.append(b,5:lng); +bat.append(b,6:lng); +bat.append(b,7:lng); +bat.append(b,8:lng); +bat.append(b,9:lng); +b1 := bat.partition(b,2,0); +io.print(b1); +b2 := bat.partition(b,2,1); +io.print(b2); +c1 := bat.partition(b1,2,0); +io.print(c1); +c2 := bat.partition(b1,2,1); +io.print(c2); +d1 := bat.partition(b2,2,0); +io.print(d1); +d2 := bat.partition(b2,2,1); +io.print(d2); diff --git a/monetdb5/modules/mal/Tests/batpartition.stable.err b/monetdb5/modules/mal/Tests/batpartition.stable.err new file mode 100644 --- /dev/null +++ b/monetdb5/modules/mal/Tests/batpartition.stable.err @@ -0,0 +1,29 @@ +stderr of test 'batpartition` in directory 'monetdb5/modules/mal` itself: + + +# 23:04:03 > +# 23:04:03 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=37122" "--set" "mapi_usock=/var/tmp/mtest-1915/.s.monetdb.37122" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch1/mk/Feb2013//Linux/var/MonetDB/mTests_monetdb5_modules_mal" "batpartition.mal" +# 23:04:03 > + +# builtin opt gdk_dbpath = /export/scratch1/mk/Feb2013//Linux/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 37122 +# cmdline opt mapi_usock = /var/tmp/mtest-1915/.s.monetdb.37122 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/scratch1/mk/Feb2013//Linux/var/MonetDB/mTests_monetdb5_modules_mal + +# 23:04:04 > +# 23:04:04 > "Done." +# 23:04:04 > + diff --git a/monetdb5/modules/mal/Tests/batpartition.stable.out b/monetdb5/modules/mal/Tests/batpartition.stable.out new file mode 100644 --- /dev/null +++ b/monetdb5/modules/mal/Tests/batpartition.stable.out @@ -0,0 +1,95 @@ +stdout of test 'batpartition` in directory 'monetdb5/modules/mal` itself: + + +# 23:04:03 > +# 23:04:03 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=37122" "--set" "mapi_usock=/var/tmp/mtest-1915/.s.monetdb.37122" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch1/mk/Feb2013//Linux/var/MonetDB/mTests_monetdb5_modules_mal" "batpartition.mal" +# 23:04:03 > + +# MonetDB 5 server v11.15.2 +# This is an unreleased version +# Serving database 'mTests_monetdb5_modules_mal', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 15.629 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://vienna.ins.cwi.nl:37122/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-1915/.s.monetdb.37122 +# MonetDB/GIS module loaded +# MonetDB/JAQL module loaded +# MonetDB/SQL module loaded +# MonetDB/DataCell loaded +function user.main():void; + b := bat.new(:oid,:lng); + bat.append(b,0:lng); + bat.append(b,1:lng); + bat.append(b,2:lng); + bat.append(b,3:lng); + bat.append(b,4:lng); + bat.append(b,5:lng); + bat.append(b,6:lng); + bat.append(b,7:lng); + bat.append(b,8:lng); + bat.append(b,9:lng); + b1 := bat.partition(b,2,0); + io.print(b1); + b2 := bat.partition(b,2,1); + io.print(b2); + c1 := bat.partition(b1,2,0); + io.print(c1); + c2 := bat.partition(b1,2,1); + io.print(c2); + d1 := bat.partition(b2,2,0); + io.print(d1); + d2 := bat.partition(b2,2,1); + io.print(d2); +end main; +#-----------------# +# h t # name +# void lng # type +#-----------------# +[ 0@0, 0 ] +[ 1@0, 1 ] +[ 2@0, 2 ] +[ 3@0, 3 ] +[ 4@0, 4 ] +#-----------------# +# h t # name +# void lng # type +#-----------------# +[ 5@0, 5 ] +[ 6@0, 6 ] +[ 7@0, 7 ] +[ 8@0, 8 ] +[ 9@0, 9 ] +#-----------------# +# h t # name +# void lng # type +#-----------------# +[ 0@0, 0 ] +[ 1@0, 1 ] +#-----------------# +# h t # name +# void lng # type +#-----------------# +[ 2@0, 2 ] +[ 3@0, 3 ] +[ 4@0, 4 ] +#-----------------# +# h t # name +# void lng # type +#-----------------# +[ 0@0, 5 ] +[ 1@0, 6 ] +#-----------------# +# h t # name +# void lng # type +#-----------------# +[ 2@0, 7 ] +[ 3@0, 8 ] +[ 4@0, 9 ] + +# 23:04:04 > +# 23:04:04 > "Done." +# 23:04:04 > + diff --git a/monetdb5/modules/mal/Tests/partition.stable.out b/monetdb5/modules/mal/Tests/partition.stable.out --- a/monetdb5/modules/mal/Tests/partition.stable.out +++ b/monetdb5/modules/mal/Tests/partition.stable.out @@ -61,11 +61,11 @@ end tst; #-----------------# [ 0@0, 1 ] [ 1@0, 2 ] -[ 2@0, 3 ] #-----------------# # h t # name # void int # type #-----------------# +[ 2@0, 3 ] [ 3@0, 4 ] [ 4@0, 5 ] #-----------------# diff --git a/monetdb5/modules/mal/batExtensions.c b/monetdb5/modules/mal/batExtensions.c --- a/monetdb5/modules/mal/batExtensions.c +++ b/monetdb5/modules/mal/batExtensions.c @@ -253,7 +253,7 @@ CMDbatpartition2(Client cntxt, MalBlkPtr if ((b = BATdescriptor(bid)) == NULL) { throw(MAL, "bat.partition", INTERNAL_BAT_ACCESS); } - step = BATcount(b) / pieces + 1; + step = BATcount(b) / pieces; lval = idx * step; if ( idx == pieces-1) @@ -266,9 +266,8 @@ CMDbatpartition2(Client cntxt, MalBlkPtr BBPunfix(b->batCacheid); throw(MAL, "bat.partition", INTERNAL_OBJ_CREATE); } - stk->stk[getArg(pci,0)].val.bval = bn->batCacheid; ret= (int *) getArgReference(stk,pci,0); BBPkeepref(*ret = bn->batCacheid); - BBPunfix(b->batCacheid); + BBPreleasref(b->batCacheid); return MAL_SUCCEED; } _______________________________________________ checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
