Changeset: 70aa4d7fa8af for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=70aa4d7fa8af
Modified Files:
        MonetDB5/src/optimizer/opt_joinpath.mx
Branch: default
Log Message:

Not all joins in a leftjoinpath should use leftjoin.
We should only guarantee that the final result of the join path respect
the order of the first operand. It may be that pairs later in the sequence
are better handled by switching the arguments.


diffs (44 lines):

diff -r c96ec91aee07 -r 70aa4d7fa8af MonetDB5/src/optimizer/opt_joinpath.mx
--- a/MonetDB5/src/optimizer/opt_joinpath.mx    Sat May 08 20:52:49 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_joinpath.mx    Sun May 09 12:12:55 2010 +0200
@@ -102,18 +102,15 @@
 
 pattern algebra.joinPath(l:bat[:any,:any]...):bat[:any,:any]
 address ALGjoinPath
-comment "internal routine to handle join paths.
-       The type analysis is rather tricky.";
+comment "Routine to handle join paths.  The type analysis is rather tricky.";
 
 pattern algebra.leftjoinPath(l:bat[:any,:any]...):bat[:any,:any]
 address ALGjoinPath
-comment "internal routine to handle join paths.
-       The type analysis is rather tricky.";
+comment "Routine to handle join paths.  The type analysis is rather tricky.";
 
 pattern algebra.semijoinPath(l:bat[:any,:any]...):bat[:any,:any]
 address ALGjoinPath
-comment "internal routine to handle join paths.
-       The type analysis is rather tricky.";
+comment "Routine to handle join paths.  The type analysis is rather tricky.";
 @h
 #ifndef _OPT_JOINPATH_
 #define _OPT_JOINPATH_
@@ -577,11 +574,16 @@
 may fire a BATproperty check in a few cases.
 In case a join fails, we may try another order first before 
 abandoning the task.
+
+A left-join sequence only requires the result to be sorted
+against the first operand. For all others operand pairs, the cheapest join 
suffice.
 @c
                switch(flag){
                case 0:
-                       b = BATleftjoin(joins[j], joins[j + 1], 
BATcount(joins[j]));
-                       break;
+                       if ( j == 0) {
+                               b = BATleftjoin(joins[j], joins[j + 1], 
BATcount(joins[j]));
+                               break;
+                       }
                case 1:
                        b = BATjoin(joins[j], joins[j + 1], (BATcount(joins[j]) 
< BATcount(joins[j + 1])? BATcount(joins[j]):BATcount(joins[ j + 1])));
                        break;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to