[ 
https://issues.apache.org/jira/browse/CALCITE-7088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18003549#comment-18003549
 ] 

Julian Hyde edited comment on CALCITE-7088 at 7/7/25 3:17 PM:
--------------------------------------------------------------

There are countless logical identities, and we can’t cover them all. May I ask 
why you “expected” that “%%” would be simplified? Why not also “%%%%%%”?

In your PR you add a test that “%%A” should not be simplified to “%A”. I would 
like to hear from you a principled justification for why we should stop at 
“%%”. 

Furthermore, you say in the description that it should simplify to TRUE. That 
is a leap - a further optimization that relies on a NOT NULL condition. The 
correct one-step simplification is to “x = x” or something like it. The example 
in the description is misleading to people who may read this case in future. 


was (Author: julianhyde):
There are countless logical identities, and we can’t cover them all. May I ask 
why you “expected” that “%%” would be simplified? Why not also “%%%%%%”?

Furthermore, you say in the description that it should simplify to TRUE. That 
is a leap - a further optimization that relies on a NOT NULL condition. 

> X LIKE '%%' should simply to X=X
> --------------------------------
>
>                 Key: CALCITE-7088
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7088
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.40.0
>            Reporter: Yu Xu
>            Assignee: Yu Xu
>            Priority: Minor
>             Fix For: 1.41.0
>
>
> sql:
> {code:java}
> "select \"product_name\" like '%' from \"product\""; {code}
> would convert  as expected:
> {code:java}
> "SELECT TRUE\nFROM \"foodmart\".\"product\"" ;{code}
> but sql:
> {code:java}
> "select \"product_name\" like '%%' from \"product\"";{code}
> would convert  not as expected:
> {code:java}
> "SELECT \"product_name\" LIKE '%%'\nFROM \"foodmart\".\"product\"" ;{code}
>  
> LIKE '%%...' should keep the same with LIKE '%' 



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

Reply via email to