[ 
https://issues.apache.org/jira/browse/CALCITE-5169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benchao Li updated CALCITE-5169:
--------------------------------
    Description: 
As described in the title, {{xx < 1 OR xx > 1}} should be simplified to {{xx <> 
1}}.

See discussion in ML: 
https://lists.apache.org/thread/hsdgx0jb3214v6k9p7slbkk3xsbl0b7f
The original problem is that {{ename <> '' and ename <> '3'}} could be 
simplified to {{Sarg}} while {{(ename < '' or ename > '') and (ename < '3' or 
ename > '3')}} cannot.
Since {{<}} and {{<>}} have different {{SqlOperandTypeChecker.Consistency}}, 
the type inference result is different for these two cases. We suspect that the 
type inference result leads to the difference of simplification. 
However, the real reason is that {{xx < 1 OR xx > 1}} cannot be simplified to 
{{xx <> 1}} in simplification, which prevents {{(ename < '' or ename > '') and 
(ename < '3' or ename > '3')}} being simplified to {{ename <> '' and ename <> 
'3'}}.

  was:As described in the title, {{xx < 1 OR xx > 1}} should be simplified to 
{{xx <> 1}}


> 'xx < 1 OR xx > 1' cannot be simplified to 'xx <> 1'
> ----------------------------------------------------
>
>                 Key: CALCITE-5169
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5169
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.30.0
>            Reporter: Benchao Li
>            Assignee: Benchao Li
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.31.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> As described in the title, {{xx < 1 OR xx > 1}} should be simplified to {{xx 
> <> 1}}.
> See discussion in ML: 
> https://lists.apache.org/thread/hsdgx0jb3214v6k9p7slbkk3xsbl0b7f
> The original problem is that {{ename <> '' and ename <> '3'}} could be 
> simplified to {{Sarg}} while {{(ename < '' or ename > '') and (ename < '3' or 
> ename > '3')}} cannot.
> Since {{<}} and {{<>}} have different {{SqlOperandTypeChecker.Consistency}}, 
> the type inference result is different for these two cases. We suspect that 
> the type inference result leads to the difference of simplification. 
> However, the real reason is that {{xx < 1 OR xx > 1}} cannot be simplified to 
> {{xx <> 1}} in simplification, which prevents {{(ename < '' or ename > '') 
> and (ename < '3' or ename > '3')}} being simplified to {{ename <> '' and 
> ename <> '3'}}.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to