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

Modified Files:
      Tag: XQuery_0-24
        algopt.c properties.c 
Log Message:
-- circumvent bugs #1981491 and #1908822 for the release.

   This 'hack' does not fix the real problem (that we have to get rid
   of bit-encoded column names), but just disables some optimizations
   in case we might get into trouble. Thus we can apply less rewrites
   and get 'suboptimal' plans.

   THIS IS A RELEASE ONLY CHECKIN --- PLEASE DO NOT PROPAGATE!


U algopt.c
Index: algopt.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algopt.c,v
retrieving revision 1.35.2.1
retrieving revision 1.35.2.2
diff -u -d -r1.35.2.1 -r1.35.2.2
--- algopt.c    28 May 2008 11:37:18 -0000      1.35.2.1
+++ algopt.c    2 Jun 2008 08:44:29 -0000       1.35.2.2
@@ -56,6 +56,19 @@
                                                                             \
             root = PFmap_ori_names (root);                                  \
                                                                             \
+            /* in case we could not map back the plan                       \
+               we take the one before mapping to unique names */            \
+            if (!root) {                                                    \
+                assert (last_ori_col_plan);                                 \
+                root = last_ori_col_plan;                                   \
+                /* generate warning that some phases have been ignored */   \
+                *opt_args = '\0';                                           \
+                PFinfo (OOPS_WARNING,                                       \
+                        "could not make use of "                            \
+                        "the following optimizations: %s]",                 \
+                        first_unq_arg);                                     \
+            }                                                               \
+                                                                            \
             tm = PFtimer_stop (tm);                                         \
                                                                             \
             if (timing)                                                     \
@@ -97,6 +110,17 @@
     bool unq_names = false;
     bool proxies_involved = false;
 
+    /* Here we add a fallback solution for query plans where we cannot
+       map back from unique names to bit encoded (ori) names. While
+       we still use some bit-encoded column names in the code this
+       work-around will avoid failing queries --- their performance
+       however might be 'suboptimal'. */
+    PFla_op_t *last_ori_col_plan = NULL;
+    char      *first_unq_arg     = NULL;
+    /* get a local copy of the optimization arguments to
+       safely apply side-effects (changing the string) */
+    opt_args = PFstrdup (opt_args);
+
     if (PFalg_is_unq_name(root->schema.items[0].name))
     {
         root = PFmap_ori_names (root);
@@ -389,6 +413,11 @@
 
                 tm = PFtimer_start ();
 
+                /* save the original plan in case
+                   we are not able to map back */
+                last_ori_col_plan = root;
+                first_unq_arg     = opt_args;
+
                 root = PFmap_unq_names (root);
 
                 tm = PFtimer_stop (tm);
@@ -411,6 +440,19 @@
 
                 root = PFmap_ori_names (root);
 
+                /* in case we could not map back the plan
+                   we take the one before mapping to unique names */
+                if (!root) {
+                    assert (last_ori_col_plan);
+                    root = last_ori_col_plan;
+                    /* generate warning that some phases have been ignored */
+                    *opt_args = '\0';
+                    PFinfo (OOPS_WARNING,
+                            "could not make use of "
+                            "the following optimizations: %s]",
+                            first_unq_arg);
+                }
+
                 tm = PFtimer_stop (tm);
                 if (timing)
                     PFlog ("   map to original attribute names: %s",
@@ -458,6 +500,7 @@
                 break;
         }
         opt_args++;
+        assert (root);
     }
     if (debug_opt)
         fputc ('\n', stderr);

U properties.c
Index: properties.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/properties.c,v
retrieving revision 1.38
retrieving revision 1.38.2.1
diff -u -d -r1.38 -r1.38.2.1
--- properties.c        8 May 2008 20:13:21 -0000       1.38
+++ properties.c        2 Jun 2008 08:44:29 -0000       1.38.2.1
@@ -161,7 +161,7 @@
     if (ocols)
         PFprop_infer_ocol (root);
     if (ori_names)
-        PFprop_infer_ori_names (root);
+        (void) PFprop_infer_ori_names (root);
     if (refctr)
         PFprop_infer_refctr (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