[ 
https://issues.apache.org/jira/browse/FLINK-29091?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

lincoln lee updated FLINK-29091:
--------------------------------
    Description: 
RAND and RAND_INTEGER are dynamic function (isDynamicFuntion returns true), it 
should only evaluate once at query-level (not per record) for batch mode, 
FLINK-21713 did the similar fix for temporal functions. Note this a break 
change for batch jobs.

Another choice is keep the current behavior and update these two functions' 
definition to non-deterministic, this can minimize the affection to users. The 
RAND function without seed param is also treated as non-deterministic in some 
vendors:

[1]([https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions?view=sql-server-ver16#built-in-function-determinism)]

[2]([https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand)]

[3]([https://docs.oracle.com/database/timesten-18.1/TTPLP/d_random.htm#TTPLP71231)]
 

 

  was:
RAND and RAND_INTEGER are dynamic function, it should only evaluate once at 
query-level (not per record) for batch mode, FLINK-21713 did the similar fix 
for temporal functions.

Note: this a break change for batch jobs


> Correct RAND and RAND_INTEGER function to evaluate once at query-level for 
> batch mode
> -------------------------------------------------------------------------------------
>
>                 Key: FLINK-29091
>                 URL: https://issues.apache.org/jira/browse/FLINK-29091
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>            Reporter: lincoln lee
>            Priority: Major
>
> RAND and RAND_INTEGER are dynamic function (isDynamicFuntion returns true), 
> it should only evaluate once at query-level (not per record) for batch mode, 
> FLINK-21713 did the similar fix for temporal functions. Note this a break 
> change for batch jobs.
> Another choice is keep the current behavior and update these two functions' 
> definition to non-deterministic, this can minimize the affection to users. 
> The RAND function without seed param is also treated as non-deterministic in 
> some vendors:
> [1]([https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions?view=sql-server-ver16#built-in-function-determinism)]
> [2]([https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand)]
> [3]([https://docs.oracle.com/database/timesten-18.1/TTPLP/d_random.htm#TTPLP71231)]
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to