Sergey Nuyanzin created FLINK-38793:
---------------------------------------
Summary: 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
An example
{format:sql}
SELECT LTRIM(q), RTRIM(q) FROM (SELECT TRIM(c) as q FROM MyTable) t
{format}
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)