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

Modified Files:
      Tag: PF_ROX
        load_stats.c logical.c physical.c planner.c 
Log Message:
propagated changes of Tuesday Mar 25 2008 - Thursday Mar 27 2008
from the development trunk to the PF_ROX branch

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/25 - tsheyar: compiler/algebra/opt/opt_general.brg,1.49
-- More consistency checks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/26 - tsheyar: compiler/algebra/planner.c,1.56
-- align physical planning for attribute steps
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/26 - tsheyar: compiler/algebra/opt/opt_algebra_cse.c,1.29
-- Fixed indexing bug (i -> j).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/26 - tsheyar: compiler/algebra/opt/opt_general.brg,1.50
-- Fixed bug in brg-based optimization.
   (Added missing state-label assignments for new logical operators.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/26 - tsheyar: compiler/algebra/prop/prop_key.c,1.43
-- Use the correct boolean test to check for guide nodes.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/26 - tsheyar: compiler/algebra/logical.c,1.87
        compiler/algebra/physical.c,1.63 compiler/algebra/prop/prop_ocol.c,1.54
-- Prepare {ancestor-or-|descendant-or-|}self steps in the algebra
   for attribute context nodes.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/26 - tsheyar: compiler/algebra/load_stats.c,1.14
        compiler/algebra/prop/prop_guide.c,1.26
        compiler/include/load_stats.h,1.6
-- Extended guide loading to cope with QNames (instead of strings).

-- Cleaned up and simplified guide property inference.

-- Extended guide property inference. (QName support; Steps evaluated
   on the guide without result nodes now get an empty guide mapping
   ---instead of no mapping.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/26 - tsheyar: compiler/algebra/opt/opt_general.brg,1.51
-- Fix last check-in.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/27 - tsheyar: compiler/algebra/prop/prop_key.c,1.44
-- Fixed wrong property inference (-- we cannot get a key out of nowhere).

-- Extended property inference for positional selections to compensate the
   ``restriction'' for the above fix.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U physical.c
Index: physical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/physical.c,v
retrieving revision 1.53.2.5
retrieving revision 1.53.2.6
diff -u -d -r1.53.2.5 -r1.53.2.6
--- physical.c  6 Mar 2008 16:35:55 -0000       1.53.2.5
+++ physical.c  27 Mar 2008 11:20:08 -0000      1.53.2.6
@@ -2486,6 +2486,14 @@
     if (spec.axis == alg_attr)
         ret->schema.items[1]
             = (PFalg_schm_item_t) { .name = item, .type = aat_anode };
+    else if (spec.axis == alg_anc_s)
+        ret->schema.items[1]
+            = (PFalg_schm_item_t) { .name = item,
+                                    .type = type_of (ctx, item) | aat_pnode };
+    else if (spec.axis == alg_desc_s || spec.axis == alg_self)
+        ret->schema.items[1]
+            = (PFalg_schm_item_t) { .name = item,
+                                    .type = type_of (ctx, item) };
     else
         ret->schema.items[1]
             = (PFalg_schm_item_t) { .name = item, .type = aat_pnode };

U planner.c
Index: planner.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/planner.c,v
retrieving revision 1.47.2.4
retrieving revision 1.47.2.5
diff -u -d -r1.47.2.4 -r1.47.2.5
--- planner.c   21 Mar 2008 13:30:59 -0000      1.47.2.4
+++ planner.c   27 Mar 2008 11:20:15 -0000      1.47.2.5
@@ -1492,28 +1492,16 @@
         /* generate plans for each input and each output ordering */
 
         for (unsigned int k = 0; k < PFarray_last (ordered); k++)
-            /* the evaluation of the attribute axis keeps the input order */
-            if (n->sem.step.spec.axis == alg_attr)
+            for (unsigned short o = 0; o < 2; o++)
                 add_plan (
                     ret,
                     llscjoin (
                         *(plan_t **) PFarray_at (ordered, k),
                         n->sem.step.spec,
                         in[i],
-                        out[i],
+                        out[o],
                         n->sem.step.iter,
                         n->sem.step.item));
-            else
-                for (unsigned short o = 0; o < 2; o++)
-                    add_plan (
-                        ret,
-                        llscjoin (
-                            *(plan_t **) PFarray_at (ordered, k),
-                            n->sem.step.spec,
-                            in[i],
-                            out[o],
-                            n->sem.step.iter,
-                            n->sem.step.item));
     }
 
     return ret;

U logical.c
Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.78.2.4
retrieving revision 1.78.2.5
diff -u -d -r1.78.2.4 -r1.78.2.5
--- logical.c   21 Mar 2008 13:30:57 -0000      1.78.2.4
+++ logical.c   27 Mar 2008 11:20:02 -0000      1.78.2.5
@@ -95,6 +95,7 @@
     for (i = 0; i < PFLA_OP_MAXCHILD; i++)
         ret->child[i] = NULL;
 
+    ret->state_label   = 0;
     ret->plans         = NULL;
     ret->sql_ann       = NULL;
     ret->prop          = PFprop ();
@@ -2589,6 +2590,16 @@
         ret->schema.items[1]
             = (struct PFalg_schm_item_t) { .name = item_res,
                                            .type = aat_anode };
+    else if (ret->sem.step.spec.axis == alg_anc_s)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item)
+                                                   | aat_pnode };
+    else if (ret->sem.step.spec.axis == alg_desc_s ||
+             ret->sem.step.spec.axis == alg_self)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item) };
     else
         ret->schema.items[1]
             = (struct PFalg_schm_item_t) { .name = item_res,
@@ -2668,6 +2679,16 @@
         ret->schema.items[i]
             = (struct PFalg_schm_item_t) { .name = item_res,
                                            .type = aat_anode };
+    else if (ret->sem.step.spec.axis == alg_anc_s)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item)
+                                                   | aat_pnode };
+    else if (ret->sem.step.spec.axis == alg_desc_s ||
+             ret->sem.step.spec.axis == alg_self)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item) };
     else
         ret->schema.items[i]
             = (struct PFalg_schm_item_t) { .name = item_res,
@@ -2755,6 +2776,16 @@
         ret->schema.items[1]
             = (struct PFalg_schm_item_t) { .name = item_res,
                                            .type = aat_anode };
+    else if (ret->sem.step.spec.axis == alg_anc_s)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item)
+                                                   | aat_pnode };
+    else if (ret->sem.step.spec.axis == alg_desc_s ||
+             ret->sem.step.spec.axis == alg_self)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item) };
     else
         ret->schema.items[1]
             = (struct PFalg_schm_item_t) { .name = item_res,
@@ -2845,6 +2876,16 @@
         ret->schema.items[i]
             = (struct PFalg_schm_item_t) { .name = item_res,
                                            .type = aat_anode };
+    else if (ret->sem.step.spec.axis == alg_anc_s)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item)
+                                                   | aat_pnode };
+    else if (ret->sem.step.spec.axis == alg_desc_s ||
+             ret->sem.step.spec.axis == alg_self)
+        ret->schema.items[1]
+            = (struct PFalg_schm_item_t) { .name = item_res,
+                                           .type = PFprop_type_of (n, item) };
     else
         ret->schema.items[i]
             = (struct PFalg_schm_item_t) { .name = item_res,

U load_stats.c
Index: load_stats.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/load_stats.c,v
retrieving revision 1.12.4.1
retrieving revision 1.12.4.2
diff -u -d -r1.12.4.1 -r1.12.4.2
--- load_stats.c        21 Mar 2008 13:30:56 -0000      1.12.4.1
+++ load_stats.c        27 Mar 2008 11:19:58 -0000      1.12.4.2
@@ -80,6 +80,7 @@
                                        of the same nodes */
     unsigned int   kind_int = 0;    /* read kind as integer */
     PFguide_kind_t kind     = text; /* kind if the guide node */
+    char          *tag_uri  = NULL; /* tag uri of the guide node */
     char          *tag_name = NULL; /* tag name of the guide node */
     char          *attribute_name; 
 
@@ -117,6 +118,9 @@
                 }
             }
     
+            if (strcmp (attribute_name, "uri") == 0)
+                tag_uri = (char*) atts[1];
+    
             if (strcmp (attribute_name, "name") == 0)
                 tag_name = (char*) atts[1];
     
@@ -124,9 +128,13 @@
         }
     }
     
+    /* consistency checks */
     switch (kind) {
         case elem:
         case attr:
+            if (!tag_uri)
+                 PFoops (OOPS_FATAL, "Guide optimization - "
+                        "uri of a guide is NULL when it is required\n");
         case doc:
         case pi:
             if (!tag_name)
@@ -146,18 +154,31 @@
         .max   = max,
         .level = level,
         .kind  = kind,
-        .tag_name = tag_name != NULL ? 
-            (char*)PFmalloc(sizeof(char)*(strlen(tag_name)+1)) : 
-            NULL,
+        .name  = PFqname (PFns_wild, NULL),
         .parent = current_guide_node,
         .child_list = NULL,
     };
 
-    /* copy the string, otherwise it will be lost */
-    if (new_guide_node->tag_name != NULL)
-        new_guide_node->tag_name = strncpy(new_guide_node->tag_name,
-                                           tag_name,
-                                           strlen(tag_name));
+    /* copy the strings, otherwise they will be lost */
+    if (tag_name != NULL) {
+        PFns_t ns;
+        char *name_copy;
+        name_copy = (char *) PFmalloc (sizeof (char) * (strlen (tag_name) + 
1));
+        name_copy = strncpy (name_copy, tag_name, strlen (tag_name));
+
+        if (tag_uri) {
+            ns.prefix = "";
+            char *uri_copy;
+            uri_copy = (char *) PFmalloc (sizeof (char) *
+                                          (strlen (tag_uri) + 1));
+            uri_copy = strncpy (uri_copy, tag_uri, strlen (tag_uri));
+            ns.uri = uri_copy;
+        }
+        else
+            ns = PFns_wild;
+    
+        new_guide_node->name = PFqname (ns, name_copy);
+    }
 
     /* create association between parent and child */
     if (current_guide_node) {
@@ -253,6 +274,7 @@
                 "<!ATTLIST node min CDATA #REQUIRED>"
                 "<!ATTLIST node max CDATA #REQUIRED>"
                 "<!ATTLIST node kind (1|2|3|4|5|6) #REQUIRED>"
+                "<!ATTLIST node uri CDATA #IMPLIED>"
                 "<!ATTLIST node name CDATA #IMPLIED>";
 
     /* Context pointer */


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