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

Modified Files:
      Tag: PF_ROX
        prop_composite_key.c prop_const.c prop_dom.c prop_dom_nat.c 
        prop_guide.c prop_icol.c prop_key.c prop_level.c prop_ocol.c 
        prop_ori_names.c prop_rec_delta.c prop_reqval.c prop_set.c 
        prop_trace_names.c prop_unq_names.c 
Log Message:
propagated changes of Wednesday Jan 30 2008 - Saturday Feb 09 2008
from the development trunk to the PF_ROX branch


Index: prop_unq_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_unq_names.c,v
retrieving revision 1.27
retrieving revision 1.27.4.1
diff -u -d -r1.27 -r1.27.4.1
--- prop_unq_names.c    11 Jan 2008 10:46:59 -0000      1.27
+++ prop_unq_names.c    9 Feb 2008 08:40:28 -0000       1.27.4.1
@@ -387,6 +387,7 @@
         case la_num_gt:
         case la_bool_and:
         case la_bool_or:
+        case la_to:
             bulk_add_name_pairs (np_list, L(n));
             new_name_pair (np_list, n->sem.binary.res, id++);
             break;
@@ -396,15 +397,6 @@
             new_name_pair (np_list, n->sem.unary.res, id++);
             break;
 
-        case la_to:
-            new_name_pair (np_list, n->sem.to.res, id++);
-            if (n->sem.to.part)
-                add_name_pair (np_list,
-                               n->sem.to.part,
-                               PFprop_unq_name (L(n)->prop,
-                                                n->sem.to.part));
-            break;
-
         case la_avg:
         case la_max:
         case la_min:
@@ -463,11 +455,8 @@
             break;
 
         case la_doc_tbl:
-            add_name_pair (np_list,
-                           n->sem.doc_tbl.iter,
-                           PFprop_unq_name (L(n)->prop,
-                                            n->sem.doc_tbl.iter));
-            new_name_pair (np_list, n->sem.doc_tbl.item_res, id++);
+            bulk_add_name_pairs (np_list, L(n));
+            new_name_pair (np_list, n->sem.doc_tbl.res, id++);
             break;
 
         case la_doc_access:

Index: prop_ocol.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_ocol.c,v
retrieving revision 1.46
retrieving revision 1.46.2.1
diff -u -d -r1.46 -r1.46.2.1
--- prop_ocol.c 20 Jan 2008 22:35:04 -0000      1.46
+++ prop_ocol.c 9 Feb 2008 08:40:27 -0000       1.46.2.1
@@ -591,28 +591,10 @@
             break;
 
         case la_to:
-            /* set number of schema items in the result schema:
-             * result attribute plus partitioning attribute
-             * (if available -- constant optimizations may
-             *  have removed it).
-             */
-            new_ocols (n, n->sem.to.part ? 2 : 1);
-
-            /* verify that attributes 'att1', 'att2' and 'part'
-             * are attributes of n* and include them into the result
-             * schema
-             */
-            assert (PFprop_ocol (L(n), n->sem.to.att1) &&
-                    PFprop_ocol (L(n), n->sem.to.att2));
-
-            ocol_at (n, 0).name = n->sem.to.res;
-            ocol_at (n, 0).type = aat_int;
-
-            if (n->sem.to.part) {
-                assert (PFprop_ocol (L(n), n->sem.to.part));
-                ocol_at (n, 1).name = n->sem.to.part;
-                ocol_at (n, 1).type = PFprop_type_of (L(n), n->sem.to.part);
-            }
+            ocols (n) = copy_ocols (ocols (L(n)), ocols_count (L(n)) + 1);
+            ocol_at (n, ocols_count (n)).name = n->sem.binary.res;
+            ocol_at (n, ocols_count (n)).type = aat_int;
+            ocols_count (n)++;
             break;
 
         case la_avg:
@@ -824,18 +806,11 @@
             ocols_count (n)++;
             break;
 
-        /* operators with static iter|item schema */
         case la_doc_tbl:
-            new_ocols (n, 2);
-
-            ocol_at (n, 0)
-                = (PFalg_schm_item_t) { .name = n->sem.doc_tbl.iter,
-                                        .type = PFprop_type_of (
-                                                    L(n),
-                                                    n->sem.doc_tbl.iter) };
-            ocol_at (n, 1)
-                = (PFalg_schm_item_t) { .name = n->sem.doc_tbl.item_res,
-                                        .type = aat_pnode };
+            ocols (n) = copy_ocols (ocols (L(n)), ocols_count (L(n)) + 1);
+            ocol_at (n, ocols_count (n)).name = n->sem.doc_tbl.res;
+            ocol_at (n, ocols_count (n)).type = aat_pnode;
+            ocols_count (n)++;
             break;
 
         case la_twig:
@@ -938,6 +913,14 @@
             break;
 
         case la_error:
+        {
+            PFalg_simple_type_t ty = PFprop_type_of (n, n->sem.err.att);
+            ocols (n) = copy_ocols (ocols (L(n)), ocols_count (L(n)));
+            for (unsigned int i = 0; i < ocols_count (n); i++)
+                if (ocol_at (n, i).name == n->sem.err.att)
+                    ocol_at (n, i).type = ty;
+        }   break;
+            
         case la_cond_err:
         case la_trace:
         case la_trace_msg:

Index: prop_const.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_const.c,v
retrieving revision 1.34
retrieving revision 1.34.4.1
diff -u -d -r1.34 -r1.34.4.1
--- prop_const.c        11 Jan 2008 10:46:59 -0000      1.34
+++ prop_const.c        9 Feb 2008 08:40:27 -0000       1.34.4.1
@@ -256,6 +256,7 @@
         case la_bool_and:
         case la_bool_or:
         case la_bool_not:
+        case la_to:
         case la_rownum:
         case la_rowrank:
         case la_rank:
@@ -266,6 +267,7 @@
         case la_step_join:
         case la_guide_step_join:
         case la_doc_index_join:
+        case la_doc_tbl:
         case la_doc_access:
         case la_docnode:
         case la_element:
@@ -506,18 +508,18 @@
             break;
 
         case la_to:
-            if (PFprop_const (L(n)->prop, n->sem.to.att1) &&
-                PFprop_const (L(n)->prop, n->sem.to.att2) &&
+            if (PFprop_const (L(n)->prop, n->sem.binary.att1) &&
+                PFprop_const (L(n)->prop, n->sem.binary.att2) &&
                 PFalg_atom_comparable (
-                    PFprop_const_val (L(n)->prop, n->sem.to.att1),
-                    PFprop_const_val (L(n)->prop, n->sem.to.att2)) &&
+                    PFprop_const_val (L(n)->prop, n->sem.binary.att1),
+                    PFprop_const_val (L(n)->prop, n->sem.binary.att2)) &&
                 !PFalg_atom_cmp (
-                    PFprop_const_val (L(n)->prop, n->sem.to.att1),
-                    PFprop_const_val (L(n)->prop, n->sem.to.att2)))
+                    PFprop_const_val (L(n)->prop, n->sem.binary.att1),
+                    PFprop_const_val (L(n)->prop, n->sem.binary.att2)))
                 PFprop_mark_const (
                     n->prop,
-                    n->sem.to.res,
-                    PFprop_const_val (L(n)->prop, n->sem.to.att1));
+                    n->sem.binary.res,
+                    PFprop_const_val (L(n)->prop, n->sem.binary.att1));
             break;
 
         case la_avg:
@@ -601,14 +603,6 @@
                         PFprop_const_val (R(n)->prop, n->sem.step.iter));
             break;
 
-        case la_doc_tbl:
-            if (PFprop_const (L(n)->prop, n->sem.doc_tbl.iter))
-                PFprop_mark_const (
-                        n->prop,
-                        n->sem.doc_tbl.iter,
-                        PFprop_const_val (L(n)->prop, n->sem.doc_tbl.iter));
-            break;
-
         case la_twig:
             switch (L(n)->kind) {
                 case la_docnode:
@@ -730,6 +724,7 @@
         case la_step_join:
         case la_guide_step_join:
         case la_doc_index_join:
+        case la_doc_tbl:
         case la_doc_access:
         case la_fcns:
         case la_docnode:

Index: prop_reqval.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_reqval.c,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -u -d -r1.35 -r1.35.2.1
--- prop_reqval.c       16 Jan 2008 14:22:59 -0000      1.35
+++ prop_reqval.c       9 Feb 2008 08:40:27 -0000       1.35.2.1
@@ -627,6 +627,7 @@
 
         case la_num_eq:
         case la_num_gt:
+        case la_to:
             rv.name = diff (rv.name, n->sem.binary.res);
             rv.val = diff (rv.val, n->sem.binary.res);
             
@@ -689,27 +690,6 @@
             cols = diff (cols, n->sem.unary.res);
             break;
 
-        case la_to:
-            rv.name = empty_list;
-            rv.val = empty_list;
-            
-            /* mark the input columns as value columns */
-            vc = union_ (union_ (empty_list, n->sem.to.att1), n->sem.to.att2);
-
-            if (n->sem.to.part) {
-                /* we only have to provide the same groups */
-                bc = union_ (bc, n->sem.to.part);
-                /* we cannot split up a partition column */
-                mc = diff (mc, n->sem.to.part);
-            }
-            
-            /* make the new column invisible for the children */
-            cols = diff (cols, n->sem.to.res);
-            /* to make up for the schema change
-               we add the input columns by hand */
-            cols = union_ (union_ (cols, n->sem.to.att1), n->sem.to.att2);
-            break;
-            
         case la_avg:
         case la_max:
         case la_min:
@@ -781,7 +761,23 @@
                         rv.val = union_ (rv.val, n->sem.type.att);
                 }
             }
-            /* fall through */
+            rv.name = diff (rv.name, n->sem.type.res);
+            rv.val = diff (rv.val, n->sem.type.res);
+            
+            if (!in (vc, n->sem.type.res) &&
+                !in (bc, n->sem.type.res) &&
+                in (oc, n->sem.type.res)) 
+                /* mark the input column as order column if
+                   not used differently */
+                oc = union_ (oc, n->sem.type.att);
+            else
+                /* mark the input column as value columns */
+                vc = union_ (vc, n->sem.type.att);
+
+            /* make the new column invisible for the children */
+            cols = diff (cols, n->sem.type.res);
+            break;
+
         case la_type:
             rv.name = diff (rv.name, n->sem.type.res);
             rv.val = diff (rv.val, n->sem.type.res);
@@ -849,17 +845,14 @@
             return; /* only infer once */
 
         case la_doc_tbl:
-            rv.name = empty_list;
-            rv.val = empty_list;
+            rv.name = diff (rv.name, n->sem.doc_tbl.res);
+            rv.val = diff (rv.val, n->sem.doc_tbl.res);
             
-            /* to make up for the schema change
-               we add the input columns by hand */
-            cols = union_ (union_ (empty_list, n->sem.doc_tbl.iter),
-                           n->sem.doc_tbl.item);
-            oc   = empty_list;
-            bc   = empty_list;
-            mc   = empty_list;
-            vc   = cols;
+            /* mark the input columns as value columns */
+            vc = union_ (vc, n->sem.doc_tbl.att);
+
+            /* make the new column invisible for the children */
+            cols = diff (cols, n->sem.doc_tbl.res);
             break;
 
         case la_doc_access:

Index: prop_set.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_set.c,v
retrieving revision 1.19
retrieving revision 1.19.4.1
diff -u -d -r1.19 -r1.19.4.1
--- prop_set.c  11 Jan 2008 10:46:59 -0000      1.19
+++ prop_set.c  9 Feb 2008 08:40:28 -0000       1.19.4.1
@@ -99,7 +99,6 @@
 
         case la_serialize_rel:
         case la_pos_select:
-        case la_to:
         case la_avg:
         case la_sum:
         case la_count:
@@ -128,6 +127,7 @@
         case la_bool_and:
         case la_bool_or:
         case la_bool_not:
+        case la_to:
         case la_rowrank:
         case la_rank:
         case la_type:
@@ -159,12 +159,12 @@
             r_set = true;
             break;
 
-        case la_error:
         case la_distinct:
         case la_max:
         case la_min:
         case la_seqty1:
         case la_all:
+        case la_error:
             l_set = true;
             break;
 
@@ -205,7 +205,7 @@
 
         case la_cond_err:
             l_set = n->prop->set;
-            r_set = false;
+            r_set = true;
             break;
 
         /* For proxies we overwrite inferred property at its

Index: prop_icol.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_icol.c,v
retrieving revision 1.30
retrieving revision 1.30.4.1
diff -u -d -r1.30 -r1.30.4.1
--- prop_icol.c 11 Jan 2008 10:46:59 -0000      1.30
+++ prop_icol.c 9 Feb 2008 08:40:27 -0000       1.30.4.1
@@ -371,6 +371,7 @@
         case la_num_gt:
         case la_bool_and:
         case la_bool_or:
+        case la_to:
             n->prop->l_icols = n->prop->icols;
 
             /* do not infer input columns if operator is not required */
@@ -393,16 +394,6 @@
             n->prop->l_icols = union_ (n->prop->l_icols, n->sem.unary.att);
             break;
 
-        case la_to:
-            /* infer att1|att2 schema for input relation */
-            n->prop->l_icols = union_ (n->sem.to.att1,
-                                       n->sem.to.att2);
-            /* only infer part if available */
-            if (n->sem.to.part != att_NULL)
-                n->prop->l_icols = union_ (n->prop->l_icols,
-                                           n->sem.to.part);
-            break;
-
         case la_avg:
         case la_max:
         case la_min:
@@ -512,9 +503,14 @@
             break;
 
         case la_doc_tbl:
-            /* infer iter|item schema for input relation */
-            n->prop->l_icols = union_ (n->sem.doc_tbl.iter,
-                                       n->sem.doc_tbl.item);
+            n->prop->l_icols = n->prop->icols;
+
+            /* do not infer input columns if operator is not required */
+            if (!(n->prop->icols & n->sem.doc_tbl.res))
+                break;
+
+            n->prop->l_icols = diff (n->prop->l_icols, n->sem.doc_tbl.res);
+            n->prop->l_icols = union_ (n->prop->l_icols, n->sem.doc_tbl.att);
             break;
 
         case la_doc_access:
@@ -685,6 +681,10 @@
             break;
 
         case la_error:
+            n->prop->l_icols = n->prop->icols;
+            n->prop->l_icols = union_ (n->prop->l_icols, n->sem.err.att);
+            break;
+            
         case la_cond_err:
             /* infer incoming icols for input relation */
             n->prop->l_icols = n->prop->icols;

Index: prop_rec_delta.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_rec_delta.c,v
retrieving revision 1.19
retrieving revision 1.19.4.1
diff -u -d -r1.19 -r1.19.4.1
--- prop_rec_delta.c    11 Jan 2008 12:49:09 -0000      1.19
+++ prop_rec_delta.c    9 Feb 2008 08:40:27 -0000       1.19.4.1
@@ -101,6 +101,7 @@
         case la_bool_and:
         case la_bool_or:
         case la_bool_not:
+        case la_to:
         case la_type:
         case la_type_assert:
         case la_doc_tbl:
@@ -235,12 +236,6 @@
             }
             break;
 
-        case la_to:
-            ITER (n) = ITER (L(n));
-            POS  (n) = POS  (L(n));
-            INNER(n) = INNER(L(n));
-            break;
-
         case la_avg:
         case la_max:
         case la_min:

Index: prop_level.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_level.c,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -u -d -r1.11 -r1.11.4.1
--- prop_level.c        11 Jan 2008 10:46:59 -0000      1.11
+++ prop_level.c        9 Feb 2008 08:40:27 -0000       1.11.4.1
@@ -161,6 +161,7 @@
         case la_bool_and:
         case la_bool_or:
         case la_bool_not:
+        case la_to:
         case la_rownum:
         case la_rowrank:
         case la_rank:
@@ -184,7 +185,6 @@
         case la_lit_tbl:
         case la_empty_tbl:
         case la_ref_tbl:
-        case la_to:
         case la_avg:
         case la_max:
         case la_min:
@@ -300,7 +300,10 @@
             break;
 
         case la_doc_tbl:
-            mark_level (n->prop, n->sem.doc_tbl.item_res, 0);
+            /* level stays the same */
+            copy_level_info (n, L(n));
+
+            mark_level (n->prop, n->sem.doc_tbl.res, 0);
             break;
     }
 }

Index: prop_dom_nat.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_dom_nat.c,v
retrieving revision 1.15
retrieving revision 1.15.4.1
diff -u -d -r1.15 -r1.15.4.1
--- prop_dom_nat.c      11 Jan 2008 10:46:59 -0000      1.15
+++ prop_dom_nat.c      9 Feb 2008 08:40:27 -0000       1.15.4.1
@@ -644,30 +644,13 @@
         case la_bool_and:
         case la_bool_or:
         case la_bool_not:
+        case la_to:
         case la_type:
         case la_cast:
         case la_type_assert:
             bulk_add_dom (n->prop, L(n));
             break;
 
-        case la_to:
-            if (n->sem.to.part) {
-                PFalg_simple_type_t join_ty = 0;
-                /* find the partition type */
-                for (unsigned int i = 0; i < n->schema.count; i++)
-                    if (n->schema.items[i].name == n->sem.to.part) {
-                        join_ty = n->schema.items[i].type;
-                        break;
-                    }
-                assert (join_ty);
-
-                if (join_ty == aat_nat)
-                    add_dom (n->prop,
-                             n->sem.to.part,
-                             PFprop_dom (L(n)->prop, n->sem.to.part));
-            }
-            break;
-
         case la_avg:
         case la_max:
         case la_min:
@@ -736,10 +719,7 @@
             break;
 
         case la_doc_tbl:
-            /* retain domain for attribute iter */
-            add_dom (n->prop,
-                     n->sem.doc_tbl.iter,
-                     PFprop_dom (L(n)->prop, n->sem.doc_tbl.iter));
+            bulk_add_dom (n->prop, L(n));
             break;
 
         case la_doc_access:
@@ -845,6 +825,14 @@
             break;
 
         case la_error:
+            /* ignore the domain of the error operator */
+            for (unsigned int i = 0; i < L(n)->schema.count; i++)
+                if (L(n)->schema.items[i].name != n->sem.err.att)
+                    add_dom (n->prop,
+                             L(n)->schema.items[i].name,
+                             PFprop_dom (L(n)->prop, 
L(n)->schema.items[i].name));
+            break;
+
         case la_cond_err:
         case la_trace:
             bulk_add_dom (n->prop, L(n));

Index: prop_trace_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_trace_names.c,v
retrieving revision 1.14
retrieving revision 1.14.4.1
diff -u -d -r1.14 -r1.14.4.1
--- prop_trace_names.c  11 Jan 2008 10:46:59 -0000      1.14
+++ prop_trace_names.c  9 Feb 2008 08:40:28 -0000       1.14.4.1
@@ -155,7 +155,6 @@
         case la_ref_tbl:
         case la_select:
         case la_pos_select:
-        case la_error:
         case la_distinct:
         case la_disjunion:
         case la_intersect:
@@ -163,6 +162,7 @@
         case la_count:
         case la_type_assert:
         case la_roots:
+        case la_error:
         case la_proxy:
         case la_proxy_base:
         case la_dummy:
@@ -254,6 +254,7 @@
         case la_num_gt:
         case la_bool_and:
         case la_bool_or:
+        case la_to:
             diff_np (np_list, n->sem.binary.res);
             break;
 
@@ -261,10 +262,6 @@
             diff_np (np_list, n->sem.unary.res);
             break;
 
-        case la_to:
-            diff_np (np_list, n->sem.to.res);
-            break;
-
         case la_avg:
         case la_max:
         case la_min:
@@ -301,7 +298,7 @@
             break;
 
         case la_doc_tbl:
-            diff_np (np_list, n->sem.doc_tbl.item_res);
+            diff_np (np_list, n->sem.doc_tbl.res);
             break;
 
         case la_doc_access:

Index: prop_key.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_key.c,v
retrieving revision 1.37
retrieving revision 1.37.4.1
diff -u -d -r1.37 -r1.37.4.1
--- prop_key.c  11 Jan 2008 10:46:59 -0000      1.37
+++ prop_key.c  9 Feb 2008 08:40:27 -0000       1.37.4.1
@@ -481,10 +481,10 @@
             break;
 
         case la_to:
-            /* if the partition is not present
-               op:to generates key values */
-            if (!n->sem.to.part)
-                union_ (n->prop->keys, n->sem.to.res);
+            /* if the cardinality is equal to one
+               the result is key itself */
+            if (PFprop_card (L(n)->prop) == 1)
+                union_ (n->prop->keys, n->sem.binary.res);
             break;
 
         case la_avg:
@@ -617,14 +617,13 @@
             break;
 
         case la_doc_tbl:
-            if (PFprop_card (n->prop) == 1) {
-                /* If the cardinality is equal to one
-                   the result is key itself. */
-                union_ (n->prop->keys, n->sem.doc_tbl.iter);
-                union_ (n->prop->keys, n->sem.doc_tbl.item_res);
-            } else
-                /* Otherwise at least column iter is key. */
-                union_ (n->prop->keys, n->sem.doc_tbl.iter);
+            /* key columns are propagated */
+            copy (n->prop->keys, L(n)->prop->keys);
+
+            /* if the cardinality is equal to one
+               the result is key itself */
+            if (PFprop_card (n->prop) == 1)
+                union_ (n->prop->keys, n->sem.doc_tbl.res);
             break;
 
         case la_doc_access:

Index: prop_guide.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_guide.c,v
retrieving revision 1.19
retrieving revision 1.19.4.1
diff -u -d -r1.19 -r1.19.4.1
--- prop_guide.c        11 Jan 2008 10:46:59 -0000      1.19
+++ prop_guide.c        9 Feb 2008 08:40:27 -0000       1.19.4.1
@@ -426,15 +426,16 @@
     assert(PROP(n));
 
     /* Test if the document name is constant */
-    if(PFprop_const_left (n->prop, n->sem.doc_tbl.item) == true) {
+    if (PFprop_const_left (n->prop, n->sem.doc_tbl.att) == true) {
         /* value of the document name */
-        PFalg_atom_t a = PFprop_const_val_left (PROP(n),
-            n->sem.doc_tbl.item);
-        if(a.type == aat_str) {
+        PFalg_atom_t a = PFprop_const_val_left (PROP(n), n->sem.doc_tbl.att);
+        if (a.type == aat_str) {
             /* Is guide filename equal to qurey filename */
-            if(strcmp(guide->tag_name,a.val.str) == 0) {
+            if (strcmp(guide->tag_name, a.val.str) == 0) {
                 /* add the guide to the guide_list */
-                MAPPING_LIST(n) = add_guide(MAPPING_LIST(n), guide, 
n->sem.doc_tbl.item);
+                MAPPING_LIST(n) = add_guide (MAPPING_LIST(n),
+                                             guide,
+                                             n->sem.doc_tbl.res);
             } else {
                 MAPPING_LIST(n) = NULL;
             }
@@ -1001,6 +1002,7 @@
         case la_bool_and:
         case la_bool_or:
         case la_bool_not:
+        case la_to:
         case la_rownum:
         case la_rowrank:
         case la_rank:
@@ -1024,7 +1026,6 @@
         case la_lit_tbl:
         case la_empty_tbl:
         case la_ref_tbl:
-        case la_to:
         case la_avg:
         case la_max:
         case la_min:

Index: prop_ori_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_ori_names.c,v
retrieving revision 1.27
retrieving revision 1.27.4.1
diff -u -d -r1.27 -r1.27.4.1
--- prop_ori_names.c    11 Jan 2008 10:46:59 -0000      1.27
+++ prop_ori_names.c    9 Feb 2008 08:40:27 -0000       1.27.4.1
@@ -379,6 +379,7 @@
         case la_num_gt:
         case la_bool_and:
         case la_bool_or:
+        case la_to:
             diff_np (n->prop->l_name_pairs, np_list, n->sem.binary.res);
             break;
 
@@ -386,26 +387,6 @@
             diff_np (n->prop->l_name_pairs, np_list, n->sem.unary.res);
             break;
 
-        case la_to:
-            unq = n->sem.to.att1;
-            ori = PFalg_ori_name (unq, FREE(n));
-            FREE(n) = diff (FREE(n), ori);
-            add_name_pair (np_list, ori, unq);
-            add_name_pair (n->prop->l_name_pairs, ori, unq);
-
-            unq = n->sem.to.att2;
-            ori = PFalg_ori_name (unq, FREE(n));
-            FREE(n) = diff (FREE(n), ori);
-            add_name_pair (np_list, ori, unq);
-            add_name_pair (n->prop->l_name_pairs, ori, unq);
-
-            if (n->sem.to.part) {
-                unq = n->sem.to.part;
-                ori = find_ori_name (np_list, unq);
-                add_name_pair (n->prop->l_name_pairs, ori, unq);
-            }
-            break;
-
         case la_avg:
         case la_max:
         case la_min:
@@ -480,17 +461,7 @@
             break;
 
         case la_doc_tbl:
-            /* input iter column */
-            unq = n->sem.doc_tbl.iter;
-            ori = find_ori_name (np_list, unq);
-            add_name_pair (n->prop->l_name_pairs, ori, unq);
-
-            /* input item column (use same name as for output) */
-            ori = find_ori_name (np_list, n->sem.doc_tbl.item_res);
-            unq = n->sem.doc_tbl.item;
-            if (!find_ori_name (np_list, unq))
-                add_name_pair (np_list, ori, unq);
-            add_name_pair (n->prop->l_name_pairs, ori, unq);
+            diff_np (n->prop->l_name_pairs, np_list, n->sem.doc_tbl.res);
             break;
 
         case la_doc_access:

Index: prop_composite_key.c
===================================================================
RCS file: 
/cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_composite_key.c,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -u -d -r1.11 -r1.11.4.1
--- prop_composite_key.c        11 Jan 2008 10:46:59 -0000      1.11
+++ prop_composite_key.c        9 Feb 2008 08:40:26 -0000       1.11.4.1
@@ -525,10 +525,17 @@
             break;
 
         case la_to:
-            if (n->sem.to.part)
-                union_ (n->prop->ckeys, n->sem.to.part | n->sem.to.res);
-            union_ (n->prop->ckeys, n->sem.to.res);
-            break;
+        {
+            PFarray_t *ckeys = L(n)->prop->ckeys;
+            PFalg_att_t ckey;
+            unsigned int i;
+
+            /* extend all keys with the result column */
+            for (i = 0; i < PFarray_last (ckeys); i++) {
+                ckey = *(PFalg_att_t *) PFarray_at (ckeys, i);
+                union_ (n->prop->ckeys, ckey | n->sem.binary.res);
+            }
+        }   break;
 
         case la_avg:
         case la_max:
@@ -652,14 +659,13 @@
         }   break;
 
         case la_doc_tbl:
-            if (PFprop_card (n->prop) == 1) {
-                /* If the cardinality is equal to one
-                   the result is key itself. */
-                union_ (n->prop->ckeys, n->sem.doc_tbl.iter);
-                union_ (n->prop->ckeys, n->sem.doc_tbl.item_res);
-            } else
-                /* Otherwise at least column iter is key. */
-                union_ (n->prop->ckeys, n->sem.doc_tbl.iter);
+            /* composite key columns are propagated */
+            copy (n->prop->ckeys, L(n)->prop->ckeys);
+
+            /* If the cardinality is equal to one
+               the result is key itself. */
+            if (PFprop_card (n->prop) == 1)
+                union_ (n->prop->ckeys, n->sem.doc_tbl.res);
             break;
 
         case la_doc_access:

Index: prop_dom.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_dom.c,v
retrieving revision 1.47
retrieving revision 1.47.4.1
diff -u -d -r1.47 -r1.47.4.1
--- prop_dom.c  11 Jan 2008 10:46:59 -0000      1.47
+++ prop_dom.c  9 Feb 2008 08:40:27 -0000       1.47.4.1
@@ -885,6 +885,7 @@
         case la_num_gt:
         case la_bool_and:
         case la_bool_or:
+        case la_to:
             bulk_add_dom (n->prop, L(n));
             add_dom (n->prop, n->sem.binary.res, id++);
             break;
@@ -894,14 +895,6 @@
             add_dom (n->prop, n->sem.unary.res, id++);
             break;
 
-        case la_to:
-            add_dom (n->prop, n->sem.to.res, id++);
-            if (n->sem.to.part)
-                add_dom (n->prop,
-                         n->sem.to.part,
-                         PFprop_dom (L(n)->prop, n->sem.to.part));
-            break;
-
         case la_avg:
         case la_sum:
         case la_count:
@@ -1012,12 +1005,8 @@
             break;
 
         case la_doc_tbl:
-            /* retain domain for attribute iter */
-            add_dom (n->prop,
-                     n->sem.doc_tbl.iter,
-                     PFprop_dom (L(n)->prop, n->sem.doc_tbl.iter));
-            /* create new domain for attribute item */
-            add_dom (n->prop, n->sem.doc_tbl.item_res, id++);
+            bulk_add_dom (n->prop, L(n));
+            add_dom (n->prop, n->sem.doc_tbl.res, id++);
             break;
 
         case la_doc_access:
@@ -1127,6 +1116,16 @@
             break;
 
         case la_error:
+            /* use a new domain for the result of the error operator */
+            for (unsigned int i = 0; i < L(n)->schema.count; i++)
+                if (L(n)->schema.items[i].name != n->sem.err.att)
+                    add_dom (n->prop,
+                             L(n)->schema.items[i].name,
+                             PFprop_dom (L(n)->prop, 
L(n)->schema.items[i].name));
+                else
+                    add_dom (n->prop, n->sem.err.att, id++);
+            break;
+
         case la_cond_err:
         case la_trace:
             bulk_add_dom (n->prop, L(n));


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