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
This should just abort the optimization, not fail the query