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

Modified Files:
      Tag: M5XQ
        prop_ocol.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_ocol.c,1.75
-- 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_ocol.c
Index: prop_ocol.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_ocol.c,v
retrieving revision 1.73.2.1
retrieving revision 1.73.2.2
diff -u -d -r1.73.2.1 -r1.73.2.2
--- prop_ocol.c 7 May 2009 14:44:52 -0000       1.73.2.1
+++ prop_ocol.c 15 Jun 2009 12:46:26 -0000      1.73.2.2
@@ -709,52 +709,42 @@
             ocols_count (n)++;
             break;
 
-        case la_avg:
-        case la_max:
-        case la_min:
-        case la_sum:
-        case la_prod:
+        case la_aggr:
             /* set number of schema items in the result schema:
-             * result column plus partitioning column
+             * result columns plus partitioning column
              * (if available -- constant optimizations may
              *  have removed it).
              */
-            new_ocols (n, n->sem.aggr.part ? 2 : 1);
+            new_ocols (n, n->sem.aggr.count + (n->sem.aggr.part ? 1 : 0));
 
             /* verify that columns 'col' and 'part' are columns of n
              * and include them into the result schema
              */
-            for (unsigned int i = 0; i < ocols_count (L(n)); i++) {
-                if (n->sem.aggr.col == ocol_at (L(n), i).name) {
-                    ocol_at (n, 0) = ocol_at (L(n), i);
-                    ocol_at (n, 0).name = n->sem.aggr.res;
-                }
-                if (n->sem.aggr.part &&
-                    n->sem.aggr.part == ocol_at (L(n), i).name) {
-                    ocol_at (n, 1) = ocol_at (L(n), i);
+            for (unsigned int i = 0; i < n->sem.aggr.count; i++) {
+                PFalg_col_t col = n->sem.aggr.aggr[i].col;
+                if (col) {
+                    if (!PFprop_ocol (L(n), col))
+                        PFoops (OOPS_FATAL,
+                                "column `%s' referenced in aggregate not 
found",
+                                PFcol_str (col));
+                    ocol_at (n, i).type = PFprop_type_of (L(n), col);
                 }
-            }
-            break;
-
-        case la_count:
-            /* set number of schema items in the result schema:
-             * result column plus partitioning column
-             * (if available -- constant optimizations may
-             *  have removed it).
-             */
-            new_ocols (n, n->sem.aggr.part ? 2 : 1);
+                else
+                    ocol_at (n, i).type = aat_int;
 
-            /* insert result column into schema */
-            ocol_at (n, 0).name = n->sem.aggr.res;
-            ocol_at (n, 0).type = aat_int;
+                ocol_at (n, i).name = n->sem.aggr.aggr[i].res;
+            }
+            if (n->sem.aggr.part) {
+                unsigned int i    = n->sem.aggr.count;
+                PFalg_col_t  part = n->sem.aggr.part;
+                if (!PFprop_ocol (L(n), part))
+                    PFoops (OOPS_FATAL,
+                            "column `%s' referenced in aggregate not found",
+                            PFcol_str (part));
 
-            /* copy the partitioning column */
-            if (n->sem.aggr.part)
-                for (unsigned int i = 0; i < ocols_count (L(n)); i++)
-                    if (ocol_at (L(n), i).name == n->sem.aggr.part) {
-                        ocol_at (n, 1) = ocol_at (L(n), i);
-                        break;
-                    }
+                ocol_at (n, i).type = PFprop_type_of (L(n), part);
+                ocol_at (n, i).name = part;
+            }
             break;
 
         case la_rownum:
@@ -803,18 +793,6 @@
             ocols_count (n)++;
             break;
 
-        case la_seqty1:
-        case la_all:
-            new_ocols (n, n->sem.aggr.part ? 2 : 1);
-
-            ocol_at (n, 0).name = n->sem.aggr.res;
-            ocol_at (n, 0).type = aat_bln;
-            if (n->sem.aggr.part) {
-                ocol_at (n, 1).name = n->sem.aggr.part;
-                ocol_at (n, 1).type = PFprop_type_of (L(n), n->sem.aggr.part);
-            }
-            break;
-
         case la_step:
         case la_guide_step:
 #ifndef NDEBUG


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