Update of /cvsroot/monetdb/pathfinder/compiler/algebra/opt
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3988/compiler/algebra/opt
Modified Files:
Tag: M5XQ
opt_general.brg
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_general.brg,1.68
-- 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_general.brg
Index: opt_general.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_general.brg,v
retrieving revision 1.66.2.1
retrieving revision 1.66.2.2
diff -u -d -r1.66.2.1 -r1.66.2.2
--- opt_general.brg 7 May 2009 14:43:07 -0000 1.66.2.1
+++ opt_general.brg 15 Jun 2009 12:44:55 -0000 1.66.2.2
@@ -109,11 +109,7 @@
%term bool_or = 29
%term bool_not = 30
%term to = 31
-%term avg = 32
-%term max_ = 33
-%term min_ = 34
-%term sum = 35
-%term count = 36
+%term aggr = 32
%term rownum = 37
%term rowrank = 38
%term rank = 39
@@ -121,8 +117,6 @@
%term type = 41
%term type_assert = 42
%term cast = 43
-%term seqty1 = 44
-%term all = 45
%term step = 50
%term step_join = 51
%term guide_step = 52
@@ -159,7 +153,6 @@
%term fun_param = 91
%term fun_frag_param = 92
%term string_join = 102
-%term prod = 110
%term dummy = 120
%%
@@ -203,11 +196,7 @@
Rel: bool_or (Rel) = 38 (10);
Rel: bool_not (Rel) = 39 (10);
Rel: to (Rel) = 40 (10);
-Rel: avg (Rel) = 41 (10);
-Rel: max_ (Rel) = 42 (10);
-Rel: min_ (Rel) = 43 (10);
-Rel: sum (Rel) = 44 (10);
-Rel: count (Rel) = 45 (10);
+Rel: aggr (Rel) = 45 (10);
Rel: rownum (Rel) = 47 (10);
Rel: rownum (lit_tbl) = 48 (10);
Rel: rowrank (Rel) = 49 (10);
@@ -221,8 +210,6 @@
Rel: cast (project (cast (Rel))) = 57 (10);
Rel: cast (lit_tbl) = 58 (10);
Rel: cast (Rel) = 59 (10);
-Rel: seqty1 (Rel) = 60 (10);
-Rel: all (Rel) = 61 (10);
Rel: ScjRel = 62 (10);
ScjRel: step (Frag, Rel) = 63 (10);
ScjRel: step (Frag, ScjRel) = 64 (10);
@@ -313,11 +300,7 @@
EmptyRel: bool_or (EmptyRel) = 148 (0);
EmptyRel: bool_not (EmptyRel) = 149 (0);
EmptyRel: to (EmptyRel) = 150 (0);
-EmptyRel: avg (EmptyRel) = 151 (0);
-EmptyRel: max_ (EmptyRel) = 152 (0);
-EmptyRel: min_ (EmptyRel) = 153 (0);
-EmptyRel: sum (EmptyRel) = 154 (0);
-EmptyRel: count (EmptyRel) = 155 (0);
+EmptyRel: aggr (EmptyRel) = 155 (0);
EmptyRel: rownum (EmptyRel) = 158 (0);
EmptyRel: rowrank (EmptyRel) = 159 (0);
EmptyRel: rank (EmptyRel) = 160 (0);
@@ -325,8 +308,6 @@
EmptyRel: type (EmptyRel) = 162 (0);
EmptyRel: type_assert (EmptyRel) = 163 (0);
EmptyRel: cast (EmptyRel) = 164 (0);
-EmptyRel: seqty1 (EmptyRel) = 165 (0);
-EmptyRel: all (EmptyRel) = 166 (0);
EmptyRel: step (Frag, EmptyRel) = 170 (0);
EmptyRel: step_join (Frag, EmptyRel) = 171 (0);
EmptyRel: guide_step (Frag, EmptyRel) = 172 (0);
@@ -366,9 +347,6 @@
Rec),
Rel) = 197 (0);
-Rel: prod (Rel) = 198 (10);
-EmptyRel: prod (EmptyRel) = 199 (0);
-
%%
#include "algebra_mnemonic.h"
@@ -1060,6 +1038,33 @@
}
break;
+ /* Rel: aggr (Rel) */
+ case 45:
+ {
+ unsigned int i = 0;
+ for (i = 0; i < p->sem.aggr.count; i++)
+ if (p->sem.aggr.aggr[i].kind != alg_aggr_dist)
+ break;
+
+ /* Turn an aggregate into a simple distinct operator
+ if all aggregates are 'distinct' operations. */
+ if (p->sem.aggr.part &&
+ i == p->sem.aggr.count) {
+ PFalg_proj_t *proj;
+ proj = PFmalloc (p->schema.count * sizeof (PFalg_proj_t));
+ for (i = 0; i < p->sem.aggr.count; i++)
+ 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_distinct (
+ PFla_project_ (L(p), p->schema.count, proj));
+ SEEN(p) = false;
+ relabel (p, kids);
+ break;
+ }
+ } break;
+
/* Rel: rownum (Rel) */
case 47:
{
------------------------------------------------------------------------------
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