Fix for row number window function optimization

It throws an exception in that case, with the current code. I'll fix it so that the optimization is applied only when there is a comparison expression between a literal and the row_number symbol. That should take care of this case.