[SPARK-3010] fix redundant conditional in spark

https://issues.apache.org/jira/browse/SPARK-3010

there are some redundant conditional in spark, such as
1.
private[spark] def codegenEnabled: Boolean =
if (getConf(CODEGEN_ENABLED, "false") == "true") true else false
2.
x => if (x == 2) true else false
... 

this pr is to fix this