Update of /cvsroot/monetdb/pathfinder/compiler/algebra/opt
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25325/algebra/opt

Modified Files:
        opt_mvd.c opt_thetajoin.c 
Log Message:
-- Removed conceptually incorrect code (that was never used before).

   We may push an operator only into both sides of a cross product
   (or a thetajoin) if the operator does not change the cardinality.
   Otherwise applying the operator in both inputs returns different
   results.


U opt_mvd.c
Index: opt_mvd.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_mvd.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- opt_mvd.c   16 Feb 2008 19:42:40 -0000      1.37
+++ opt_mvd.c   3 Apr 2008 15:23:06 -0000       1.38
@@ -105,6 +105,8 @@
         bool switch_right = att_present (LR(p), p->sem.binary.att1) &&
                             att_present (LR(p), p->sem.binary.att2);
 
+        /* Pushing down the operator twice is only allowed
+           if it doesn't affect the cardinality. */
         if (switch_left && switch_right) {
             *p = *(cross_can (op (LL(p),
                                   p->sem.binary.res,
@@ -149,6 +151,8 @@
         bool switch_left = att_present (LL(p), p->sem.unary.att);
         bool switch_right = att_present (LR(p), p->sem.unary.att);
 
+        /* Pushing down the operator twice is only allowed
+           if it doesn't affect the cardinality. */
         if (switch_left && switch_right) {
             *p = *(cross_can (op (LL(p),
                                   p->sem.unary.res,
@@ -787,6 +791,8 @@
                                             p->sem.fun_1to1.refs.atts[i]);
             }
 
+            /* Pushing down the operator twice is only allowed
+               if it doesn't affect the cardinality. */
             if (switch_left && switch_right) {
                 *p = *(cross_can (fun_1to1 (LL(p),
                                             p->sem.fun_1to1.kind,
@@ -1037,6 +1043,8 @@
             bool switch_left = att_present (LL(p), p->sem.type.att);
             bool switch_right = att_present (LR(p), p->sem.type.att);
 
+            /* Pushing down the operator twice is only allowed
+               if it doesn't affect the cardinality. */
             if (switch_left && switch_right) {
                 *p = *(cross_can (type (LL(p),
                                         p->sem.type.res,
@@ -1072,6 +1080,8 @@
             bool switch_left = att_present (LL(p), p->sem.type.att);
             bool switch_right = att_present (LR(p), p->sem.type.att);
 
+            /* Pushing down the operator twice is only allowed
+               if it doesn't affect the cardinality. */
             if (switch_left && switch_right) {
                 *p = *(cross_can (type_assert_pos (
                                       LL(p),
@@ -1107,6 +1117,8 @@
             bool switch_left = att_present (LL(p), p->sem.type.att);
             bool switch_right = att_present (LR(p), p->sem.type.att);
 
+            /* Pushing down the operator twice is only allowed
+               if it doesn't affect the cardinality. */
             if (switch_left && switch_right) {
                 *p = *(cross_can (cast (LL(p),
                                         p->sem.type.res,
@@ -1235,24 +1247,7 @@
             bool switch_left = att_present (RL(p), p->sem.step.item);
             bool switch_right = att_present (RR(p), p->sem.step.item);
 
-            if (switch_left && switch_right) {
-                *p = *(cross_can (step_join (
-                                        L(p),
-                                        RL(p),
-                                        p->sem.step.spec,
-                                        p->sem.step.level,
-                                        p->sem.step.item,
-                                        p->sem.step.item_res),
-                                  step_join (
-                                        L(p),
-                                        RR(p),
-                                        p->sem.step.spec,
-                                        p->sem.step.level,
-                                        p->sem.step.item,
-                                        p->sem.step.item_res)));
-                modified = true;
-            }
-            else if (switch_left) {
+            if (switch_left) {
                 *p = *(cross_can (step_join (
                                         L(p), RL(p),
                                         p->sem.step.spec,
@@ -1322,28 +1317,7 @@
             bool switch_left = att_present (RL(p), p->sem.step.item);
             bool switch_right = att_present (RR(p), p->sem.step.item);
 
-            if (switch_left && switch_right) {
-                *p = *(cross_can (guide_step_join (
-                                        L(p),
-                                        RL(p),
-                                        p->sem.step.spec,
-                                        p->sem.step.guide_count,
-                                        p->sem.step.guides,
-                                        p->sem.step.level,
-                                        p->sem.step.item,
-                                        p->sem.step.item_res),
-                                  guide_step_join (
-                                        L(p),
-                                        RR(p),
-                                        p->sem.step.spec,
-                                        p->sem.step.guide_count,
-                                        p->sem.step.guides,
-                                        p->sem.step.level,
-                                        p->sem.step.item,
-                                        p->sem.step.item_res)));
-                modified = true;
-            }
-            else if (switch_left) {
+            if (switch_left) {
                 *p = *(cross_can (guide_step_join (
                                         L(p), RL(p),
                                         p->sem.step.spec,
@@ -1378,24 +1352,7 @@
             bool switch_right = att_present (RR(p), p->sem.doc_join.item) &&
                                 att_present (RR(p), p->sem.doc_join.item_doc);
 
-            if (switch_left && switch_right) {
-                *p = *(cross_can (doc_index_join (
-                                        L(p),
-                                        RL(p),
-                                        p->sem.doc_join.kind,
-                                        p->sem.doc_join.item,
-                                        p->sem.doc_join.item_res,
-                                        p->sem.doc_join.item_doc),
-                                  doc_index_join (
-                                        L(p),
-                                        RR(p),
-                                        p->sem.doc_join.kind,
-                                        p->sem.doc_join.item,
-                                        p->sem.doc_join.item_res,
-                                        p->sem.doc_join.item_doc)));
-                modified = true;
-            }
-            else if (switch_left) {
+            if (switch_left) {
                 *p = *(cross_can (doc_index_join (
                                         L(p), RL(p),
                                         p->sem.doc_join.kind,
@@ -1429,18 +1386,7 @@
             bool switch_left = att_present (RL(p), p->sem.doc_access.att);
             bool switch_right = att_present (RR(p), p->sem.doc_access.att);
 
-            if (switch_left && switch_right) {
-                *p = *(cross_can (doc_access (L(p), RL(p),
-                                        p->sem.doc_access.res,
-                                        p->sem.doc_access.att,
-                                        p->sem.doc_access.doc_col),
-                                  doc_access (L(p), RR(p),
-                                        p->sem.doc_access.res,
-                                        p->sem.doc_access.att,
-                                        p->sem.doc_access.doc_col)));
-                modified = true;
-            }
-            else if (switch_left) {
+            if (switch_left) {
                 *p = *(cross_can (doc_access (L(p), RL(p),
                                         p->sem.doc_access.res,
                                         p->sem.doc_access.att,

U opt_thetajoin.c
Index: opt_thetajoin.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_thetajoin.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- opt_thetajoin.c     3 Apr 2008 11:03:25 -0000       1.22
+++ opt_thetajoin.c     3 Apr 2008 15:23:06 -0000       1.23
@@ -519,6 +519,8 @@
         bool switch_right = PFprop_ocol (LR(p), p->sem.binary.att1) &&
                             PFprop_ocol (LR(p), p->sem.binary.att2);
 
+        /* Pushing down the operator twice is only allowed
+           if it doesn't affect the cardinality. */
         if (switch_left && switch_right) {
             resolve_name_conflict (L(p), p->sem.binary.res);
             *p = *(thetajoin_opt (
@@ -1176,6 +1178,8 @@
                                                 p->sem.fun_1to1.refs.atts[i]);
                 }
 
+                /* Pushing down the operator twice is only allowed
+                   if it doesn't affect the cardinality. */
                 if (switch_left && switch_right) {
                     resolve_name_conflict (L(p), p->sem.fun_1to1.res);
                     *p = *(thetajoin_opt (
@@ -1235,6 +1239,8 @@
                 bool switch_left = PFprop_ocol (LL(p), p->sem.unary.att);
                 bool switch_right = PFprop_ocol (LR(p), p->sem.unary.att);
 
+                /* Pushing down the operator twice is only allowed
+                   if it doesn't affect the cardinality. */
                 if (switch_left && switch_right) {
                     resolve_name_conflict (L(p), p->sem.unary.res);
                     *p = *(thetajoin_opt (
@@ -1548,6 +1554,8 @@
                 bool switch_left = PFprop_ocol (LL(p), p->sem.type.att);
                 bool switch_right = PFprop_ocol (LR(p), p->sem.type.att);
 
+                /* Pushing down the operator twice is only allowed
+                   if it doesn't affect the cardinality. */
                 if (switch_left && switch_right) {
                     resolve_name_conflict (L(p), p->sem.type.res);
                     *p = *(thetajoin_opt (type (LL(p),
@@ -1589,6 +1597,8 @@
                 bool switch_left = PFprop_ocol (LL(p), p->sem.type.att);
                 bool switch_right = PFprop_ocol (LR(p), p->sem.type.att);
 
+                /* Pushing down the operator twice is only allowed
+                   if it doesn't affect the cardinality. */
                 if (switch_left && switch_right) {
                     *p = *(thetajoin_opt (type_assert_pos (
                                               LL(p),
@@ -1627,6 +1637,8 @@
                 bool switch_left = PFprop_ocol (LL(p), p->sem.type.att);
                 bool switch_right = PFprop_ocol (LR(p), p->sem.type.att);
 
+                /* Pushing down the operator twice is only allowed
+                   if it doesn't affect the cardinality. */
                 if (switch_left && switch_right) {
                     resolve_name_conflict (L(p), p->sem.type.res);
                     *p = *(thetajoin_opt (cast (LL(p),
@@ -1672,26 +1684,7 @@
                 bool switch_left = PFprop_ocol (RL(p), p->sem.step.item);
                 bool switch_right = PFprop_ocol (RR(p), p->sem.step.item);
 
-                if (switch_left && switch_right) {
-                    resolve_name_conflict (R(p), p->sem.step.item_res);
-                    *p = *(thetajoin_opt (step_join (
-                                                L(p),
-                                                RL(p),
-                                                p->sem.step.spec,
-                                                p->sem.step.level,
-                                                p->sem.step.item,
-                                                p->sem.step.item_res),
-                                          step_join (
-                                                L(p),
-                                                RR(p),
-                                                p->sem.step.spec,
-                                                p->sem.step.level,
-                                                p->sem.step.item,
-                                                p->sem.step.item_res),
-                                          R(p)->sem.thetajoin_opt.pred));
-                    modified = true;
-                }
-                else if (switch_left) {
+                if (switch_left) {
                     resolve_name_conflict (R(p), p->sem.step.item_res);
                     *p = *(thetajoin_opt (step_join (
                                                 L(p), RL(p),
@@ -1724,30 +1717,7 @@
                 bool switch_left = PFprop_ocol (RL(p), p->sem.step.item);
                 bool switch_right = PFprop_ocol (RR(p), p->sem.step.item);
 
-                if (switch_left && switch_right) {
-                    resolve_name_conflict (R(p), p->sem.step.item_res);
-                    *p = *(thetajoin_opt (guide_step_join (
-                                                L(p),
-                                                RL(p),
-                                                p->sem.step.spec,
-                                                p->sem.step.guide_count,
-                                                p->sem.step.guides,
-                                                p->sem.step.level,
-                                                p->sem.step.item,
-                                                p->sem.step.item_res),
-                                          guide_step_join (
-                                                L(p),
-                                                RR(p),
-                                                p->sem.step.spec,
-                                                p->sem.step.guide_count,
-                                                p->sem.step.guides,
-                                                p->sem.step.level,
-                                                p->sem.step.item,
-                                                p->sem.step.item_res),
-                                          R(p)->sem.thetajoin_opt.pred));
-                    modified = true;
-                }
-                else if (switch_left) {
+                if (switch_left) {
                     resolve_name_conflict (R(p), p->sem.step.item_res);
                     *p = *(thetajoin_opt (guide_step_join (
                                                 L(p), RL(p),
@@ -1787,26 +1757,7 @@
                 switch_right = PFprop_ocol (RR(p), p->sem.doc_join.item) &&
                                PFprop_ocol (RR(p), p->sem.doc_join.item_doc);
 
-                if (switch_left && switch_right) {
-                    resolve_name_conflict (R(p), p->sem.doc_join.item_res);
-                    *p = *(thetajoin_opt (doc_index_join (
-                                                L(p),
-                                                RL(p),
-                                                p->sem.doc_join.kind,
-                                                p->sem.doc_join.item,
-                                                p->sem.doc_join.item_res,
-                                                p->sem.doc_join.item_doc),
-                                          doc_index_join (
-                                                L(p),
-                                                RR(p),
-                                                p->sem.doc_join.kind,
-                                                p->sem.doc_join.item,
-                                                p->sem.doc_join.item_res,
-                                                p->sem.doc_join.item_doc),
-                                          R(p)->sem.thetajoin_opt.pred));
-                    modified = true;
-                }
-                else if (switch_left) {
+                if (switch_left) {
                     resolve_name_conflict (R(p), p->sem.doc_join.item_res);
                     *p = *(thetajoin_opt (doc_index_join (
                                                 L(p), RL(p),
@@ -1844,20 +1795,7 @@
                 bool switch_left = PFprop_ocol (RL(p), p->sem.doc_access.att);
                 bool switch_right = PFprop_ocol (RR(p), p->sem.doc_access.att);
 
-                if (switch_left && switch_right) {
-                    resolve_name_conflict (R(p), p->sem.doc_access.res);
-                    *p = *(thetajoin_opt (doc_access (L(p), RL(p),
-                                                p->sem.doc_access.res,
-                                                p->sem.doc_access.att,
-                                                p->sem.doc_access.doc_col),
-                                          doc_access (L(p), RR(p),
-                                                p->sem.doc_access.res,
-                                                p->sem.doc_access.att,
-                                                p->sem.doc_access.doc_col),
-                                          R(p)->sem.thetajoin_opt.pred));
-                    modified = true;
-                }
-                else if (switch_left) {
+                if (switch_left) {
                     resolve_name_conflict (R(p), p->sem.doc_access.res);
                     *p = *(thetajoin_opt (doc_access (L(p), RL(p),
                                                 p->sem.doc_access.res,


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to