Update of /cvsroot/monetdb/pathfinder/compiler/debug
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26788/debug

Modified Files:
      Tag: XQuery_0-24
        logdebug.c 
Log Message:
-- Re-implemented the join pushdown optimization phase
   (due to incorrect rewrites).

   o The special equi-join operator working on unique column
     names now incorporates for each operand a projection.

     Based on this projection we can now always maintain the
     correct schema and push the join even through renaming
     projections.

     The old variant did in some cases 'forget' from which
     operand of an equi-join columns with the same name stem
     from.

   o The new equi-join pushdown phase is a lot more effective
     than the old one and thus generates very wide relations
     (where a large number of columns can be pruned afterwards).

     Placing a projection pushdown phase (icols optimization)
     afterwards allows us to map the resulting plans back to
     bit-encoded column names without running out of column
     bits.


U logdebug.c
Index: logdebug.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/logdebug.c,v
retrieving revision 1.100
retrieving revision 1.100.2.1
diff -u -d -r1.100 -r1.100.2.1
--- logdebug.c  7 Apr 2008 11:06:51 -0000       1.100
+++ logdebug.c  28 May 2008 11:37:33 -0000      1.100.2.1
@@ -574,11 +574,34 @@
             break;
 
         case la_eqjoin_unq:
+#define proj_at(l,i) (*(PFalg_proj_t *) PFarray_at ((l),(i)))
             PFarray_printf (dot, "%s (%s:%s = %s)",
                             a_id[n->kind],
-                            PFatt_str (n->sem.eqjoin_unq.res),
-                            PFatt_str (n->sem.eqjoin_unq.att1),
-                            PFatt_str (n->sem.eqjoin_unq.att2));
+                            PFatt_str (proj_at(n->sem.eqjoin_unq.lproj,0).new),
+                            PFatt_str (proj_at(n->sem.eqjoin_unq.lproj,0).old),
+                            PFatt_str 
(proj_at(n->sem.eqjoin_unq.rproj,0).old));
+            PFarray_printf (dot, "\\nleft proj: (");
+            for (unsigned int i = 1;
+                 i < PFarray_last (n->sem.eqjoin_unq.lproj);
+                 i++)
+                PFarray_printf (
+                    dot,
+                    "%s:%s%s",
+                    PFatt_str (proj_at(n->sem.eqjoin_unq.lproj,i).new),
+                    PFatt_str (proj_at(n->sem.eqjoin_unq.lproj,i).old),
+                    i+1 == PFarray_last (n->sem.eqjoin_unq.lproj) ? "" : ", ");
+            PFarray_printf (dot, ")");
+            PFarray_printf (dot, "\\nright proj: (");
+            for (unsigned int i = 1;
+                 i < PFarray_last (n->sem.eqjoin_unq.rproj);
+                 i++)
+                PFarray_printf (
+                    dot,
+                    "%s:%s%s",
+                    PFatt_str (proj_at(n->sem.eqjoin_unq.rproj,i).new),
+                    PFatt_str (proj_at(n->sem.eqjoin_unq.rproj,i).old),
+                    i+1 == PFarray_last (n->sem.eqjoin_unq.rproj) ? "" : ", ");
+            PFarray_printf (dot, ")");
             break;
 
 
@@ -1661,14 +1684,50 @@
                             "      <column name=\"%s\" new=\"false\""
                                          " keep=\"%s\" position=\"1\"/>\n"
                             "      <column name=\"%s\" new=\"false\""
-                                         " keep=\"%s\" position=\"2\"/>\n"
-                            "    </content>\n",
-                            PFatt_str (n->sem.eqjoin_unq.att1),
-                            n->sem.eqjoin_unq.att1 == n->sem.eqjoin_unq.res
+                                         " keep=\"%s\" position=\"2\"/>\n",
+                            PFatt_str (proj_at(n->sem.eqjoin_unq.lproj,0).old),
+                            proj_at(n->sem.eqjoin_unq.lproj,0).new ==
+                            proj_at(n->sem.eqjoin_unq.lproj,0).old
                             ? "true" : "false",
-                            PFatt_str (n->sem.eqjoin_unq.att2),
-                            n->sem.eqjoin_unq.att2 == n->sem.eqjoin_unq.res
+                            PFatt_str (proj_at(n->sem.eqjoin_unq.rproj,0).old),
+                            proj_at(n->sem.eqjoin_unq.rproj,0).new ==
+                            proj_at(n->sem.eqjoin_unq.rproj,0).old
                             ? "true" : "false");
+            for (c = 1; c < PFarray_last (n->sem.eqjoin_unq.lproj); c++) {
+                PFalg_proj_t proj = proj_at(n->sem.eqjoin_unq.lproj,c);
+                if (proj.new != proj.old)
+                    PFarray_printf (
+                        xml,
+                        "      <column name=\"%s\" "
+                                      "old_name=\"%s\" "
+                                      "new=\"true\" function=\"left\"/>\n",
+                        PFatt_str (proj.new),
+                        PFatt_str (proj.old));
+                else
+                    PFarray_printf (
+                        xml,
+                        "      <column name=\"%s\" "
+                                       "new=\"false\" function=\"left\"/>\n",
+                        PFatt_str (proj.new));
+            }
+            for (c = 1; c < PFarray_last (n->sem.eqjoin_unq.rproj); c++) {
+                PFalg_proj_t proj = proj_at(n->sem.eqjoin_unq.rproj,c);
+                if (proj.new != proj.old)
+                    PFarray_printf (
+                        xml,
+                        "      <column name=\"%s\" "
+                                      "old_name=\"%s\" "
+                                      "new=\"true\" function=\"right\"/>\n",
+                        PFatt_str (proj.new),
+                        PFatt_str (proj.old));
+                else
+                    PFarray_printf (
+                        xml,
+                        "      <column name=\"%s\" "
+                                       "new=\"false\" function=\"right\"/>\n",
+                        PFatt_str (proj.new));
+            }
+            PFarray_printf (xml, "    </content>\n");
             break;
 
         case la_project:
@@ -2242,6 +2301,8 @@
                              "edge [fontsize=9];\n"
                              "edge [dir=back];\n");
 
+        /* inside debugging we need to reset the dag bits first */
+        PFla_dag_reset (root);
         create_node_id (root);
         la_dot (dot, root, getenv("PF_DEBUG_PRINT_FRAG") != NULL, prop_args);
         PFla_dag_reset (root);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to