Changeset: 7711bcc34966 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7711bcc34966
Added Files:
        monetdb5/modules/mal/Tests/hashpartition.malC
        monetdb5/modules/mal/Tests/hashpartition.stable.err
        monetdb5/modules/mal/Tests/hashpartition.stable.out
        monetdb5/modules/mal/partition.c
        monetdb5/modules/mal/partition.h
        monetdb5/modules/mal/partition.mal
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        monetdb5/modules/mal/Makefile.ag
        monetdb5/modules/mal/Tests/All
        monetdb5/modules/mal/mal_init.mal
Branch: partition
Log Message:

Introduce a BAT value hash-partitioning function
Should be extended to cover strings and other types.


diffs (truncated from 470 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -8224,6 +8224,7 @@ Ready.
 [ "optimizer", "volcano_pipe", "function optimizer.volcano_pipe():void;",      
"",     ""      ]
 [ "optimizer", "wlc",  "pattern optimizer.wlc():str ", "OPTwrapper;",  ""      
]
 [ "optimizer", "wlc",  "pattern optimizer.wlc(mod:str, fcn:str):str ", 
"OPTwrapper;",  "Inject the workload capture-replay primitives."        ]
+[ "partition", "hash", "pattern partition.hash(b:bat[:any_2]):bat[:any_2]... 
",        "PARThash;",    "Perform a value based partition "      ]
 [ "pcre",      "imatch",       "command pcre.imatch(s:str, pat:str):bit ",     
"PCREimatch;",  "Caseless Perl Compatible Regular Expression pattern matching 
against a string" ]
 [ "pcre",      "index",        "command pcre.index(pat:pcre, s:str):int ",     
"PCREindex;",   "match a pattern, return matched position (or 0 when not 
found)"        ]
 [ "pcre",      "match",        "command pcre.match(s:str, pat:str):bit ",      
"PCREmatch;",   "Perl Compatible Regular Expression pattern matching against a 
string"  ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -10586,6 +10586,7 @@ Ready.
 [ "optimizer", "volcano_pipe", "function optimizer.volcano_pipe():void;",      
"",     ""      ]
 [ "optimizer", "wlc",  "pattern optimizer.wlc():str ", "OPTwrapper;",  ""      
]
 [ "optimizer", "wlc",  "pattern optimizer.wlc(mod:str, fcn:str):str ", 
"OPTwrapper;",  "Inject the workload capture-replay primitives."        ]
+[ "partition", "hash", "pattern partition.hash(b:bat[:any_2]):bat[:any_2]... 
",        "PARThash;",    "Perform a value based partition "      ]
 [ "pcre",      "imatch",       "command pcre.imatch(s:str, pat:str):bit ",     
"PCREimatch;",  "Caseless Perl Compatible Regular Expression pattern matching 
against a string" ]
 [ "pcre",      "index",        "command pcre.index(pat:pcre, s:str):int ",     
"PCREindex;",   "match a pattern, return matched position (or 0 when not 
found)"        ]
 [ "pcre",      "match",        "command pcre.match(s:str, pat:str):bit ",      
"PCREmatch;",   "Perl Compatible Regular Expression pattern matching against a 
string"  ]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1595,6 +1595,7 @@ str OPTstatistics(Client cntxt, MalBlkPt
 str OPTvolcanoImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
 str OPTwlcImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 str OPTwrapper(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
+str PARThash(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 str PCREilike2(bit *ret, const str *s, const str *pat);
 str PCREilike3(bit *ret, const str *s, const str *pat, const str *esc);
 str PCREimatch(bit *ret, const str *val, const str *pat);
diff --git a/monetdb5/modules/mal/Makefile.ag b/monetdb5/modules/mal/Makefile.ag
--- a/monetdb5/modules/mal/Makefile.ag
+++ b/monetdb5/modules/mal/Makefile.ag
@@ -38,6 +38,7 @@ lib_mal = {
                oltp.c oltp.h \
                wlc.c wlc.h \
                pcre.c \
+               partition.c partition.h \
                profiler.c profiler.h \
                querylog.c querylog.h \
                remote.c remote.h \
@@ -55,7 +56,7 @@ lib_mal = {
 headers_mal = {
        HEADERS = mal
        DIR = libdir/monetdb5
-       SOURCES = language.mal mal_init.mal bbp.mal \
+       SOURCES = language.mal mal_init.mal bbp.mal partition.mal \
                profiler.mal batExtensions.mal orderidx.mal \
                inspect.mal manual.mal mal_io.mal mkey.mal manifold.mal \
                iterator.mal clients.mal \
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
@@ -55,6 +55,7 @@ remoteInit
 
 partition
 batpartition
+hashpartition
 printf
 #some remote related tests
 mapi04
diff --git a/monetdb5/modules/mal/Tests/hashpartition.malC 
b/monetdb5/modules/mal/Tests/hashpartition.malC
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/hashpartition.malC
@@ -0,0 +1,46 @@
+function tst();
+b:= bat.new(:int);
+bat.append(b,0);
+bat.append(b,1);
+bat.append(b,2);
+bat.append(b,3);
+bat.append(b,4);
+bat.append(b,5);
+bat.append(b,6);
+bat.append(b,7);
+bat.append(b,8);
+bat.append(b,9);
+bat.append(b,10);
+bat.append(b,11);
+bat.append(b,12);
+bat.append(b,13);
+bat.append(b,14);
+bat.append(b,15);
+bat.append(b,16);
+bat.append(b,17);
+bat.append(b,18);
+bat.append(b,19);
+bat.append(b,20);
+bat.append(b,21);
+bat.append(b,22);
+bat.append(b,23);
+bat.append(b,24);
+bat.append(b,25);
+bat.append(b,26);
+bat.append(b,27);
+bat.append(b,28);
+bat.append(b,29);
+
+io.print(b);
+(c1,c2):= partition.hash(b);
+io.print(c1);
+io.print(c2);
+
+(c1,c2,c3,c4,c5):= partition.hash(b);
+io.print(c1);
+io.print(c2);
+io.print(c3);
+io.print(c4);
+io.print(c5);
+end tst;
+tst();
diff --git a/monetdb5/modules/mal/Tests/hashpartition.stable.err 
b/monetdb5/modules/mal/Tests/hashpartition.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/hashpartition.stable.err
@@ -0,0 +1,36 @@
+stderr of test 'hashpartition` in directory 'monetdb5/modules/mal` itself:
+
+
+# 14:09:24 >  
+# 14:09:24 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=39094" "--set" 
"mapi_usock=/var/tmp/mtest-4891/.s.monetdb.39094" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/export/scratch1/home/mk/partition//Linux/var/MonetDB/mTests_monetdb5_modules_mal"
 "--set" "embedded_r=yes" "--set" "embedded_py=true"
+# 14:09:24 >  
+
+# builtin opt  gdk_dbpath = 
/export/scratch1/home/mk/partition//Linux/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# 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 = 39094
+# cmdline opt  mapi_usock = /var/tmp/mtest-4891/.s.monetdb.39094
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/export/scratch1/home/mk/partition//Linux/var/MonetDB/mTests_monetdb5_modules_mal
+# cmdline opt  embedded_r = yes
+# cmdline opt  embedded_py = true
+# cmdline opt  gdk_debug = 553648138
+
+# 14:09:25 >  
+# 14:09:25 >  "mclient" "-lmal" "-ftest" "-tnone" "-Eutf-8" 
"--host=/var/tmp/mtest-4891" "--port=39094"
+# 14:09:25 >  
+
+
+# 14:09:25 >  
+# 14:09:25 >  "Done."
+# 14:09:25 >  
+
diff --git a/monetdb5/modules/mal/Tests/hashpartition.stable.out 
b/monetdb5/modules/mal/Tests/hashpartition.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/hashpartition.stable.out
@@ -0,0 +1,155 @@
+stdout of test 'hashpartition` in directory 'monetdb5/modules/mal` itself:
+
+
+# 14:09:24 >  
+# 14:09:24 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=39094" "--set" 
"mapi_usock=/var/tmp/mtest-4891/.s.monetdb.39094" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/export/scratch1/home/mk/partition//Linux/var/MonetDB/mTests_monetdb5_modules_mal"
 "--set" "embedded_r=yes" "--set" "embedded_py=true"
+# 14:09:24 >  
+
+# MonetDB 5 server v11.28.0
+# This is an unreleased version
+# Serving database 'mTests_monetdb5_modules_mal', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.581 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://rocks073.scilens.private:39094/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-4891/.s.monetdb.39094
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB/Python2 module loaded
+# MonetDB/R   module loaded
+
+Ready.
+
+# 14:09:25 >  
+# 14:09:25 >  "mclient" "-lmal" "-ftest" "-tnone" "-Eutf-8" 
"--host=/var/tmp/mtest-4891" "--port=39094"
+# 14:09:25 >  
+
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 0       ]
+[ 1@0, 1       ]
+[ 2@0, 2       ]
+[ 3@0, 3       ]
+[ 4@0, 4       ]
+[ 5@0, 5       ]
+[ 6@0, 6       ]
+[ 7@0, 7       ]
+[ 8@0, 8       ]
+[ 9@0, 9       ]
+[ 10@0,        10      ]
+[ 11@0,        11      ]
+[ 12@0,        12      ]
+[ 13@0,        13      ]
+[ 14@0,        14      ]
+[ 15@0,        15      ]
+[ 16@0,        16      ]
+[ 17@0,        17      ]
+[ 18@0,        18      ]
+[ 19@0,        19      ]
+[ 20@0,        20      ]
+[ 21@0,        21      ]
+[ 22@0,        22      ]
+[ 23@0,        23      ]
+[ 24@0,        24      ]
+[ 25@0,        25      ]
+[ 26@0,        26      ]
+[ 27@0,        27      ]
+[ 28@0,        28      ]
+[ 29@0,        29      ]
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 0       ]
+[ 1@0, 2       ]
+[ 2@0, 4       ]
+[ 3@0, 6       ]
+[ 4@0, 8       ]
+[ 5@0, 10      ]
+[ 6@0, 12      ]
+[ 7@0, 14      ]
+[ 8@0, 16      ]
+[ 9@0, 18      ]
+[ 10@0,        20      ]
+[ 11@0,        22      ]
+[ 12@0,        24      ]
+[ 13@0,        26      ]
+[ 14@0,        28      ]
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 1       ]
+[ 1@0, 3       ]
+[ 2@0, 5       ]
+[ 3@0, 7       ]
+[ 4@0, 9       ]
+[ 5@0, 11      ]
+[ 6@0, 13      ]
+[ 7@0, 15      ]
+[ 8@0, 17      ]
+[ 9@0, 19      ]
+[ 10@0,        21      ]
+[ 11@0,        23      ]
+[ 12@0,        25      ]
+[ 13@0,        27      ]
+[ 14@0,        29      ]
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 0       ]
+[ 1@0, 5       ]
+[ 2@0, 10      ]
+[ 3@0, 15      ]
+[ 4@0, 20      ]
+[ 5@0, 25      ]
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 1       ]
+[ 1@0, 6       ]
+[ 2@0, 11      ]
+[ 3@0, 16      ]
+[ 4@0, 21      ]
+[ 5@0, 26      ]
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 2       ]
+[ 1@0, 7       ]
+[ 2@0, 12      ]
+[ 3@0, 17      ]
+[ 4@0, 22      ]
+[ 5@0, 27      ]
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 3       ]
+[ 1@0, 8       ]
+[ 2@0, 13      ]
+[ 3@0, 18      ]
+[ 4@0, 23      ]
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to