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

Modified Files:
      Tag: xrpcdemo
        opt_complex.c 
Log Message:
propagated changes of Friday May 30 2008 - Saturday May 31 2008
from the XQuery_0-24 branch to the xrpcdemo branch

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/30 - tsheyar:
        
compiler/algebra/physical.c,1.69.2.2(XQuery_0-24,XQuery_0-24_sync,Stable_DailyBuild-31)
-- doc_tbl is trivially sorted for inputs of cardinality 1.
   (This change avoids the planning of a physical sort operator.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/30 - tsheyar:
        
compiler/algebra/planner.c,1.62.2.2(XQuery_0-24,XQuery_0-24_sync,Stable_DailyBuild-31)
-- add missing physical implementation for the step_join operator.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/30 - tsheyar:
        
compiler/algebra/opt/opt_complex.c,1.45.2.1(XQuery_0-24,XQuery_0-24_sync,Stable_DailyBuild-31)
-- performance fix for step_joins.
   (Merge step_join pair implementing descendant-or-self::node()/child::___
    into a single step_join descendant::___.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/31 - stmane:
        compiler/algebra/planner.c,1.62.2.3(XQuery_0-24,XQuery_0-24_sync)

fixed compilation: removed unused variable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/31 - stmane: compiler/algebra/planner.c,1.62.2.4(XQuery_0-24)

fixed also icc compilation:
removed set but never used variable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U opt_complex.c
Index: opt_complex.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_complex.c,v
retrieving revision 1.45
retrieving revision 1.45.4.1
diff -u -d -r1.45 -r1.45.4.1
--- opt_complex.c       8 May 2008 09:13:36 -0000       1.45
+++ opt_complex.c       31 May 2008 08:47:09 -0000      1.45.4.1
@@ -1307,6 +1307,52 @@
                 p->sem.step.level - 1 == PFprop_level (R(p)->prop,
                                                        p->sem.step.item))
                 p->sem.step.spec.axis = alg_chld;
+
+            /* combine steps if they are of the form:
+               ``/descandent-or-self::node()/child::element()'' */
+            if (p->sem.step.spec.axis == alg_chld &&
+                R(p)->kind == la_project &&
+                RL(p)->kind == la_step_join &&
+                RL(p)->sem.step.spec.axis == alg_desc_s &&
+                RL(p)->sem.step.spec.kind == node_kind_node &&
+                !PFprop_icol (p->prop, p->sem.step.item) &&
+                (PFprop_set (p->prop) ||
+                 PFprop_key (p->prop, p->sem.step.item_res))) {
+
+                bool          item_link_correct = false;
+                PFalg_att_t   item_res          = p->sem.step.item_res,
+                              item_in           = p->sem.step.item,
+                              old_item_res      = RL(p)->sem.step.item_res,
+                              old_item_in       = RL(p)->sem.step.item;
+                PFalg_proj_t *proj = PFmalloc (R(p)->schema.count *
+                                               sizeof (PFalg_proj_t));
+
+                for (unsigned int i = 0; i < R(p)->sem.proj.count; i++) {
+                    PFalg_proj_t proj_item = R(p)->sem.proj.items[i];
+
+                    if (proj_item.new == item_in &&
+                        proj_item.old == old_item_res) {
+                        item_link_correct = true;
+                        proj[i] = PFalg_proj (item_in, old_item_in);
+                    }
+                    else if (proj_item.old == old_item_in)
+                        /* the old input item may not appear in the result */
+                        break;
+                    else
+                        proj[i] = proj_item;
+                }
+                if (item_link_correct) {
+                    PFalg_step_spec_t spec = p->sem.step.spec;
+                    spec.axis = alg_desc,
+                    /* rewrite child into descendant
+                       and discard descendant-or-self step */
+                    *p = *PFla_step_join_simple (
+                              L(p), 
+                              PFla_project_ (RLR(p), R(p)->schema.count, proj),
+                              spec, item_in, item_res);
+                    break;
+                }
+            }
             break;
 
         case la_fcns:


-------------------------------------------------------------------------
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