You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Thomas Nielsen (JIRA)" <ji...@apache.org> on 2007/11/20 11:12:43 UTC

[jira] Updated: (DERBY-2998) Add support for ROW_NUMBER() window function

     [ https://issues.apache.org/jira/browse/DERBY-2998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Nielsen updated DERBY-2998:
----------------------------------

    Attachment: d2998-3.diff
                d2998-3.stat

Attaching a new, working, but still not properly optimized, patch for the ROW_NUMBER() implementation.

This patch inserts a OLAPNode in the QueryTree, and generates an OLAPResultSet fetching rows from any given source ResultSet. The implementation of OLAPNode and OLAPResultSet is based on IndexToBaseRowNode and IndexRowToBaseRowResultSet respectively.

The missing optimization is due to the restriction (whereClause) not being properly recognized or passed to the inner select in the ROW_NUMBER() construct:
   select * from (select row_number() as r, t.* from t) as tr where r <= N;

The code in OLAPResultSet will check the restriction for all rows it sees, if defined.

As of now, the whereClause is changed to wherePredicates before passing them to the inner Select. But for the inner select each Predicate in the wherePredicates have (Prediacte.)scoped=false.

Patch still not intended for commit...

> Add support for ROW_NUMBER() window function
> --------------------------------------------
>
>                 Key: DERBY-2998
>                 URL: https://issues.apache.org/jira/browse/DERBY-2998
>             Project: Derby
>          Issue Type: Sub-task
>          Components: SQL
>            Reporter: Thomas Nielsen
>            Assignee: Thomas Nielsen
>            Priority: Minor
>         Attachments: d2998-3.diff, d2998-3.stat, row_number_prototype-2c.diff, row_number_prototype-2c.stat
>
>
> As part of implementing the overall OLAP Operations features of SQL (DERBY-581), implement the ROW_NUMBER() window function.
> More information about this feature is available at http://wiki.apache.org/db-derby/OLAPRowNumber

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.