createRemoveUselessAndsPass

fun createRemoveUselessAndsPass(): PartiQLPhysicalPass

Creates an instance of PartiQLPhysicalPass that removes useless "AND" expressions by, i.e.:

  • (and (lit true) (lit true)) ->(lit true)

  • (and (lit true) <expr>)) -><expr>

  • (and <expr> (lit true))) -><expr>

If more than one non-lit true remains, the AND expression is not useless, but the expression is returned with all (lit true) operands removed.

Note that in the future, it may be possible to do this with a more general constant folding rewrite but that is currently out of scope.