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

Thomas Nielsen commented on DERBY-2998:
---------------------------------------

You have a valid point Knut.

Further investigation shows that the inner row_number() is executed once for 
every outer execution - which is the way one would like to do this. The 
following output from a test table with 3 rows illustrate this. Never mind the 
bug not distinguishing between the two row_number()s for now, but it clearly 
shows the order in which this is executed:

ij> select row_number(),r,a,b from (select row_number() as r, t.* from t) as tr 
where r <=3;
row_number()        |R                   |A          |B          
-----------------------------------------------------------------
2                   |1                   |1          |9          
4                   |3                   |2          |8          

2 rows selected

If the inner resultset was flagged as ordered on R the outer might use that 
info to determine when to stop.

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