[
https://issues.apache.org/jira/browse/CALCITE-7122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18011717#comment-18011717
]
Julian Hyde commented on CALCITE-7122:
--------------------------------------
Lower and upper are not inverses in all languages.
Greek has two lowercase forms of sigma: σ (regular sigma) used in
middle/beginning of words and ς (final sigma) - used at the end of words.
{code}
x = "λόγος"
lower(x) = "λόγος" // unchanged, already lowercase
upper(x) = "ΛΌΓΟΣ" // all uppercase
lower(upper(x)) = "λόγοσ" // final sigma becomes regular sigma
{code}
Turkish as two 'i'. The regular latin 'i' and the Turkish dotless 'ı.'
{code}
x = "Istanbul" // regular Latin I
lower(x) = "istanbul" // regular lowercase i
upper(x) = "ISTANBUL" // regular uppercase I
lower(upper(x)) = "ıstanbul" // Turkish ı (dotless i){code}
There are also problems with German's sharp 's'.
> 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
> 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)