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

Bryan Pendleton commented on DERBY-2998:
----------------------------------------

Hi Thomas, thanks for posting the patch! I'll try to have a look at the code 
soon.

Perhaps we could treat the inability to reference the "AS R" renamed column in 
the WHERE clause as a separate issue since, as you observe, it is a problem 
with all column expressions, not just row_number() expressions. The most 
commonly-requested use of row_number() is probably going to be for limiting the 
number of rows retried, as in DERBY-581.

If you use the nested select form, to limit the results:

  select * from (select row_number() as rownum, * from t) where runum <= 10

then does the execution logic actually short-circuit the evaluation properly 
after the first 10 rows have been read? Or does the execution of this query run 
through the entire table and then later end up discarding all the rows beyond 
the first 10?

Since one of the primary goals of DERBY-581 is to efficiently limit the 
processing to only a small subset of the rows, we want to make sure that we 
achieve that result if possible.


> 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: row_number_prototype.diff, row_number_prototype.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.

Reply via email to