You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Leonid Chistov (Jira)" <ji...@apache.org> on 2023/04/11 12:57:00 UTC

[jira] [Updated] (CALCITE-5639) RexSimplify not removes IS NOT NULL check when LIKE comparison is present

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

Leonid Chistov updated CALCITE-5639:
------------------------------------
    Description: 
Consider query like
{code:java}
select r_reason_desc from reason
where r_reason_desc is not null and r_reason_desc like '%child%' 
{code}
where "r_reason_desc" is a nullable field.

When RexSimplify::simplifyFilterPredicates is called on that conjunction of expressions, expression is not simplified, meaning that redundant  "is not null" check is not removed.

In the same time, if query like 
{code:java}
select r_reason_desc from reason
where r_reason_desc is not null and r_reason_desc >= 'A'{code}
is passed to optimizer, redundant "is not null" check is eliminated.

  was:
Consider query like

 
{code:java}
select r_reason_desc from reason
where r_reason_desc is not null and r_reason_desc like '%child%' 
{code}
 

where "r_reason_desc" is a nullable field.

When RexSimplify::simplifyFilterPredicates is called on that conjunction of expressions, expression is not simplified, meaning that redundant  "is not null" check is not removed.

In the same time, if query like 
{code:java}
select r_reason_desc from reason
where r_reason_desc is not null and r_reason_desc >= 'A'{code}
is passed to optimizer, redundant "is not null" check is eliminated.


> RexSimplify not removes IS NOT NULL check when LIKE comparison is present
> -------------------------------------------------------------------------
>
>                 Key: CALCITE-5639
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5639
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.34.0
>            Reporter: Leonid Chistov
>            Assignee: Leonid Chistov
>            Priority: Major
>
> Consider query like
> {code:java}
> select r_reason_desc from reason
> where r_reason_desc is not null and r_reason_desc like '%child%' 
> {code}
> where "r_reason_desc" is a nullable field.
> When RexSimplify::simplifyFilterPredicates is called on that conjunction of expressions, expression is not simplified, meaning that redundant  "is not null" check is not removed.
> In the same time, if query like 
> {code:java}
> select r_reason_desc from reason
> where r_reason_desc is not null and r_reason_desc >= 'A'{code}
> is passed to optimizer, redundant "is not null" check is eliminated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)