Update of /cvsroot/monetdb/sql/src/server
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv14622/src/server

Modified Files:
        rel_bin.mx sql_statement.mx 
Log Message:
little cleanup of grp_create


Index: rel_bin.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/rel_bin.mx,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- rel_bin.mx  14 Oct 2009 12:21:02 -0000      1.96
+++ rel_bin.mx  27 Oct 2009 06:38:12 -0000      1.97
@@ -305,7 +305,7 @@
                                                list_destroy(l);
                                                return NULL;
                                        }
-                                       g = grp_create(es, g, NULL);
+                                       g = grp_create(es, g);
                                }
                        }
                        /* order on the group first */
@@ -1023,14 +1023,14 @@
                for (n = tids->h; n; n = n->next) {
                        stmt *t = n->data;
 
-                       grp = grp_create(column(t), grp, NULL);
+                       grp = grp_create(column(t), grp);
                }
                list_destroy(tids);
        } else {
                for (n = s->op1.lval->h; n; n = n->next) {
                        stmt *t = n->data;
 
-                       grp = grp_create(column(t), grp, NULL);
+                       grp = grp_create(column(t), grp);
                }
        }
 
@@ -1152,9 +1152,9 @@
         * columns before the group by.
         */
        for (n = left->op1.lval->h; n; n = n->next) 
-               lgrp = grp_create(column(n->data), lgrp, NULL);
+               lgrp = grp_create(column(n->data), lgrp);
        for (n = right->op1.lval->h; n; n = n->next) 
-               rgrp = grp_create(column(n->data), rgrp, NULL);
+               rgrp = grp_create(column(n->data), rgrp);
 
        a = sql_bind_aggr(sql->session->schema, "count", NULL);
        ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a, 1); 
@@ -1290,9 +1290,9 @@
         * columns before the group by.
         */
        for (n = left->op1.lval->h; n; n = n->next) 
-               lgrp = grp_create(column(n->data), lgrp, NULL);
+               lgrp = grp_create(column(n->data), lgrp);
        for (n = right->op1.lval->h; n; n = n->next) 
-               rgrp = grp_create(column(n->data), rgrp, NULL);
+               rgrp = grp_create(column(n->data), rgrp);
 
        a = sql_bind_aggr(sql->session->schema, "count", NULL);
        ls = stmt_aggr(stmt_dup(lgrp->grp), grp_dup(lgrp), a, 1); 
@@ -1736,7 +1736,7 @@
                                        grp_destroy(groupby);
                                return NULL;
                        }
-                       groupby = grp_create(gbcol, groupby, NULL);
+                       groupby = grp_create(gbcol, groupby);
                }
        }
        /* now aggregate */
@@ -2038,7 +2038,7 @@
                        stmt *ssum;
 
                        stmt *ins = stmt_dup(nth(inserts, 
c->c->colnr)->op2.stval);
-                       group *g = grp_create(ins, NULL, NULL);
+                       group *g = grp_create(ins, NULL);
                        stmt *ss = stmt_aggr(stmt_dup(g->grp), g, 
sql_dup_aggr(cnt), 1);
 
                        /* (count(ss) <> sum(ss)) */
@@ -2532,7 +2532,7 @@
                        /* also take the hopefully unique hash keys, to reduce
                           (re)group costs */
                        if (k->idx && hash_index(k->idx->type))
-                               g = grp_create(stmt_dup(idx_updates), g, NULL);
+                               g = grp_create(stmt_dup(idx_updates), g);
                        for (m = k->columns->h; m; m = m->next) {
                                sql_kc *c = m->data;
                                stmt *upd;
@@ -2550,7 +2550,7 @@
                                        upd = stmt_select2(upd, n, stmt_dup(n), 
0);
                                }
 
-                               g = grp_create(upd, g, NULL);
+                               g = grp_create(upd, g);
                        }
                        ss = stmt_aggr(stmt_dup(g->grp), grp_dup(g), 
sql_dup_aggr(cnt), 1);
                        grp_destroy(g);
@@ -2603,7 +2603,7 @@
                                upd = stmt_select2(upd, n, stmt_dup(n), 0);
                        }
 
-                       g = grp_create(upd, NULL, NULL);
+                       g = grp_create(upd, NULL);
                        ss = stmt_aggr(stmt_dup(g->grp), g, sql_dup_aggr(cnt), 
1);
 
                        /* (count(ss) <> sum(ss)) */

Index: sql_statement.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_statement.mx,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- sql_statement.mx    9 Oct 2009 21:04:04 -0000       1.191
+++ sql_statement.mx    27 Oct 2009 06:38:13 -0000      1.192
@@ -173,7 +173,6 @@
 
        stmt *grp;
        stmt *ext;
-       list *cols;             /* list of group by columns */
 } group;
 
 extern const char *st_type2string(st_type type);
@@ -305,7 +304,7 @@
 /*Dependency control*/
 extern list* stmt_list_dependencies(stmt *s, int depend_type);
 
-extern group *grp_create(stmt *s, group *og, stmt *col);
+extern group *grp_create(stmt *s, group *og);
 extern void grp_destroy(group *g);
 extern group *grp_dup(group *g);
 
@@ -551,8 +550,6 @@
        if (sql_ref_dec(&g->ref) == 0) {
                stmt_destroy(g->grp);
                stmt_destroy(g->ext);
-               if (g->cols)
-                       list_destroy(g->cols);
                _DELETE(g);
        }
 }
@@ -566,25 +563,16 @@
 }
 
 group *
-grp_create(stmt *s, group *og, stmt *col)
+grp_create(stmt *s, group *og)
 {
        group *g = NEW(group);
 
        sql_ref_init(&g->ref);
-       g->cols = NULL;
        if (og) {
                g->grp = stmt_derive(stmt_dup(og->grp), s);
-               g->cols = og->cols;
-               og->cols = NULL;
                grp_destroy(og);
        } else {
                g->grp = stmt_group(s);
-               if (col)
-                       g->cols = list_create(NULL);
-       }
-       if (col) {
-               assert(g->cols);
-               list_append(g->cols, col);
        }
        g->ext = stmt_ext(stmt_dup(g->grp));
        return g;


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to