Update of /cvsroot/monetdb/pathfinder/compiler/algebra/opt
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4075/compiler/algebra/opt
Modified Files:
Tag: M5XQ
opt_key.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/opt/opt_key.c,1.24
-- 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 opt_key.c
Index: opt_key.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_key.c,v
retrieving revision 1.22.2.1
retrieving revision 1.22.2.2
diff -u -d -r1.22.2.1 -r1.22.2.2
--- opt_key.c 7 May 2009 14:43:29 -0000 1.22.2.1
+++ opt_key.c 15 Jun 2009 12:45:11 -0000 1.22.2.2
@@ -78,37 +78,31 @@
}
break;
- case la_avg:
- case la_max:
- case la_min:
- case la_sum:
- case la_prod:
- case la_seqty1:
- case la_all:
+ case la_aggr:
/* if part is key we already have our aggregate */
if (p->sem.aggr.part &&
PFprop_key_left (p->prop, p->sem.aggr.part)) {
- *p = *PFla_project (
- L(p),
- PFalg_proj (p->sem.aggr.res,
- p->sem.aggr.col),
- PFalg_proj (p->sem.aggr.part,
- p->sem.aggr.part));
- SEEN(p) = true;
- }
- break;
+ PFalg_col_t count_col = PFcol_new (col_item);
+ unsigned int i = 0;
+ PFalg_proj_t *proj = PFmalloc (p->schema.count *
+ sizeof (PFalg_proj_t));
- case la_count:
- /* if part is key we already have our aggregate */
- if (p->sem.aggr.part &&
- PFprop_key_left (p->prop, p->sem.aggr.part)) {
- *p = *PFla_attach (
- PFla_project (
- L(p),
- PFalg_proj (p->sem.aggr.part,
- p->sem.aggr.part)),
- p->sem.aggr.res,
- PFalg_lit_int (1));
+ /* Replace aggregates by projection list. (Count aggregates
+ refer to a new column that contains the value 1.) */
+ for (i = 0; i < p->sem.aggr.count; i++)
+ if (p->sem.aggr.aggr[i].kind == alg_aggr_count)
+ proj[i] = PFalg_proj (p->sem.aggr.aggr[i].res,
+ count_col);
+ else
+ proj[i] = PFalg_proj (p->sem.aggr.aggr[i].res,
+ p->sem.aggr.aggr[i].col);
+
+ proj[i] = PFalg_proj (p->sem.aggr.part, p->sem.aggr.part);
+
+ *p = *PFla_project_ (
+ PFla_attach (L(p), count_col, PFalg_lit_int (1)),
+ p->schema.count,
+ proj);
SEEN(p) = true;
}
break;
------------------------------------------------------------------------------
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