HPCC-11605 Cherry pick fixes for IF() folding issues