Changeset: fc806f6bc2cf for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc806f6bc2cf Modified Files: monetdb5/extras/jaql/Tests/All monetdb5/extras/jaql/Tests/expand01.stable.err monetdb5/extras/jaql/Tests/expand01.stable.out monetdb5/extras/jaql/jaqlgencode.c Branch: jacqueline Log Message:
unroll: fix thinko that that accidentially worked on first test we need to take more care when producing a set of object ids, all ids should be in there sort both head and tail to retain the original input order of the pairs diffs (154 lines): diff --git a/monetdb5/extras/jaql/Tests/All b/monetdb5/extras/jaql/Tests/All --- a/monetdb5/extras/jaql/Tests/All +++ b/monetdb5/extras/jaql/Tests/All @@ -9,8 +9,7 @@ plan00 # examples from the docs filter01 transform01 -#fail until we solve the syntactic mess of expand -#expand01 +expand01 #todo #group01 #join01 diff --git a/monetdb5/extras/jaql/Tests/expand01.stable.err b/monetdb5/extras/jaql/Tests/expand01.stable.err new file mode 100644 --- /dev/null +++ b/monetdb5/extras/jaql/Tests/expand01.stable.err @@ -0,0 +1,31 @@ +stderr of test 'expand01` in directory 'extras/jaql` itself: + + +# 20:45:43 > +# 20:45:43 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "gdk_dbfarm=/net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-jacqueline-sofia.ins.cwi.nl/five/dbfarm" "--set" "mapi_open=true" "--set" "mapi_port=37434" "--set" "monet_prompt=" "--trace" "--forcemito" "--set" "mal_listing=2" "--dbname=mTests_extras_jaql" "expand01.mal" +# 20:45:43 > + +# builtin opt gdk_dbname = demo +# builtin opt gdk_dbfarm = /ufs/fabian/scratch/ssd/monetdb/jacqueline/program-x86_64/var/lib/monetdb5/dbfarm +# builtin opt gdk_debug = 0 +# builtin opt gdk_alloc_map = no +# 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-jacqueline-sofia.ins.cwi.nl/five/dbfarm +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 37434 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbname = mTests_extras_jaql + +# 20:45:43 > +# 20:45:43 > "Done." +# 20:45:43 > + diff --git a/monetdb5/extras/jaql/Tests/expand01.stable.out b/monetdb5/extras/jaql/Tests/expand01.stable.out new file mode 100644 --- /dev/null +++ b/monetdb5/extras/jaql/Tests/expand01.stable.out @@ -0,0 +1,38 @@ +stdout of test 'expand01` in directory 'extras/jaql` itself: + + +# 20:45:43 > +# 20:45:43 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "gdk_dbfarm=/net/sofia.ins.cwi.nl/export/scratch1/fabian/tmp/mtest-jacqueline-sofia.ins.cwi.nl/five/dbfarm" "--set" "mapi_open=true" "--set" "mapi_port=37434" "--set" "monet_prompt=" "--trace" "--forcemito" "--set" "mal_listing=2" "--dbname=mTests_extras_jaql" "expand01.mal" +# 20:45:43 > + +# MonetDB 5 server v11.8.0 "jacqueline-497cf791babb+" +# Serving database 'mTests_extras_jaql', using 8 threads +# Compiled for x86_64-pc-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 15.662 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:37434/ +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded +# MonetDB/DataCell module not loaded: MALException:jaql.context:JAQL environment not found +function user.main():void; +# from the docs + jaql.x("nestedData = [ [3,65,8,72], [5,98,2,65] ];"); + jaql.x("nestedData -> expand;"); + jaql.x("nestedData -> expand ($ -> transform $ * 2);"); + jaql.x("nestedData -> expand each arr (arr -> transform each n (n * 2));"); + jaql.x("nestedData -> expand -> transform $ * 2;"); + jaql.x("moviesOwned = [ {\"name\":\"Jon Doe\", \"movie_ids\":[3,65,8,72]}, {\"name\":\"Jane Dean\", \"movie_ids\":[5,98,2]} ];"); + jaql.x("moviesOwned -> expand unroll $.movie_ids;"); +end main; +[ 3, 65, 8, 72, 5, 98, 2, 65 ] +[ 6, 130, 16, 144, 10, 196, 4, 130 ] +[ 6, 130, 16, 144, 10, 196, 4, 130 ] +[ 6, 130, 16, 144, 10, 196, 4, 130 ] +[ { "name": "Jon Doe", "movie_ids": 3 }, { "name": "Jon Doe", "movie_ids": 65 }, { "name": "Jon Doe", "movie_ids": 8 }, { "name": "Jon Doe", "movie_ids": 72 }, { "name": "Jane Dean", "movie_ids": 5 }, { "name": "Jane Dean", "movie_ids": 98 }, { "name": "Jane Dean", "movie_ids": 2 } ] + +# 20:45:43 > +# 20:45:43 > "Done." +# 20:45:43 > + diff --git a/monetdb5/extras/jaql/jaqlgencode.c b/monetdb5/extras/jaql/jaqlgencode.c --- a/monetdb5/extras/jaql/jaqlgencode.c +++ b/monetdb5/extras/jaql/jaqlgencode.c @@ -2077,25 +2077,40 @@ dumptree(jc *j, MalBlkPtr mb, tree *t) /* construct the objects themselves */ q = newInstruction(mb, ASSIGNsymbol); + setModuleId(q, algebraRef); + setFunctionId(q, markTRef); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushArgument(mb, q, d); + q = pushArgument(mb, q, e); + f = getArg(q, 0); + pushInstruction(mb, q); + q = newInstruction(mb, ASSIGNsymbol); + setModuleId(q, batRef); + setFunctionId(q, reverseRef); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushArgument(mb, q, f); + f = getArg(q, 0); + pushInstruction(mb, q); + q = newInstruction(mb, ASSIGNsymbol); setModuleId(q, batRef); setFunctionId(q, reverseRef); q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); q = pushArgument(mb, q, c); - f = getArg(q, 0); - pushInstruction(mb, q); - q = newInstruction(mb, ASSIGNsymbol); - setModuleId(q, algebraRef); - setFunctionId(q, markHRef); - q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); - q = pushArgument(mb, q, f); - q = pushArgument(mb, q, e); - f = getArg(q, 0); + g = getArg(q, 0); pushInstruction(mb, q); q = newInstruction(mb, ASSIGNsymbol); setModuleId(q, algebraRef); setFunctionId(q, joinRef); q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); q = pushArgument(mb, q, f); + q = pushArgument(mb, q, g); + g = getArg(q, 0); + pushInstruction(mb, q); + q = newInstruction(mb, ASSIGNsymbol); + setModuleId(q, algebraRef); + setFunctionId(q, joinRef); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushArgument(mb, q, g); q = pushArgument(mb, q, c); g = getArg(q, 0); pushInstruction(mb, q); @@ -2142,7 +2157,7 @@ dumptree(jc *j, MalBlkPtr mb, tree *t) pushInstruction(mb, q); q = newInstruction(mb, ASSIGNsymbol); setModuleId(q, algebraRef); - setFunctionId(q, sortRef); + setFunctionId(q, sortHTRef); q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); q = pushArgument(mb, q, g); g = getArg(q, 0); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list