Details
Description
The RexUtil.simplify method should handle literal comparison simplification. From an email on the calcitedev mailing list:
Calcite doesn't seem to optimize away the literal comparison literal case
with RexUtil.simplify. In my understanding any literal comparison literal
results in a simple TRUE/FALSE result.I'm not sure this is valid in the general case, but I put together a simple
example of doing this on the RexUtil simplifyCall.
Issue Links
 relates to

CALCITE1638 Simplify $x=$x to true
 Closed
From Julian Hyde:
We have support for this in planner rules – I’m pretty sure that ReduceExpressionsRule.FILTER_INSTANCE will convert ‘where 1 = 0’ to ‘where false’, then PruneEmptyRules.FILTER_INSTANCE will make the Filter disappear altogether — but arguably it could happen in RexUtil.simplify also.
The purpose of RexUtil.simplify is to simplify (only) patterns that are commonly occurring, easy to recognize, and will produce a quick win in terms of the size of the RelNode/RexNode tree. I don’t know yet whether this passes that threshold. Can you log a JIRA case for this and we can discuss further?
By the way,
CALCITE1638is related. It changed the result of a test that was doing ‘where 1 = 1’.