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

Zoltan Haindrich updated CALCITE-4910:
--------------------------------------
    Description: 
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\",'\\2','a') is not null or 
replace(\"name\",'a[[:alpha:]]{5}','c') is not null) and 
(replace(\"name\",'[[:blank:]][[:alnum:]]*','b') is not null or 
replace(\"name\",'(.*)(.)$','d') is not null)
query: select \"salary\" +1 as s,\"deptno\" from \"emps\" where
            replace(\"name\",'[[:blank:]][[:alnum:]]*','b' ) is not null and 
replace(\"name\",'a[[:alpha:]]{5}','c') is not null and \"salary\">10
{code}

  was:
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:
materialized view: select 'a',\"empid\",\"deptno\",\"salary\" as s from 
\"emps\" where (replace(\"name\",'\\2','a') is not null or 
replace(\"name\",'a[[:alpha:]]{5}','c') is not null) and 
(replace(\"name\",'[[:blank:]][[:alnum:]]*','b') is not null or 
replace(\"name\",'(.*)(.)$','d') is not null)
query: select \"salary\" +1 as s,\"deptno\" from \"emps\" where
            replace(\"name\",'[[:blank:]][[:alnum:]]*','b' ) is not null and 
replace(\"name\",'a[[:alpha:]]{5}','c') is not null and \"salary\">10



> 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\",'\\2','a') is not null or 
> replace(\"name\",'a[[:alpha:]]{5}','c') is not null) and 
> (replace(\"name\",'[[:blank:]][[:alnum:]]*','b') is not null or 
> replace(\"name\",'(.*)(.)$','d') is not null)
> query: select \"salary\" +1 as s,\"deptno\" from \"emps\" where
>             replace(\"name\",'[[:blank:]][[:alnum:]]*','b' ) is not null and 
> replace(\"name\",'a[[:alpha:]]{5}','c') is not null and \"salary\">10
> {code}



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

Reply via email to