Changeset: 0ee398b5025f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0ee398b5025f
Modified Files:
        monetdb5/optimizer/Tests/joinpath.mal
        monetdb5/optimizer/Tests/joinpath.stable.out
        monetdb5/optimizer/opt_joinpath.c
        monetdb5/optimizer/optimizer.mal
Branch: default
Log Message:

Rely on runtime type checking in joinpath optimizer
The interface required oid-headed bats, which limits the paths
to oid-ranges.
JAQL needed a more flexible joinpath optimizer.


diffs (181 lines):

diff --git a/monetdb5/optimizer/Tests/joinpath.mal 
b/monetdb5/optimizer/Tests/joinpath.mal
--- a/monetdb5/optimizer/Tests/joinpath.mal
+++ b/monetdb5/optimizer/Tests/joinpath.mal
@@ -1,24 +1,33 @@
+function tst0();
+       a:= bat.new(:oid,:oid);
+       b:= bat.new(:oid,:oid);
+       c:= bat.new(:oid,:oid);
+       j1:= algebra.leftfetchjoin(a,b);
+       j2:= algebra.leftfetchjoin(c,j1);
+       io.print(j2);
+end tst0;
 function tst1();
        a:= bat.new(:oid,:oid);
        b:= bat.new(:oid,:oid);
        c:= bat.new(:oid,:oid);
-       j1:= algebra.join(a,b);
-       j2:= algebra.join(c,j1);
-       j3:= algebra.join(a,c);
-       j4:= algebra.join(c,j3);
-       io.print(j2);
+       j3:= algebra.leftfetchjoin(a,c);
+       j4:= algebra.leftfetchjoin(b,j3);
        io.print(j4);
 end tst1;
+# The JAQL test case
 function tst2();
-       a:= bat.new(:oid,:oid);
-       b:= bat.new(:oid,:oid);
+       a:= bat.new(:oid,:str);
+       br:= bat.new(:oid,:str);
+       b:= bat.reverse(br);
        c:= bat.new(:oid,:oid);
        j1:= algebra.join(a,b);
        j2:= algebra.join(j1,c);
-       j3:= algebra.join(j1,a);
        io.print(j2);
-       io.print(j3);
 end tst2;
+
+optimizer.joinPath("user","tst0");
+optimizer.deadcode("user","tst0");
+mdb.list("user","tst0");
 optimizer.joinPath("user","tst1");
 optimizer.deadcode("user","tst1");
 mdb.list("user","tst1");
diff --git a/monetdb5/optimizer/Tests/joinpath.stable.out 
b/monetdb5/optimizer/Tests/joinpath.stable.out
--- a/monetdb5/optimizer/Tests/joinpath.stable.out
+++ b/monetdb5/optimizer/Tests/joinpath.stable.out
@@ -9,53 +9,65 @@ stdout of test 'joinpath` in directory '
 # Serving database 'mTests_src_optimizer', using 4 threads
 # Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
 # Copyright (c) 1993-July 2008 CWI.
-# Copyright (c) August 2008- MonetDB B.V., all rights reserved
-# Visit http://monetdb.cwi.nl/ for further information
-# Listening for connection requests on mapi:monetdb://eir.ins.cwi.nl:38534/
+# 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:33706/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-633/.s.monetdb.33706
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+function user.tst0():void;
+    a := bat.new(:oid,:oid);
+    b := bat.new(:oid,:oid);
+    c := bat.new(:oid,:oid);
+    j1 := algebra.leftfetchjoin(a,b);
+    j2 := algebra.leftfetchjoin(c,j1);
+    io.print(j2);
+end tst0;
 function user.tst1():void;
     a := bat.new(:oid,:oid);
     b := bat.new(:oid,:oid);
     c := bat.new(:oid,:oid);
-    j1 := algebra.join(a,b);
-    j2 := algebra.join(c,j1);
-    j3 := algebra.join(a,c);
-    j4 := algebra.join(c,j3);
-    io.print(j2);
+    j3 := algebra.leftfetchjoin(a,c);
+    j4 := algebra.leftfetchjoin(b,j3);
     io.print(j4);
 end tst1;
 function user.tst2():void;
+    a := bat.new(:oid,:str);
+    br := bat.new(:oid,:str);
+    b := bat.reverse(br);
+    c := bat.new(:oid,:oid);
+    j1 := algebra.join(a,b);
+    j2 := algebra.join(j1,c);
+    io.print(j2);
+end tst2;
+function user.main():void;
+# The JAQL test case 
+    mdb.list("user","tst0");
+    mdb.list("user","tst1");
+    mdb.list("user","tst2");
+end main;
+function user.tst0():void;
     a := bat.new(:oid,:oid);
     b := bat.new(:oid,:oid);
     c := bat.new(:oid,:oid);
-    j1 := algebra.join(a,b);
-    j2 := algebra.join(j1,c);
-    j3 := algebra.join(j1,a);
+    j2:bat[:oid,:oid]  := algebra.leftfetchjoinPath(c,a,b);
     io.print(j2);
-    io.print(j3);
-end tst2;
-function user.main():void;
-    mdb.list("user","tst1");
-    mdb.list("user","tst2");
-end main;
+end tst0;
 function user.tst1():void;
     a := bat.new(:oid,:oid);
     b := bat.new(:oid,:oid);
     c := bat.new(:oid,:oid);
-    X_11 := algebra.join(c,a);
-    j2:bat[:oid,:oid]  := algebra.join(X_11,b);
-    j4:bat[:oid,:oid]  := algebra.join(X_11,c);
-    io.print(j2);
+    j4:bat[:oid,:oid]  := algebra.leftfetchjoinPath(b,a,c);
     io.print(j4);
 end tst1;
 function user.tst2():void;
-    a := bat.new(:oid,:oid);
-    b := bat.new(:oid,:oid);
+    a := bat.new(:oid,:str);
+    br := bat.new(:oid,:str);
+    b := bat.reverse(br);
     c := bat.new(:oid,:oid);
-    j1 := algebra.join(a,b);
-    j2 := algebra.join(j1,c);
-    j3 := algebra.join(j1,a);
+    j2:bat[:oid,:oid]  := algebra.joinPath(a,b,c);
     io.print(j2);
-    io.print(j3);
 end tst2;
 
 # 08:48:38 >  
diff --git a/monetdb5/optimizer/opt_joinpath.c 
b/monetdb5/optimizer/opt_joinpath.c
--- a/monetdb5/optimizer/opt_joinpath.c
+++ b/monetdb5/optimizer/opt_joinpath.c
@@ -209,7 +209,7 @@ OPTjoinPathImplementation(Client cntxt, 
                                        }
                                        r = 0;
                                }
-                               OPTDEBUGjoinPath {
+                               OPTDEBUGjoinPath if (r) {
                                        mnstr_printf(cntxt->fdout,"#expand list 
\n");
                                        printInstruction(cntxt->fdout,mb, 0, p, 
LIST_MAL_ALL);
                                        printInstruction(cntxt->fdout,mb, 0, q, 
LIST_MAL_ALL);
diff --git a/monetdb5/optimizer/optimizer.mal b/monetdb5/optimizer/optimizer.mal
--- a/monetdb5/optimizer/optimizer.mal
+++ b/monetdb5/optimizer/optimizer.mal
@@ -263,19 +263,19 @@ pattern optimizer.joinPath(mod:str, fcn:
 address OPTwrapper
 comment "Join path constructor";
 
-pattern algebra.joinPath(l:bat[:oid,:any]...):bat[:oid,:any]
+pattern algebra.joinPath(l:bat[:any,:any]...):bat[:oid,:any]
 address ALGjoinPath
 comment "Routine to handle join paths.  The type analysis is rather tricky.";
 
-pattern algebra.leftjoinPath(l:bat[:oid,:any]...):bat[:oid,:any]
+pattern algebra.leftjoinPath(l:bat[:any,:any]...):bat[:oid,:any]
 address ALGjoinPath
 comment "Routine to handle join paths.  The type analysis is rather tricky.";
 
-pattern algebra.leftfetchjoinPath(l:bat[:oid,:any]...):bat[:oid,:any]
+pattern algebra.leftfetchjoinPath(l:bat[:any,:any]...):bat[:any,:any]
 address ALGjoinPath
 comment "Routine to handle join paths.  The type analysis is rather tricky.";
 
-pattern algebra.semijoinPath(l:bat[:oid,:any]...):bat[:oid,:any]
+pattern algebra.semijoinPath(l:bat[:any,:any]...):bat[:any,:any]
 address ALGjoinPath
 comment "Routine to handle join paths.  The type analysis is rather tricky.";
 
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to