It turned out "b" (sort operands in computeDigest) is easier to implement. I've filed a PR: https://github.com/apache/calcite/pull/1703
>($0, 2) vs <(2, $0) might be less trivial to implement, but I think it is worth doing at the same time. In any case, lots of expressions will need to be updated, and it is better if we make < vs > stable as well. A similar question is if we want to normalize >($0, 2) and <(2, $0) The suggested ordering is: 1) Order by string length 2) Order by string representation In other words, >($0, 2) normalizes to <(2, $0) because 2 is shorter. And >($0, +(2,3)) is kept intact Note: I do not have an immediate demand for normalizing < vs > (and >= vs <=), however, it looks like it is worth doing to minimize the overall damage. Vladimir
