[
https://issues.apache.org/jira/browse/CALCITE-7122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18012271#comment-18012271
]
Zhen Chen commented on CALCITE-7122:
------------------------------------
I have a suggestion that I don't know if there is a ready-made implementation
now. For example, can this simplified operation be expressed in SQL form when
writing test cases? For example, "select upper(upper(lower(lower('x'))))" can
be simplified to "upper(lower('x'))" , and then it is necessary to do type
checking and related checks. The current test framework still requires manual
construction of a function (such as "upper"), which is not easy for people to
quickly understand the test.
> Eliminate nested calls for idempotent unary functions UPPER/LOWER/ABS/INITCAP
> ------------------------------------------------------------------------------
>
> 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)