Julian>I cannot see any cases that would become more expensive. I mean the optimization passes might be complicated, not the storage of sargs themselves. For instance, CALCITE-4155 converts a in (1, 2, 3, 4, 5) to a >= 1 and a <= 5 Is it a significant improvement? Is between representation always better? Does the case appear very often in practice?
However, the optimization does take time, so it looks like extra logic with doubtful gains. Of course, it is unlikely sargs would be a major time consumer, however, if we keep adding tiny simplifications we might end up with a condition where the planning is slow and we have no way to fix it. I'm ok with people updating RexSimplify (and 4155 looks like an innocent feature), however, I think the current design is not really scalable (e.g. it might process the same expression multiple times). Vladimir