Update of /cvsroot/monetdb/pathfinder/compiler/algebra/prop
In directory 
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28654/compiler/algebra/prop

Modified Files:
      Tag: M5XQ
        prop_key.c 
Log Message:
propagated changes of Thursday May 14 2009 - Saturday May 16 2009
from the development trunk to the M5XQ branch

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/05/14 - tsheyar: compiler/algebra/prop/prop_key.c,1.64
-- Provide a key property inference that builds on functional dependencies
   (detecting more superfluous distinct operators).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U prop_key.c
Index: prop_key.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_key.c,v
retrieving revision 1.60.2.3
retrieving revision 1.60.2.4
diff -u -d -r1.60.2.3 -r1.60.2.4
--- prop_key.c  13 May 2009 16:09:09 -0000      1.60.2.3
+++ prop_key.c  16 May 2009 08:23:50 -0000      1.60.2.4
@@ -221,7 +221,7 @@
  * Infer key property of a given node @a n; worker for prop_infer().
  */
 static void
-infer_key (PFla_op_t *n, bool with_guide_info)
+infer_key (PFla_op_t *n, bool with_guide_info, bool with_fd_info)
 {
     /* copy key properties of children into current node */
     if (L(n)) copy (n->prop->l_keys, L(n)->prop->keys);
@@ -493,12 +493,13 @@
                 /* if distinct works on a single column,
                    this column is key afterwards. */
                 union_ (n->prop->keys, n->schema.items[0].name);
-            else {
+            else
                 /* key columns stay the same */
                 copy (n->prop->keys, L(n)->prop->keys);
-#if 0
-                /* this property inference is disabled
-                   as long as the scenario is not active */
+
+            if (with_fd_info)
+                /* check if all columns can be described by a single
+                   column */
                 for (unsigned int i = 0; i < n->schema.count; i++) {
                     bool match = true;
                     for (unsigned int j = 0; j < n->schema.count; j++)
@@ -510,8 +511,6 @@
                     if (match)
                         union_ (n->prop->keys, n->schema.items[i].name);
                 }
-#endif
-            }
             break;
 
         case la_fun_1to1:
@@ -808,7 +807,7 @@
 
 /* worker for PFprop_infer_key */
 static void
-prop_infer (PFla_op_t *n, bool with_guide_info)
+prop_infer (PFla_op_t *n, bool with_guide_info, bool with_fd_info)
 {
     assert (n);
 
@@ -818,7 +817,7 @@
 
     /* infer properties for children */
     for (unsigned int i = 0; i < PFLA_OP_MAXCHILD && n->child[i]; i++)
-        prop_infer (n->child[i], with_guide_info);
+        prop_infer (n->child[i], with_guide_info, with_fd_info);
 
     n->bit_dag = true;
 
@@ -845,14 +844,14 @@
     }
 
     /* infer information on key columns */
-    infer_key (n, with_guide_info);
+    infer_key (n, with_guide_info, with_fd_info);
 }
 
 /**
- * Infer key property for a DAG rooted in root
+ * Worker for key property inference.
  */
-void
-PFprop_infer_key (PFla_op_t *root)
+static void
+prop_infer_key (PFla_op_t *root, bool guides, bool fds)
 {
     /* infer cardinalities to discover more key columns */
     PFprop_infer_card (root);
@@ -861,7 +860,7 @@
     PFprop_infer_nat_dom (root);
     PFprop_infer_level (root);
 
-    prop_infer (root, false);
+    prop_infer (root, guides, fds);
     PFla_dag_reset (root);
 }
 
@@ -869,17 +868,28 @@
  * Infer key property for a DAG rooted in root
  */
 void
+PFprop_infer_key (PFla_op_t *root)
+{
+    prop_infer_key (root, false, false);
+}
+
+/**
+ * Infer the key properties assuming that guides have been already inferred.
+ */
+void
 PFprop_infer_key_with_guide (PFla_op_t *root)
 {
-    /* infer cardinalities to discover more key columns */
-    PFprop_infer_card (root);
-    /* use the cheaper domain inference that only infers
-       domains for columns of the native type */
-    PFprop_infer_nat_dom (root);
-    PFprop_infer_level (root);
+    prop_infer_key (root, true, false);
+}
 
-    prop_infer (root, true);
-    PFla_dag_reset (root);
+/**
+ * Infer key and functional dependency properties for a DAG rooted in root.
+ */
+void
+PFprop_infer_key_and_fd (PFla_op_t *root)
+{
+    PFprop_infer_functional_dependencies (root);
+    prop_infer_key (root, false, true);
 }
 
 /* vim:set shiftwidth=4 expandtab: */


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to