Howdy,
Does Calcite have any mechanism for applying constant folding to RexNodes in a 
query?

We’ve been wondering why expressions like `1 + 2` don’t get folded into the 
constant `3`.
We’re aware of RexSimplify, but it only does constant folding for Boolean 
expressions (i.e. logical and (some) comparison operations)
And even with RexSimplify, we find that it still does not perform some (what we 
would consider trivial) optimizations on SEARCH expressions.
For example `SEARCH(123:BIGINT, Sarg[123L:BIGINT]:BIGINT)` should get folded 
into `true`, but isn’t.
(But that’s a separate conversation).

So: is constant folding on all expressions something that already exists in 
Calcite?
If so, what should we be looking at to configure Calcite to apply constant 
folding?

Thanks!
-Ian J. Bertolacci

Reply via email to