Re: Simplify function with constant parameters

2024-01-04 Thread Hongyu Guo
Thank you very much for your reply. I have learned a lot!

Hongyu

On Fri, Jan 5, 2024 at 12:55 AM Mihai Budiu  wrote:

>
> https://calcite.apache.org/javadocAggregate/org/apache/calcite/rel/rules/ReduceExpressionsRule.ProjectReduceExpressionsRule.html
>
> Calcite has a very powerful constant folding optimizer.
>
> Mihai
> 
> From: Hongyu Guo 
> Sent: Thursday, January 4, 2024 4:16:31 AM
> To: dev@calcite.apache.org 
> Subject: Simplify function with constant parameters
>
> Hi devs,
>
> Function with constant parameters can be simplified, for example
> ```
> select abs(-1) as a, sqrt(4) as b;
> can be simplified as
> select 1 as a, 2.0 as b;
> ```
> The execution of the function occurs during planning rather than during
> runtime.
> I noticed that Spark supports this simplification. Can Calcite also support
> it? I can log a new jira if you agree.
>
> Best,
> Hongyu
>


Re: Simplify function with constant parameters

2024-01-04 Thread Mihai Budiu
https://calcite.apache.org/javadocAggregate/org/apache/calcite/rel/rules/ReduceExpressionsRule.ProjectReduceExpressionsRule.html

Calcite has a very powerful constant folding optimizer.

Mihai

From: Hongyu Guo 
Sent: Thursday, January 4, 2024 4:16:31 AM
To: dev@calcite.apache.org 
Subject: Simplify function with constant parameters

Hi devs,

Function with constant parameters can be simplified, for example
```
select abs(-1) as a, sqrt(4) as b;
can be simplified as
select 1 as a, 2.0 as b;
```
The execution of the function occurs during planning rather than during
runtime.
I noticed that Spark supports this simplification. Can Calcite also support
it? I can log a new jira if you agree.

Best,
Hongyu