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

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

First off, we will need support for unnamed windows for this jira to be 
completed

I'm off on the deep end of the pool, and could use some help and/or input on 
completing the prototype patch... 

I have extended the grammar, handling the row_number() function as an option in 
selectSubList(). Might not be the ideal place for all olap functions, but let's 
leave it there for the prototype patch.

The basic idea is that bytecode is  generated for the extended QueryTreeNode 
classes in the nodetree, and the bytecode will be run when the statement is 
actually executed after optimization. First I tried using the count aggregate 
as a "template" for row_number(). I learned a lot about how aggregates work in 
derby, but it weered off in the wrong direction.

Second attempt introduce a new RowNumberColumNode that extends ConstantNode, 
hoping to assign an incremental number when building the ResultSet. 
ResultSetList.generateCore() seems to be the place where this should be done? 
Is there some existing machinery that I should/can hook into for doing the 
incrementation, like the autoincrement functionality for insert? Would it be 
better to extend from VirtualColumnNode instead of ConstantNode since the 
column isn't actually stored?

My knowledge of the inner workings of derby are still fairly limited, and there 
isn't really a lot on the wiki on this except the header, so your help is 
greatly appreciated.

> 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
>
> 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