You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Sergey Nuyanzin (Jira)" <ji...@apache.org> on 2026/05/23 18:34:00 UTC
[jira] [Commented] (FLINK-38793) Reuse result of functions if ther are used multiple times as input for other functions
[ https://issues.apache.org/jira/browse/FLINK-38793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18083096#comment-18083096 ]
Sergey Nuyanzin commented on FLINK-38793:
-----------------------------------------
Closing as it was fixed within FLINK-39268
> Reuse result of functions if ther are used multiple times as input for other functions
> --------------------------------------------------------------------------------------
>
> Key: FLINK-38793
> URL: https://issues.apache.org/jira/browse/FLINK-38793
> Project: Flink
> Issue Type: Bug
> Reporter: Sergey Nuyanzin
> Assignee: Sergey Nuyanzin
> Priority: Major
> Labels: pull-request-available
>
> An example
> {code:sql}
> SELECT LTRIM(q), RTRIM(q) FROM (SELECT TRIM(c) as q FROM MyTable) t
> {code}
> and plan shows
> {noformat}
> <Resource name="optimized exec plan">
> <![CDATA[
> Calc(select=[LTRIM(TRIM(BOTH, ' ', c)) AS EXPR$0, RTRIM(TRIM(BOTH, ' ', c)) AS EXPR$1])
> +- TableSourceScan(table=[[default_catalog, default_database, MyTable]], fields=[a, b, c])
> ]]>
> </Resource>
> {noformat}
> which means {{TRIM(BOTH, ' ', c)}} here will be evaluated twice, in case of more usages like that it we be evaluated more times
--
This message was sent by Atlassian Jira
(v8.20.10#820010)