Currently, we only have simple normalization such as:
$2 = $1 => $1 = $2
$2 > $1 => $1 < $2
we can extend the logic to more like:
- put the complex predicates behind, like OR(OR(udf($1), $2), $3) => OR($3, OR(udf($1), $2))
- put the udf operand behind, like OR(udf($1), $2) => OR($2, udf($1))
- put the local variables that appears more frequently in the front, which is more user-friendly to code generation because the variable can be cached and reused.
Also note that, we should allows flexible configuration for switch this function on/off(not a system calcite property now) for downstream users and projects(because the normalization may have some performance trade-off).