[
https://issues.apache.org/jira/browse/CALCITE-7122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18012196#comment-18012196
]
Julian Hyde commented on CALCITE-7122:
--------------------------------------
Yes, focus on just the very simplest cases for the first commit.
My goal in gathering a list of functions that were - in some sense - idempotent
was to be able to see what were the categories. We now see that one category is
the trivial functions (CAST to the same datatype and unary plus), and other
category is multi-argument functions idempotent on particular arguments (e.g.
MOD is idempotent on one argument but not the other). MAX (and other monoid
aggregate functions) are idempotent in some sense, and functions that throw or
return null are also idempotent in some sense.
Please always use upper-case for function names.
> 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)