Update of /cvsroot/monetdb/sql/src/server
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31860/src/server

Modified Files:
        rel_bin.mx 
Log Message:
strickter topn 


Index: rel_bin.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/rel_bin.mx,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- rel_bin.mx  10 Jan 2010 15:33:34 -0000      1.107
+++ rel_bin.mx  10 Jan 2010 17:28:33 -0000      1.108
@@ -1561,12 +1561,13 @@
                list_append(pl, s);
        }
        psub = stmt_list(pl);
-       /* In case of an topn 
+       /* In case of a topn 
                if both order by and distinct: then get first order by col early
                        do topn on it. Project all again! Then rest
          */
        if (topn && rel->r) {
                list *oexps = rel->r, *npl = create_stmt_list();
+               int before_project = need_distinct(rel) || (list_length(oexps) 
> 1);
                sql_exp *orderbycole = oexps->h->data; 
 
                stmt *limit, *orderbycols = exp_bin(sql, orderbycole, sub, 
psub, NULL, NULL); 
@@ -1576,7 +1577,7 @@
                        stmt_destroy(sub);
                        return NULL;
                }
-               limit = stmt_limit(orderbycols, 0, l, 
LIMIT_DIRECTION(is_ascending(orderbycole), 1, 1));
+               limit = stmt_limit(orderbycols, 0, l, 
LIMIT_DIRECTION(is_ascending(orderbycole), 1, before_project));
                for ( n=pl->h ; n; n = n->next) {
                        list_append(npl, 
                                stmt_semijoin(column(stmt_dup(n->data)), 


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to