Chunwei is correct.

If there are expressions that you would expect to constant-folded by that rule 
that aren’t, please log a bug.

> On Oct 25, 2021, at 7:10 PM, Chunwei Lei <chunwei.l...@gmail.com> wrote:
> 
> Hi, Ian.
> 
> ReduceExpressionsRule is always used to do constant folding.
> 
> 
> Best,
> Chunwei
> 
> 
> On Tue, Oct 26, 2021 at 4:34 AM Ian Bertolacci
> <ian.bertola...@workday.com.invalid> wrote:
> 
>> 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