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

Modified Files:
      Tag: M5XQ
        opt_projection.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_projection.c,1.16
-- 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_projection.c
Index: opt_projection.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_projection.c,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -d -r1.9.2.2 -r1.9.2.3
--- opt_projection.c    12 May 2009 13:35:03 -0000      1.9.2.2
+++ opt_projection.c    15 Jun 2009 12:45:21 -0000      1.9.2.3
@@ -605,6 +605,48 @@
                                        PFalg_proj (p->sem.unary.res, res)));
             }   break;
 
+            case la_aggr:
+                /* integrate all column renaming in the aggregate inputs */
+                for (unsigned int i = 0; i < p->sem.aggr.count; i++)
+                    if (p->sem.aggr.aggr[i].col)
+                        for (unsigned int j = 0; j < L(p)->sem.proj.count; j++)
+                            if (p->sem.aggr.aggr[i].col ==
+                                L(p)->sem.proj.items[j].new) {
+                                p->sem.aggr.aggr[i].col = 
+                                    L(p)->sem.proj.items[j].old;
+                                break;
+                            }
+                /* If partition column is renamed add a renaming projection
+                   on top of it that adjusts the partition column. */
+                if (p->sem.aggr.part) {
+                    PFalg_col_t old_part = col_NULL;
+                    for (unsigned int i = 0; i < L(p)->sem.proj.count; i++)
+                        if (p->sem.aggr.part == L(p)->sem.proj.items[i].new) {
+                            old_part = L(p)->sem.proj.items[i].old;
+                            break;
+                        }
+                    if (p->sem.aggr.part != old_part) {
+                        PFalg_proj_t *proj = PFmalloc (p->schema.count *
+                                                       sizeof (PFalg_proj_t));
+                        for (unsigned int i = 0; i < p->sem.aggr.count; i++)
+                            proj[i] = PFalg_proj (p->sem.aggr.aggr[i].res,
+                                                  p->sem.aggr.aggr[i].res);
+                        proj[p->sem.aggr.count] = PFalg_proj (p->sem.aggr.part,
+                                                              old_part);
+
+                        *p = *PFla_project_ (aggr (LL(p),
+                                                   old_part,
+                                                   p->sem.aggr.count,
+                                                   p->sem.aggr.aggr),
+                                             p->schema.count,
+                                             proj);
+                        break;
+                    }
+                }
+                /* remove the projection */
+                L(p) = LL(p);
+                break;
+
             case la_rownum:
             case la_rowrank:
             case la_rank:


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