[ 
https://issues.apache.org/jira/browse/CALCITE-1794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497973#comment-17497973
 ] 

xiong duan edited comment on CALCITE-1794 at 2/25/22, 12:48 PM:
----------------------------------------------------------------

The RexSimplify optimize the "AND" and "OR" comparisons to SARGs if it is worth 
it. We don't need to re-ordering it because after the "pull up predicate" 
optimize, we evaluate it again using the SARGS. [But now the SARGS only 
consider when the left(right) rexnode is INPUT_REF or FIELD_ACCESS].

I will add another SQL test in condition.iq to verify the physical plan. 

What do you mean? We should simplify it when generating the logical plan?


was (Author: nobigo):
The RexSimplify optimize the "AND" and "OR" comparisons to SARGs if it is worth 
it. We don't need to re-ordering it because after the "pull up predicate" 
optimize, we evaluate it again using the SARGS. [But now the SARGS only 
consider when the left(right) rexnode is INPUT_REF or FIELD_ACCESS].

The SQL is optimized. I will add another test in SqlToRelConverter.

> Simplify AND numeric comparisons when overlapping
> -------------------------------------------------
>
>                 Key: CALCITE-1794
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1794
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.29.0
>            Reporter: Remus Rusanu
>            Assignee: xiong duan
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Expressions such as {{$1<>1 and $1=2}} can be simplified to {{$1=2}}. Similar 
> {{$1>10 AND $1>20}} can be simplified to {{$1>20}}. Such expressions are 
> produced by the proposed solution for CALCITE-1790 (simplify boolean CASE to 
> complex AND/OR).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to