You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lincoln lee (Jira)" <ji...@apache.org> on 2022/08/24 10:13:00 UTC
[jira] [Updated] (FLINK-29091) Fix the determinism declaration of the rand function to be consistent with current behavior
[ https://issues.apache.org/jira/browse/FLINK-29091?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
lincoln lee updated FLINK-29091:
--------------------------------
Summary: Fix the determinism declaration of the rand function to be consistent with current behavior (was: Fix the determinism declaration of the rand function to be consistent with the current behavior)
> Fix the determinism declaration of the rand function to be consistent with current behavior
> -------------------------------------------------------------------------------------------
>
> 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
> Labels: pull-request-available
> Fix For: 1.16.0
>
>
> RAND and RAND_INTEGER are declared as dynamic function (isDynamicFuntion returns true), as the declaration it should only evaluate once at query-level (not per record) for batch mode, FLINK-21713 did the similar fix for temporal functions.
> But current behavior is completely a non-deterministic function which evaluated per record for both batch and streaming mode, it's not a good choice to break current behavior, and the determinism of RAND function are also different across vendors:
> [1] evaluated at query-level though it is treated as non-deterministic function [https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions?view=sql-server-ver16#built-in-function-determinism|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][ evaluated at row level: [https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand]|https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand)]
> [3] evaluated at row level if not specifies a seed, e.g., DBMS_RANDOM.normal, DBMS_RANDOM.value(1,10) [https://docs.oracle.com/database/timesten-18.1/TTPLP/d_random.htm#TTPLP71231|https://docs.oracle.com/database/timesten-18.1/TTPLP/d_random.htm#TTPLP71231)]
> So just fix the determinism declaration of the rand function to be consistent with the current behavior and make it clear in the documentation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)