Fix for row number window function optimization

Same comment as above