Changeset: 4e600865bf65 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4e600865bf65
Added Files:
monetdb5/extras/jaql/jaqltests/Tests/calculations.jaql
monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.err
monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.out
Branch: Oct2012
Log Message:
calculations: add test showing an optimisation problem
The tree is rewritten to put variables on the left, but this obviously
doesn't work with division (without changing the original intentions).
Test to be enabled when we can deal with a sole variable on the
right-hand side of an expression.
diffs (194 lines):
diff --git a/monetdb5/extras/jaql/jaqltests/Tests/calculations.jaql
b/monetdb5/extras/jaql/jaqltests/Tests/calculations.jaql
new file mode 100644
--- /dev/null
+++ b/monetdb5/extras/jaql/jaqltests/Tests/calculations.jaql
@@ -0,0 +1,33 @@
+# some simple "direct" calculations (calculated compile-time)
+[ 1 ] -> transform 1 + 1;
+[ 1 ] -> transform 5 / 2;
+[ 1 ] -> transform 2 * 6;
+[ 1 ] -> transform 4.1 / 2.1;
+[ 1 ] -> transform 5 - 2.1;
+
+A = [
+ 1,
+ 5,
+ 2,
+ 4.1,
+ 5,
+];
+
+B = [
+ 1,
+ 2,
+ 6,
+ 2.1,
+ 2.1,
+];
+
+AB = pairwise(A, B) -> transform {"A": $[0], "B": $[1]};
+AB;
+
+# some runtime evaluated queries
+A -> transform $ / 2;
+B -> transform 10 / $;
+AB -> transform $.A / $.B;
+AB -> transform $.A * $.B;
+AB -> transform $.A + $.B;
+AB -> transform $.A - $.B;
diff --git a/monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.err
b/monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.err
@@ -0,0 +1,36 @@
+stderr of test 'calculations` in directory 'extras/jaql/jaqltests` itself:
+
+
+# 21:20:59 >
+# 21:20:59 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"gdk_dbfarm=/net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-Oct2012-sofia.ins.cwi.nl/five/dbfarm"
"--set" "mapi_open=true" "--set" "mapi_port=30176" "--set" "monet_prompt="
"--trace" "--forcemito" "--set" "mal_listing=2"
"--dbname=mTests_extras_jaql_jaqltests" "--set" "mal_listing=0"
+# 21:20:59 >
+
+# builtin opt gdk_dbname = demo
+# builtin opt gdk_dbfarm =
/ufs/fabian/scratch/ssd/monetdb/Oct2012/program-x86_64/var/lib/monetdb5/dbfarm
+# 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 gdk_dbfarm =
/net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-Oct2012-sofia.ins.cwi.nl/five/dbfarm
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 30176
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbname = mTests_extras_jaql_jaqltests
+# cmdline opt mal_listing = 0
+
+# 21:20:59 >
+# 21:20:59 > "mclient" "-ljaql" "-ftest" "-Eutf-8" "-i" "-e" "--host=sofia"
"--port=30176"
+# 21:20:59 >
+
+
+# 21:20:59 >
+# 21:20:59 > "Done."
+# 21:20:59 >
+
diff --git a/monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.out
b/monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/extras/jaql/jaqltests/Tests/calculations.stable.out
@@ -0,0 +1,110 @@
+stdout of test 'calculations` in directory 'extras/jaql/jaqltests` itself:
+
+
+# 21:20:59 >
+# 21:20:59 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"gdk_dbfarm=/net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-Oct2012-sofia.ins.cwi.nl/five/dbfarm"
"--set" "mapi_open=true" "--set" "mapi_port=30176" "--set" "monet_prompt="
"--trace" "--forcemito" "--set" "mal_listing=2"
"--dbname=mTests_extras_jaql_jaqltests" "--set" "mal_listing=0"
+# 21:20:59 >
+
+# MonetDB 5 server v11.13.4 "Oct2012-3a365170cd97"
+# Serving database 'mTests_extras_jaql_jaqltests', using 8 threads
+# Compiled for x86_64-pc-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-2012 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://sofia.ins.cwi.nl:30176/
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 21:20:59 >
+# 21:20:59 > "mclient" "-ljaql" "-ftest" "-Eutf-8" "-i" "-e" "--host=sofia"
"--port=30176"
+# 21:20:59 >
+
+## some simple "direct" calculations (calculated compile-time)
+#[ 1 ] -> transform 1 + 1;
+% .json # table_name
+% json # name
+% clob # type
+% 5 # length
+[ 2 ]
+#[ 1 ] -> transform 5 / 2;
+% .json # table_name
+% json # name
+% clob # type
+% 5 # length
+[ 2 ]
+#[ 1 ] -> transform 2 * 6;
+% .json # table_name
+% json # name
+% clob # type
+% 6 # length
+[ 12 ]
+#[ 1 ] -> transform 4.1 / 2.1;
+% .json # table_name
+% json # name
+% clob # type
+% 12 # length
+[ 1.952381 ]
+#[ 1 ] -> transform 5 - 2.1;
+% .json # table_name
+% json # name
+% clob # type
+% 12 # length
+[ 2.900000 ]
+#AB;
+% .json # table_name
+% json # name
+% clob # type
+% 35 # length
+[
+ { "A": 1, "B": 1 },
+ { "A": 5, "B": 2 },
+ { "A": 2, "B": 6 },
+ { "A": 4.100000, "B": 2.100000 },
+ { "A": 5, "B": 2.100000 }
+]
+## some runtime evaluated queries
+#A -> transform $ / 2;
+% .json # table_name
+% json # name
+% clob # type
+% 24 # length
+[ 0, 2, 1, 2.050000, 2 ]
+#B -> transform 10 / $;
+% .json # table_name
+% json # name
+% clob # type
+% 31 # length
+[ 10, 2, 5, 2.439024, 2 ]
+#AB -> transform $.A / $.B;
+% .json # table_name
+% json # name
+% clob # type
+% 31 # length
+[ 1, 2, 0, 1.952381, 2.380952 ]
+#AB -> transform $.A * $.B;
+% .json # table_name
+% json # name
+% clob # type
+% 34 # length
+[ 1, 10, 12, 8.610000, 10.500000 ]
+#AB -> transform $.A + $.B;
+% .json # table_name
+% json # name
+% clob # type
+% 31 # length
+[ 2, 7, 8, 6.200000, 7.100000 ]
+#AB -> transform $.A - $.B;
+% .json # table_name
+% json # name
+% clob # type
+% 32 # length
+[ 0, 3, -4, 2.000000, 2.900000 ]
+
+# 21:20:59 >
+# 21:20:59 > "Done."
+# 21:20:59 >
+
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list