Changeset: 735ff5c4c3e3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=735ff5c4c3e3
Modified Files:
        MonetDB5/src/optimizer/opt_mergetable.mx
        MonetDB5/src/optimizer/opt_prelude.mx
Branch: Jun2010
Log Message:

add support aggr.product in opt_mergetable

for range/band joins we now fallback properly (in opt_mergetable)


diffs (81 lines):

diff -r d37c0c573b27 -r 735ff5c4c3e3 MonetDB5/src/optimizer/opt_mergetable.mx
--- a/MonetDB5/src/optimizer/opt_mergetable.mx  Fri Aug 13 21:23:13 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_mergetable.mx  Fri Aug 13 23:50:19 2010 +0200
@@ -999,7 +999,7 @@
 {
        if (aggr == countRef || aggr == count_no_nilRef)
                return sumRef;
-       /* min/max/sum are fine */
+       /* min/max/sum/prod are fine */
        return aggr;
 }
 
@@ -1108,10 +1108,7 @@
 
        s = newInstruction(mb,ASSIGNsymbol);
        setModuleId(s,aggrRef);
-       if (getFunctionId(p) == minRef || getFunctionId(p) == maxRef)
-               setFunctionId(s, getFunctionId(p));
-       else    
-               setFunctionId(s, sumRef);
+       setFunctionId(s, aggr_phase2(getFunctionId(p)));
        getArg(s,0) = getArg(p,0);
        s = pushArgument(mb, s, getArg(r,0));
        pushInstruction(mb, s);
@@ -1609,7 +1606,8 @@
 UNION(mirror().join()).
 @c
 
-               if (match > 0 && isMatJoinOp(p)) {
+               /* only handle simple joins, ie not range/band joins */
+               if (match > 0 && match <= 2 && isMatJoinOp(p)) {
                        m = isMATalias(getArg(p,1), mat, mtop);
                        n = isMATalias(getArg(p,2), mat, mtop);
                        if ((m = mat_join(mb, p, mat, mtop, m, n)) < 0)
@@ -1696,7 +1694,8 @@
                    getFunctionId(p) == count_no_nilRef ||
                    getFunctionId(p) == minRef ||
                    getFunctionId(p) == maxRef ||
-                   getFunctionId(p) == sumRef) &&
+                   getFunctionId(p) == sumRef ||
+                   getFunctionId(p) == prodRef) &&
                   ((m=isMATalias(getArg(p,1), mat, mtop)) >= 0) &&
                   ((n=isMATalias(getArg(p,2), mat, mtop)) >= 0) &&
                   ((o=isMATalias(getArg(p,3), mat, mtop)) >= 0)) {
@@ -1720,7 +1719,8 @@
                         getFunctionId(p)== count_no_nilRef || 
                         getFunctionId(p)== minRef ||
                         getFunctionId(p)== maxRef ||
-                        getFunctionId(p)== sumRef) &&
+                        getFunctionId(p)== sumRef ||
+                        getFunctionId(p) == prodRef) &&
                        (m=isMATalias(getArg(p,1), mat, mtop)) >= 0){
                        mat_aggr(mb, p, mat, m);
                        actions++;
diff -r d37c0c573b27 -r 735ff5c4c3e3 MonetDB5/src/optimizer/opt_prelude.mx
--- a/MonetDB5/src/optimizer/opt_prelude.mx     Fri Aug 13 21:23:13 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_prelude.mx     Fri Aug 13 23:50:19 2010 +0200
@@ -138,6 +138,7 @@
 opt_export  str sqlplusRef;
 opt_export  str printRef;
 opt_export  str preludeRef;
+opt_export  str prodRef;
 opt_export  str postludeRef;
 opt_export  str profilerRef;
 opt_export  str projectRef;
@@ -334,6 +335,7 @@
 str sqlplusRef;
 str printRef;
 str preludeRef;
+str prodRef;
 str postludeRef;
 str profilerRef;
 str projectRef;
@@ -526,6 +528,7 @@
                sqlplusRef = putName("sqladd",6);
                printRef = putName("print",5);
                preludeRef = putName("prelude",7);
+               prodRef = putName("product",7);
                profilerRef = putName("profiler",8);
                postludeRef = putName("postlude",8);
                projectRef = putName("project",7);
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to