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

Yu Xu commented on CALCITE-7122:
--------------------------------

[~julianhyde] Thank you for your reply, this reminder is very helpful. I will 
submit a JIRA report first and then implement it in future.

Firstly, I forgot to link the relevant JIRA report for CALCITE-7042. This JIRA 
is a follow-up for CALCITE-7042, simplifying the elimination operation of 
idempotent functions. The idempotent elimination rule of multivariate functions 
is not fixed. For example, for N parameters, it is difficult to determine which 
parameters are equal and can clearly satisfy the condition of idempotent 
elimination. However, the determination of a unary function is clear and can be 
directly eliminated. This JIRA report provides an easy way to eliminate 
idempotency in function calls. In PR, can simply add idempotent unary functions 
to the List, which I understand is convenient.


Regarding the second question, thank you for providing the example! It 
broadened my understanding of upper/lower case and clearly indicates that there 
is no inverse relationship between lower and upper, so I understand that we can 
just do idempotent elimination here. 

> Eliminate nested calls for idempotent unary functions upper/lower/abs
> ---------------------------------------------------------------------
>
>                 Key: CALCITE-7122
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7122
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.40.0
>            Reporter: Yu Xu
>            Assignee: Yu Xu
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.41.0
>
>
> Unary functions like upper/lower/abs are idempotent( f(f(...fx))—> fx, but 
> currently had not eliminate idempotency for them.
> eg:
>  
> {code:java}
> SELECT LOWER(LOWER('AAA')) {code}
> would convert to:
>  
> {code:java}
> SELECT LOWER(LOWER('AAA')){code}
> should would better simplify to
>  
> {code:java}
> SELECT LOWER('AAA') {code}
>  
>  
> Because the idempotency elimination of unary functions is relatively simple, 
> we can design a mechanism to simplify.



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

Reply via email to