[
https://issues.apache.org/jira/browse/FLINK-25502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Timo Walther closed FLINK-25502.
--------------------------------
Resolution: Invalid
Please take a look at:
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/functions/udfs/#determinism
{code}
If a function is called with constant expressions or constant expressions can
be derived from the given statement, a function is pre-evaluated for constant
expression reduction and might not be executed on the cluster anymore. Unless
isDeterministic() is used to disable constant expression reduction in this
case. For example, the following calls to ABS are executed during planning:
SELECT ABS(-1) FROM t and SELECT ABS(field) FROM t WHERE field = -1; whereas
SELECT ABS(field) FROM t is not.
{code}
> eval method of Flink ScalerFunction only run one time
> -----------------------------------------------------
>
> Key: FLINK-25502
> URL: https://issues.apache.org/jira/browse/FLINK-25502
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API
> Affects Versions: 1.14.2
> Reporter: Spongebob
> Priority: Major
>
> assume that there is one scalerFunction named `id` which's eval method takes
> no arguments and return increasing int value on each calling. Now I found
> that when I call `id()` function in FlinkSQL that has 3 rows , the eval
> method only was called one time so I got the same id value for each row. The
> sql likes 'SELECT f0, id() FROM T'.
> So I decided to define one argument on `eval` method. When I execute sql
> 'SELECT f0, id(1) FROM T' I got the same id value still. But when I execute
> sql 'SELECT f0, id(f0) FROM T' then I could get the correct id value, because
> the eval method was called by three times now.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)