Changeset: c49389ad0889 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c49389ad0889
Added Files:
monetdb5/modules/atoms/Tests/json08.stable.err
monetdb5/modules/atoms/Tests/json08.stable.out
Modified Files:
monetdb5/modules/atoms/Tests/All
monetdb5/modules/atoms/Tests/json01.mal
monetdb5/modules/atoms/Tests/json01.stable.out
monetdb5/modules/atoms/Tests/json08.mal
monetdb5/modules/mal/manifold.c
Branch: default
Log Message:
Manifold on json objects test added
diffs (truncated from 310 to 300 lines):
diff --git a/monetdb5/modules/atoms/Tests/All b/monetdb5/modules/atoms/Tests/All
--- a/monetdb5/modules/atoms/Tests/All
+++ b/monetdb5/modules/atoms/Tests/All
@@ -22,6 +22,7 @@ json03
json04
json05
json07
+json08
jsonrender
uuid00
diff --git a/monetdb5/modules/atoms/Tests/json01.mal
b/monetdb5/modules/atoms/Tests/json01.mal
--- a/monetdb5/modules/atoms/Tests/json01.mal
+++ b/monetdb5/modules/atoms/Tests/json01.mal
@@ -17,7 +17,6 @@ io.print(f);
f:= json.filter(b,"f12");
io.print(f);
-b:= json.new("[]");
b:= json.new("[1,\"f2\", 2]");
f:= json.filter(b,0);
io.print(f);
@@ -27,5 +26,3 @@ f:= json.filter(b,2);
io.print(f);
f:= json.filter(b,3);
io.print(f);
-b:= json.new("[1,2 ]");
-b:= json.new("[\"\\/\" , 2 ]");
diff --git a/monetdb5/modules/atoms/Tests/json01.stable.out
b/monetdb5/modules/atoms/Tests/json01.stable.out
--- a/monetdb5/modules/atoms/Tests/json01.stable.out
+++ b/monetdb5/modules/atoms/Tests/json01.stable.out
@@ -37,7 +37,6 @@ function user.main():void;
io.print(f);
f := json.filter(b,"f12");
io.print(f);
- b := json.new("[]");
b := json.new("[1,\"f2\", 2]");
f := json.filter(b,0);
io.print(f);
@@ -47,8 +46,6 @@ function user.main():void;
io.print(f);
f := json.filter(b,3);
io.print(f);
- b := json.new("[1,2 ]");
- b := json.new("[\"\\/\" , 2 ]");
end main;
[ "[]" ]
[ "[1]" ]
diff --git a/monetdb5/modules/atoms/Tests/json08.mal
b/monetdb5/modules/atoms/Tests/json08.mal
--- a/monetdb5/modules/atoms/Tests/json08.mal
+++ b/monetdb5/modules/atoms/Tests/json08.mal
@@ -25,12 +25,17 @@ f:bat[:oid,:json]:= mal.manifold("json",
io.print(f);
f:bat[:oid,:json]:= mal.manifold("json","filter",j,"f12");
io.print(f);
+
io.printf("#next batch\n");
-f:bat[:oid,:json]:= mal.manifold("json","filter",j,0);
+i:= bat.new(:oid,:json);
+b:= json.new("[1,\"f2\", 2]");
+bat.append(i,b);
+
+f:bat[:oid,:json]:= mal.manifold("json","filter",i,0);
io.print(f);
-f:bat[:oid,:json]:= mal.manifold("json","filter",j,1);
+f:bat[:oid,:json]:= mal.manifold("json","filter",i,1);
io.print(f);
-f:bat[:oid,:json]:= mal.manifold("json","filter",j,2);
+f:bat[:oid,:json]:= mal.manifold("json","filter",i,2);
io.print(f);
-f:bat[:oid,:json]:= mal.manifold("json","filter",j,3);
+f:bat[:oid,:json]:= mal.manifold("json","filter",i,3);
io.print(f);
diff --git a/monetdb5/modules/atoms/Tests/json08.stable.err
b/monetdb5/modules/atoms/Tests/json08.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/atoms/Tests/json08.stable.err
@@ -0,0 +1,29 @@
+stderr of test 'json08` in directory 'monetdb5/modules/atoms` itself:
+
+
+# 10:44:11 >
+# 10:44:11 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=33195" "--set"
"mapi_usock=/var/tmp/mtest-29940/.s.monetdb.33195" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/export/scratch1/mk/current//Linux/var/MonetDB/mTests_monetdb5_modules_atoms"
"json08.mal"
+# 10:44:11 >
+
+# builtin opt gdk_dbpath =
/export/scratch1/mk/current//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 = 33195
+# cmdline opt mapi_usock = /var/tmp/mtest-29940/.s.monetdb.33195
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/export/scratch1/mk/current//Linux/var/MonetDB/mTests_monetdb5_modules_atoms
+
+# 10:44:11 >
+# 10:44:11 > "Done."
+# 10:44:11 >
+
diff --git a/monetdb5/modules/atoms/Tests/json08.stable.out
b/monetdb5/modules/atoms/Tests/json08.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/atoms/Tests/json08.stable.out
@@ -0,0 +1,146 @@
+stdout of test 'json08` in directory 'monetdb5/modules/atoms` itself:
+
+
+# 10:44:11 >
+# 10:44:11 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=33195" "--set"
"mapi_usock=/var/tmp/mtest-29940/.s.monetdb.33195" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/export/scratch1/mk/current//Linux/var/MonetDB/mTests_monetdb5_modules_atoms"
"json08.mal"
+# 10:44:11 >
+
+# MonetDB 5 server v11.18.0
+# This is an unreleased version
+# Serving database 'mTests_monetdb5_modules_atoms', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 15.591 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:33195/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-29940/.s.monetdb.33195
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+function user.main():void;
+#validity tests
+ j := bat.new(:oid,:json);
+ b := json.new("{}");
+ bat.append(j,b);
+ b := json.new("{\"f1\":1}");
+ bat.append(j,b);
+ b := json.new("{\"f1\":1,\"f2\":2}");
+ bat.append(j,b);
+ b := json.new("{\"f1\":1,\"f2\":2,\"f1\":3}");
+ bat.append(j,b);
+ b := json.new("{\"f1\":{\"f12\":3},\"f2\":[2,3,4]}");
+ bat.append(j,b);
+ b := json.new("[1,\"f2\", 2]");
+ bat.append(j,b);
+ f:bat[:oid,:json] := mal.manifold("json","filter",j,"f1");
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",j,"f1");
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",j,"f2");
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",j,"f1");
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",j,"f1");
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",j,"f12");
+ io.print(f);
+ io.printf("#next batch\n");
+ i := bat.new(:oid,:json);
+ b := json.new("[1,\"f2\", 2]");
+ bat.append(i,b);
+ f:bat[:oid,:json] := mal.manifold("json","filter",i,0);
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",i,1);
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",i,2);
+ io.print(f);
+ f:bat[:oid,:json] := mal.manifold("json","filter",i,3);
+ io.print(f);
+end main;
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[]" ]
+[ 1@0, "[]" ]
+[ 2@0, "[1]" ]
+[ 3@0, "[1]" ]
+[ 4@0, "[1]" ]
+[ 5@0, "[{\"f12\":3}]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[]" ]
+[ 1@0, "[]" ]
+[ 2@0, "[1]" ]
+[ 3@0, "[1]" ]
+[ 4@0, "[1]" ]
+[ 5@0, "[{\"f12\":3}]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[]" ]
+[ 1@0, "[]" ]
+[ 2@0, "[]" ]
+[ 3@0, "[2]" ]
+[ 4@0, "[2]" ]
+[ 5@0, "[[2,3,4]]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[]" ]
+[ 1@0, "[]" ]
+[ 2@0, "[1]" ]
+[ 3@0, "[1]" ]
+[ 4@0, "[1]" ]
+[ 5@0, "[{\"f12\":3}]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[]" ]
+[ 1@0, "[]" ]
+[ 2@0, "[1]" ]
+[ 3@0, "[1]" ]
+[ 4@0, "[1]" ]
+[ 5@0, "[{\"f12\":3}]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[]" ]
+[ 1@0, "[]" ]
+[ 2@0, "[1]" ]
+[ 3@0, "[1]" ]
+[ 4@0, "[1]" ]
+[ 5@0, "[{\"f12\":3}]" ]
+#next batch
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[1]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[\"f2\"]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[2]" ]
+#--------------------------#
+# h t # name
+# void json # type
+#--------------------------#
+[ 0@0, "[]" ]
+
+# 10:44:11 >
+# 10:44:11 > "Done."
+# 10:44:11 >
+
diff --git a/monetdb5/modules/mal/manifold.c b/monetdb5/modules/mal/manifold.c
--- a/monetdb5/modules/mal/manifold.c
+++ b/monetdb5/modules/mal/manifold.c
@@ -24,7 +24,8 @@
#include "manifold.h"
#include "mal_resolve.h"
#include "mal_builder.h"
-#define _DEBUG_MANIFOLD_
+
+//#define _DEBUG_MANIFOLD_
/* The default iterator over known scalar commands.
* It can be less efficient then the vector based implementations,
@@ -263,7 +264,14 @@ MANIFOLDevaluate(Client cntxt, MalBlkPtr
mat[0].bi = bat_iterator(mat[0].b);
mat[0].first = (void *) Tloc(mat[0].b, BUNfirst(mat[0].b));
mat[0].last = (void *) Tloc(mat[0].b, BUNlast(mat[0].b));
- BATseqbase(mat[0].b,0);
+ BATseqbase(mat[0].b, mat[mut.fvar].b->hseqbase);
+ if( ATOMstorage(mat[0].b->ttype) != TYPE_str)
+ BATsetcount(mat[0].b,cnt);
+ mat[0].b->hsorted= mat[mut.fvar].b->hsorted;
+ mat[0].b->hrevsorted= mat[mut.fvar].b->hrevsorted;
+ mat[0].b->tsorted=0;
+ mat[0].b->trevsorted=0;
+
pci->fcn = fcn;
@@ -276,21 +284,13 @@ MANIFOLDevaluate(Client cntxt, MalBlkPtr
msg = MANIFOLDjob(&mut);
// consolidate the properties
- BATsetcount(mat[0].b,cnt);
- mat[0].b->tkey= 0;
- mat[0].b->tsorted =0;
- mat[0].b->trevsorted = 0;
- mat[0].b->hkey= 0;
- mat[0].b->hsorted =0;
- mat[0].b->hrevsorted = 0;
BATderiveProps(mat[0].b, TRUE);
BBPkeepref(*(int*) getArgReference(stk,pci,0)=mat[0].b->batCacheid);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list