Optimize row_number window function 

Identify the query shape with a filter on the row_number() and rewrite it for optimal execution.
Examples of query shapes affected by this: 
https://gist.github.com/nileema/71d0099d804a10cb172b

Note: Optimization applies only if the all the following criteria are met: 
1. There is a single row number function in the query 
2. The filter is a simple comparison with a literal (compound expressions are not supported in this revision) 
3. The filter operation is directly above the window  function
This is confusing to me. What's the difference between memorySize and currentMemoryReservation? I'd add a comment explaining them