[
https://issues.apache.org/jira/browse/CALCITE-1794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
xiong duan updated CALCITE-1794:
--------------------------------
Description:
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).
Example:
{code:java}
x = 1 and x <> 2{code}
In optimizer procedure, We pull up "x = 1" first, then when we encounter "x <>
2", can be simplified to "x = 1".
{code:java}
x <> 2 and x = 1{code}
When we pull up "x <> 2" first, it can't optimize the "x = 1". So we need SARG
to optimize it again.
was: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).
> CAST operator prevent SARG to optimize "x <>2 and x = 1"
> --------------------------------------------------------
>
> 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).
> Example:
> {code:java}
> x = 1 and x <> 2{code}
> In optimizer procedure, We pull up "x = 1" first, then when we encounter "x
> <> 2", can be simplified to "x = 1".
> {code:java}
> x <> 2 and x = 1{code}
> When we pull up "x <> 2" first, it can't optimize the "x = 1". So we need
> SARG to optimize it again.
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)