Fix for row number window function optimization

It think this reads better if you expand the condition: `if (!reference.isPresent() || !literal.isPresent()) { ... }`