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

Modified Files:
      Tag: XQuery_0-22
        opt_algebra_cse.c 
Log Message:


Bugfix: The function checking the equivalence of literal tables was not aware
        of polymorphic types.


Index: opt_algebra_cse.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_algebra_cse.c,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -d -r1.15 -r1.15.2.1
--- opt_algebra_cse.c   1 Feb 2008 13:32:00 -0000       1.15
+++ opt_algebra_cse.c   11 Feb 2008 13:26:47 -0000      1.15.2.1
@@ -679,8 +679,7 @@
 static bool
 atom_eq (PFalg_atom_t a, PFalg_atom_t b)
 {
-    if (a.type != b.type)
-        return false;
+    assert (PFalg_atom_comparable (a,b));
 
     switch (a.type) {
         /* if type is nat, compare nat member of union */
@@ -1255,17 +1254,17 @@
           return false;
     }
 
-    PFoops (OOPS_FATAL, "this should not haben (match)");
+    PFoops (OOPS_FATAL, "this should not occur (match)");
     return false;
 }
 
 /**
- * Check if col1 of littbl1 is a subset of col2 of
- * littbl2.
+ * Checks the equivalence of two columns
+ * of different literal table operators.
  */
 static bool
-issubset (unsigned int col1, unsigned int col2,
-          PFla_op_t *littbl1, PFla_op_t *littbl2)
+column_eq (unsigned int col1, unsigned int col2,
+           PFla_op_t *littbl1, PFla_op_t *littbl2)
 {
     assert (littbl1->kind == la_lit_tbl);  
     assert (littbl2->kind == la_lit_tbl);
@@ -1281,28 +1280,14 @@
 
     /* check every item of the column */
     for (i = 0; i < littbl1->sem.lit_tbl.count; i++) {
-        if (!atom_eq (a[i].atoms[col1], b[i].atoms[col2]))
+        if (!PFalg_atom_comparable (a[i].atoms[col1], b[i].atoms[col2]) ||
+            !atom_eq (a[i].atoms[col1], b[i].atoms[col2]))
             return false;
     } 
     return true;
 }
 
 /**
- * Checks the equivalence of two columns
- * of different literal table operators.
- */
-static bool
-column_eq (unsigned int col1, unsigned int col2,
-           PFla_op_t *littbl1, PFla_op_t *littbl2)
-{
-    assert (littbl1->kind == la_lit_tbl);  
-    assert (littbl2->kind == la_lit_tbl);
-
-    return (issubset (col1, col2, littbl1, littbl2) &&
-            issubset (col2, col1, littbl2, littbl1));
-}
-
-/**
  * checks the columns of @a littbl1 and @a littbl2
  * and returns the corresponding name to the @a name
  * in littbl2
@@ -1941,15 +1926,9 @@
                                  ACTATT (R(n), n->sem.merge_adjacent.iter_in),
                                  ACTATT (R(n), n->sem.merge_adjacent.pos_in),
                                  ACTATT (R(n), n->sem.merge_adjacent.item_in), 
-                                 create_unq_name (
-                                     CSE(R(n))->schema,
-                                     n->sem.merge_adjacent.iter_res),
-                                 create_unq_name (
-                                     CSE(R(n))->schema,
-                                     n->sem.merge_adjacent.pos_res),
-                                 create_unq_name (
-                                     CSE(R(n))->schema,
-                                     n->sem.merge_adjacent.item_res));
+                                 ACTATT (R(n), n->sem.merge_adjacent.iter_in),
+                                 ACTATT (R(n), n->sem.merge_adjacent.pos_in),
+                                 ACTATT (R(n), n->sem.merge_adjacent.item_in));
             break; 
 
         case la_roots:
@@ -1993,7 +1972,7 @@
                                    ACTATT (R(n), n->sem.trace_map.inner),
                                    ACTATT (R(n), n->sem.trace_map.outer));
 
-        case la_string_join:
+        case la_string_join: {
             return PFla_fn_string_join (
                        CSE(L(n)), CSE(R(n)),
                        ACTATT (L(n), n->sem.string_join.iter),
@@ -2001,11 +1980,14 @@
                        ACTATT (L(n), n->sem.string_join.item),
                        ACTATT (R(n), n->sem.string_join.iter_sep),
                        ACTATT (R(n), n->sem.string_join.item_sep),
-                       create_unq_name (CSE(R(n))->schema,
+                       ACTATT (L(n), n->sem.string_join.iter),
+                       ACTATT (L(n), n->sem.string_join.item));
+
+/*                       create_unq_name (CSE(R(n))->schema,
                                         n->sem.string_join.iter_res),
                        create_unq_name (CSE(R(n))->schema,
-                                        n->sem.string_join.item_res));
-
+                                        n->sem.string_join.item_res)); */
+        }
         case la_dummy:
             PFoops (OOPS_FATAL,
                     "dummy operators are not allowed");
@@ -2144,9 +2126,8 @@
         case la_disjunion:
         case la_intersect:
         case la_difference:
-        {
             actmap = actatt_map_copy (ACT(L(ori)));
-        }   break; 
+            break; 
 
         case la_distinct:
             actmap = actatt_map_copy (ACT(L(ori)));


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