Update of /cvsroot/monetdb/pathfinder/compiler/algebra/prop
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4294/compiler/algebra/prop
Modified Files:
Tag: M5XQ
prop_guide.c
Log Message:
propagated changes of Friday Jun 12 2009 - Monday Jun 15 2009
from the development trunk to the M5XQ branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/06/12 - tsheyar: compiler/algebra/prop/prop_guide.c,1.35
-- Replaced aggregate operators count, min, max, avg, sum, prod, seqty1,
and all in the algebra by a single aggregate operator ``aggr''
that can handle multiple aggregates. The aggregate entries
are of kind count, min, max, avg, sum, prod, seqty1, all, and dist.
-- Added new aggregate kind ``dist'' that allows to represent group by
columns that functionally depend on the partitioning criterion
in the result of the grouping aggregate.
-- Added rewrite that merges aggregates.
-- Added rewrite that removes superfluous aggregates.
-- Added rewrite that pushes a rank operator through an aggregate.
-- Extended the XML import to cope with the old
as well as the new representation of aggregates.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
U prop_guide.c
Index: prop_guide.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_guide.c,v
retrieving revision 1.33.2.1
retrieving revision 1.33.2.2
diff -u -d -r1.33.2.1 -r1.33.2.2
--- prop_guide.c 7 May 2009 14:44:31 -0000 1.33.2.1
+++ prop_guide.c 15 Jun 2009 12:46:01 -0000 1.33.2.2
@@ -415,6 +415,59 @@
}
/**
+ * @brief Copy the guide mappings with respect
+ * to the aggregate operator semantics.
+ */
+static void
+copy_aggregate (PFla_op_t *n)
+{
+ PFguide_mapping_t *mapping = NULL;
+ PFarray_t *map_list = MAPPING_LIST(L(n)),
+ *new_map_list = PFarray (sizeof (PFguide_mapping_t *),
+ n->sem.proj.count);
+ PFalg_col_t new,
+ old;
+
+ if (map_list == NULL) {
+ MAPPING_LIST(n) = NULL;
+ return;
+ }
+
+ /* iterate over all columns */
+ for (unsigned int i = 0; i < n->sem.aggr.count; i++) {
+ /* only collect the guides for distinct aggregates */
+ if (n->sem.aggr.aggr[i].kind != alg_aggr_dist)
+ continue;
+
+ /* get new and old column name */
+ new = n->sem.aggr.aggr[i].res;
+ old = n->sem.aggr.aggr[i].col;
+
+ /* get guide mapping from list */
+ mapping = get_guide_mapping (map_list, old);
+
+ if (mapping == NULL)
+ continue;
+
+ /* create a copy */
+ mapping = copy_guide_mapping (mapping);
+
+ /* set new column name */
+ mapping->column = new;
+
+ /* assign guide mapping to the list */
+ GUIDE_MAP_ADD(new_map_list) = mapping;
+ }
+
+ /* only keep the guide mapping list
+ if we have a mapping */
+ if (PFarray_last (new_map_list))
+ MAPPING_LIST(n) = new_map_list;
+ else
+ MAPPING_LIST(n) = NULL;
+}
+
+/**
* @brief Apply kind and name test for path steps.
*
* @param return_attr ensures that attribute nodes are allowed/discarded,
@@ -773,14 +826,6 @@
case la_lit_tbl:
case la_empty_tbl:
case la_ref_tbl:
- case la_avg:
- case la_max:
- case la_min:
- case la_sum:
- case la_prod:
- case la_count:
- case la_seqty1:
- case la_all:
case la_twig:
case la_fcns:
case la_element:
@@ -845,6 +890,10 @@
copy_intersect (n);
break;
+ case la_aggr:
+ copy_aggregate (n);
+ break;
+
/* step */
case la_step:
copy_step (n);
------------------------------------------------------------------------------
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