Is this a bug fix?  Shouldn't it go to the Oct2010 branch?

On 2010-11-14 00:41, [email protected] wrote:
> Changeset: cc66f0cbc375 for MonetDB
> URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc66f0cbc375
> Modified Files:
>       sql/src/backends/monet5/sql.mx
> Branch: default
> Log Message:
> 
> Patch to avoid mitosis in count distinct
> Distinct operations should be done at one node. Mitosis is avoided
> because it my rebuilt the original at great expense.
> 
> 
> diffs (46 lines):
> 
> diff -r 5409c3557055 -r cc66f0cbc375 sql/src/backends/monet5/sql.mx
> --- a/sql/src/backends/monet5/sql.mx  Sat Nov 13 10:32:53 2010 +0100
> +++ b/sql/src/backends/monet5/sql.mx  Sun Nov 14 00:41:03 2010 +0100
> @@ -1384,6 +1384,32 @@
>       return is_point;
>  }
>  
> +static int
> +rel_need_distinct_query( sql_rel *rel)
> +{
> +     int need_distinct = 0;
> +
> +     while (!need_distinct && rel && is_project(rel->op) && 
> !is_groupby(rel->op))
> +             rel = rel->l;
> +     if (!need_distinct && rel && is_groupby(rel->op) && rel->exps) {
> +             node *n, *m;
> +             for (n=rel->exps->h; n && !need_distinct; n = n->next) {
> +                     sql_exp *e = n->data;
> +                     if (e->type == e_aggr) {
> +                             list *l = e->l;
> +
> +                             if (l) for(m = l->h; m &&  !need_distinct; m = 
> m->next){
> +                                     sql_exp *a = m->data;
> +     
> +                                     if (!need_distinct(a))
> +                                             need_distinct = 1;
> +                             }
> +                     }
> +             }
> +     }
> +     return need_distinct;
> +}
> +
>  
>  stmt *
>  sql_symbol2stmt(mvc *c, symbol *sym)
> @@ -1411,6 +1437,9 @@
>               int pq;
>               r = rel_optimizer(c, r);
>               pq = rel_is_point_query(r);
> +             if (!pq)
> +                     pq = rel_need_distinct_query(r);
> +
>               if (c->emode == m_plan) {
>                       rel_print(c, r, 0);
>               } else {
> _______________________________________________
> Checkin-list mailing list
> [email protected]
> http://mail.monetdb.org/mailman/listinfo/checkin-list


-- 
Sjoerd Mullender

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to