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

Modified Files:
      Tag: PF_ROX
        physical.c planner.c 
Log Message:
propagated changes of Thursday May 22 2008 - Saturday May 24 2008
from the development trunk to the PF_ROX branch

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/22 - sjoerd:
        runtime/pf_support.mx,1.299(Current_DailyBuild-24,Current_DailyBuild-23)
Fixed some type punning problems.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/23 - sjoerd: NT/Makefile,1.20(Current_DailyBuild-24)
        
NT/MonetDB4-XQuery/MonetDB4-XQuery64.sln,1.1(Stable_DailyBuild-24,Current_DailyBuild-24)
        
NT/MonetDB4-XQuery/MonetDB4-XQuery64.vdproj,1.1(Stable_DailyBuild-24,Current_DailyBuild-24)
Added 64 bit Windows installer.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/23 - sjoerd:
        
NT/MonetDB4-XQuery/MonetDB4-XQuery.vdproj,1.3(Stable_DailyBuild-24,Current_DailyBuild-24)
Use registry to store where the product is installed.
This means you only get to choose the location in MonetDB-Common.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/23 - tsheyar:
        compiler/algebra/prop/prop_key.c,1.47(Current_DailyBuild-24)
-- some recently added property inference (for path steps) was to optimistic.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/23 - tsheyar:
        compiler/semantics/subtyping.c,1.48(Current_DailyBuild-24)
-- Complete the hierarchy information (integer <-> decimal) for disjoint types.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/05/23 - lsidir: compiler/algebra/physical.c,1.69(Current_DailyBuild-24)
        compiler/algebra/planner.c,1.62(Current_DailyBuild-24)
        compiler/include/physical.h,1.45(Current_DailyBuild-24)
        compiler/mil/milgen.brg,1.157(Current_DailyBuild-24)
        compiler/mil/milprint.c,1.78(Current_DailyBuild-24)
implementation for id/idref...

works only for elements for now, but I wanted to commit before the branching.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U physical.c
Index: physical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/physical.c,v
retrieving revision 1.53.2.10
retrieving revision 1.53.2.11
diff -u -d -r1.53.2.10 -r1.53.2.11
--- physical.c  22 May 2008 08:48:29 -0000      1.53.2.10
+++ physical.c  24 May 2008 10:51:28 -0000      1.53.2.11
@@ -3575,22 +3575,36 @@
  * Constructor for finding nodes based on id/idref
  */
 PFpa_op_t *
-PFpa_findnodes (const PFpa_op_t *doc, const PFpa_op_t *n,
+PFpa_findnodes (const PFpa_op_t *n,
+                PFalg_att_t iter,
                 PFalg_att_t item,
                 PFalg_att_t item_doc,
                 PFalg_att_t item_res,
                 bool id)
 {
-    PFpa_op_t *ret = wire2 (pa_findnodes , doc, n);
+    PFpa_op_t *ret = wire1 (pa_findnodes, n);
 
     ret->sem.findnodes.id = id;
+    ret->sem.findnodes.iter = iter;
     ret->sem.findnodes.item = item;
     ret->sem.findnodes.item_doc = item_doc;
     ret->sem.findnodes.item_res = item_res;
 
-    ret->cost = DEFAULT_COST + doc->cost + n->cost;
+    /* allocate memory for the result schema */
+    ret->schema.count = 2;
+    ret->schema.items
+        = PFmalloc (ret->schema.count * sizeof (*ret->schema.items));
+
+    ret->schema.items[0]
+        = (PFalg_schm_item_t) { .name = iter, .type = aat_nat };
+    ret->schema.items[1]
+        = (PFalg_schm_item_t) { .name = item_res, .type = aat_pnode };
+
+    /* the result is ordered on iter|item */
+    PFord_set_add (ret->orderings, sortby (iter, item));
+
+    ret->cost = DEFAULT_COST + n->cost;
 
     return ret;
 }
-
 /* vim:set shiftwidth=4 expandtab: */

U planner.c
Index: planner.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/planner.c,v
retrieving revision 1.47.2.7
retrieving revision 1.47.2.8
diff -u -d -r1.47.2.7 -r1.47.2.8
--- planner.c   22 May 2008 08:48:31 -0000      1.47.2.7
+++ planner.c   24 May 2008 10:51:30 -0000      1.47.2.8
@@ -2221,6 +2221,79 @@
 }
 
 /**
+ * Generate plans for the findnode physical operator
+ */
+static PFplanlist_t *
+plan_id_join (PFla_op_t *n)
+{
+    /* some assertions */
+    assert (n); assert (n->kind == la_doc_index_join);
+    assert (n->sem.doc_join.kind == la_dj_id ||
+            n->sem.doc_join.kind == la_dj_idref);
+    assert (R(n)); assert (R(n)->plans);
+
+    PFalg_att_t   item_res  = n->sem.doc_join.item_res,
+                  item      = n->sem.doc_join.item,
+                  item_doc  = n->sem.doc_join.item_doc,
+                  iter,
+                  iter2;
+    PFalg_att_t   used_cols = 0;
+    unsigned int  count     = n->schema.count + 1,
+                  count_in  = 2;
+    PFalg_proj_t *proj      = PFmalloc (count * sizeof (PFalg_proj_t)),
+                 *proj_in   = PFmalloc (count_in * sizeof (PFalg_proj_t));
+    PFplanlist_t *ret       = new_planlist ();
+    PFpa_op_t    *plan,
+                 *mark;
+
+    /* create the above projection list */
+    for (unsigned int i = 0; i < n->schema.count; i++)
+        proj[i] = PFalg_proj (n->schema.items[i].name,
+                              n->schema.items[i].name);
+    /* add the result column */
+    proj[n->schema.count] = PFalg_proj (item_res, item_res);
+
+    /* get ourselves two new attribute name
+       (for creating keys using mark and joining back) */
+    for (unsigned int i = 0; i < n->schema.count; i++)
+        used_cols |= n->schema.items[i].name;
+
+    iter  = PFalg_ori_name (PFalg_unq_name (att_iter, 0), ~used_cols);
+    used_cols |= iter;
+    iter2 = PFalg_ori_name (PFalg_unq_name (att_iter, 0), ~used_cols);
+
+    /* create the inner projection list */
+    proj_in[0] = PFalg_proj (iter2, iter);
+    proj_in[1] = PFalg_proj (item_res, item_res);
+
+    /* create the translation for every input plan */
+    for (unsigned int i = 0; i < PFarray_last (R(n)->plans); i++) {
+        plan = *(plan_t **) PFarray_at (R(n)->plans, i);
+        mark = mark (plan, iter);
+
+        add_plan (ret,
+                  project (
+                      leftjoin (
+                          iter,
+                          iter2,
+                          mark,
+                          project (
+                              findnodes (mark,
+                                         iter,
+                                         item,
+                                         item_doc,
+                                         item_res,
+                                         n->sem.doc_join.kind == la_dj_id),
+                               count_in,
+                               proj_in)),
+                      count,
+                      proj));
+    }
+
+    return ret;
+}
+
+/**
  * `recursion' operator(s) in the logical algebra just get a 1:1 mapping
  * into the physical recursion operator(s).
  */
@@ -2708,19 +2781,16 @@
              * physical operator to construct                         */
             if (n->sem.doc_join.kind == la_dj_id ||
                 n->sem.doc_join.kind == la_dj_idref) {
-                /* fn:id or fn:idref */
-
+                plans = plan_id_join (n);                         break;
             } else if (n->sem.doc_join.kind == la_dj_text ||
-                n->sem.doc_join.kind == la_dj_attr) {
-                /* pf:attribute, pf:text*/
+                       n->sem.doc_join.kind == la_dj_attr) {
                 PFoops (OOPS_FATAL,
                     "physical algebra equivalent for logical algebra "
                     "node kind %u,%u not implemented, yet",
                     n->kind, n->sem.doc_join.kind);
+            } else {
+                 break;
             }
-
-        break;
-
         case la_doc_access:     plans = plan_doc_access (n);      break;
                                                                   
         case la_twig:           plans = plan_twig (n);            break;


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