Fix optimizer performance regression
Fix string comparisons and remove unused field
Simplify handling multiple Hadoop versions