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

Modified Files:
        logical.c 
Log Message:
-- Extended the debug information for the logical projection constructor.
   (This eases tracking down errors in the various optimization phases.)


U logical.c
Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- logical.c   3 Apr 2008 09:42:12 -0000       1.88
+++ logical.c   3 Apr 2008 12:34:03 -0000       1.89
@@ -946,7 +946,12 @@
  *   specifictions.
  */
 PFla_op_t *
+#ifndef NDEBUG
+PFla_project__ (const PFla_op_t *n, unsigned int count, PFalg_proj_t *proj,
+                const char *file, const char *func, const int line)
+#else
 PFla_project_ (const PFla_op_t *n, unsigned int count, PFalg_proj_t *proj)
+#endif
 {
     PFla_op_t     *ret = la_op_wire1 (la_project, n);
     unsigned int   i;
@@ -981,18 +986,60 @@
             }
 
         /* did we find the attribute? */
-        if (j >= n->schema.count)
+        if (j >= n->schema.count) {
+#ifndef NDEBUG
+            fprintf (stderr,
+                    "\nThe following error is triggered"
+                    " in line %i of function %s() in file %s\n"
+                    "The input is of kind %i and has the schema (",
+                    line, func, file, n->kind);
+            for (unsigned int k = 0; k < n->schema.count; k++)
+                fprintf (stderr, "%s%s",
+                         k ? ", " : "",
+                         PFatt_str (n->schema.items[k].name));
+            fprintf (stderr,
+                     ")\nThe projection list contains"
+                     " the following mappings (");
+            for (unsigned int k = 0; k < count; k++)
+                fprintf (stderr, "%s%s:%s",
+                         k ? ", " : "",
+                         PFatt_str (proj[k].new),
+                         PFatt_str (proj[k].old));
+            fprintf (stderr, ")\n\n");
+#endif
             PFoops (OOPS_FATAL,
                     "attribute `%s' referenced in projection not found",
                     PFatt_str (ret->sem.proj.items[i].old));
+        }
 
         /* see if we have duplicate attributes now */
         for (j = 0; j < i; j++)
-            if (ret->sem.proj.items[i].new == ret->sem.proj.items[j].new)
+            if (ret->sem.proj.items[i].new == ret->sem.proj.items[j].new) {
+#ifndef NDEBUG
+                fprintf (stderr,
+                        "\nThe following error is triggered"
+                        " in line %i of function %s() in file %s\n"
+                        "The input is of kind %i and has the schema (",
+                        line, func, file, n->kind);
+                for (unsigned int k = 0; k < n->schema.count; k++)
+                    fprintf (stderr, "%s%s",
+                             k ? ", " : "",
+                             PFatt_str (n->schema.items[k].name));
+                fprintf (stderr,
+                         ")\nThe projection list contains"
+                         " the following mappings (");
+                for (unsigned int k = 0; k < count; k++)
+                    fprintf (stderr, "%s%s:%s",
+                             k ? ", " : "",
+                             PFatt_str (proj[k].new),
+                             PFatt_str (proj[k].old));
+                fprintf (stderr, ")\n\n");
+#endif
                 PFoops (OOPS_FATAL,
                         "projection results in duplicate attribute `%s' "
                         "(attributes %i and %i)",
                         PFatt_str (ret->sem.proj.items[i].new), i+1, j+1);
+            }
     }
 
     return ret;


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