You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Ziwei Liu (Jira)" <ji...@apache.org> on 2021/12/20 11:16:00 UTC
[jira] [Comment Edited] (CALCITE-4910) Enhance simplify to reduce ((a or d) and (a or c) and a and b) to (a and b)
[ https://issues.apache.org/jira/browse/CALCITE-4910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462552#comment-17462552 ]
Ziwei Liu edited comment on CALCITE-4910 at 12/20/21, 11:15 AM:
----------------------------------------------------------------
Thanks for all the comments.
I have updated the description.
I know that for sample expression like equal expression can be simplified, but if the expression is more complicated, it will not be simplified. And I will submit a pr as soon as possible. Thanks.
was (Author: ziwei liu):
Thanks for all the comment.
I have updated the description.
I know that for sample expression like equal expression can be simplified, but if the expression is more complicated, it will not be simplified. And I will submit a pr as soon as possible. Thanks.
> Enhance simplify to reduce ((a or d) and (a or c) and a and b) to (a and b)
> ---------------------------------------------------------------------------
>
> Key: CALCITE-4910
> URL: https://issues.apache.org/jira/browse/CALCITE-4910
> Project: Calcite
> Issue Type: Improvement
> Reporter: Ziwei Liu
> Assignee: Ziwei Liu
> Priority: Major
>
> Considering this condition, (a or d) and (a or c) and a and b. This condition can be simplified to a and b, but now simplify can not do this.
> This case is found out by materialized view test:
> {code}
> materialized view: select 'a',empid,deptno,salary as s from emps where (replace(name,'e','a') is not null or replace(name,'a','c') is not null) and (replace(name,'c','b') is not null or replace(name,'n','d') is not null)
> sql: select salary +1 as s,deptno from emps where
> replace(name,'c','b')
> is not null and replace(name,'a','c') is not null and salary>10
> The sql will not be rewritten by materialized view because when splitFilter,
> $3 > 10 and REPLACE($2, 'a', 'c') is not null and REPLACE($2, 'c', 'b') is not null and (REPLACE($2, 'a', 'c') is not null or REPLACE($2, 'e', 'a') is not null)
> and (REPLACE($2, 'c', 'b') is not null or REPLACE($2, 'n', 'd') is not null)
> can not be simplified to
> $3 > 10 and REPLACE($2, 'a', 'c') is not null and REPLACE($2, 'c', 'b') is not null
>
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)