[jira] [Created] (FLINK-21284) Non-deterministic UDF functions return different values

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-21284) Non-deterministic UDF functions return different values

Shang Yuanchun (Jira)
hehuiyuan created FLINK-21284:
---------------------------------

             Summary: Non-deterministic UDF functions return different values
                 Key: FLINK-21284
                 URL: https://issues.apache.org/jira/browse/FLINK-21284
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: hehuiyuan


Non-deterministic UDF functions is used mutiple times , the result is different.

 
{code:java}
tableEnv.registerFunction("sample", new SampleFunction());

Table tm = tableEnv.sqlQuery("select name, RAND_INTEGER(10) as sample , sex from myhive_staff");
tableEnv.registerTable("tmp", tm);


tableEnv.sqlUpdate("insert into sinktable select * from tmp  where sample >= 8");




// UDF函数
public class SampleFunction extends ScalarFunction {
  public int eval(int pvid) {
    int a = (int) (Math.random() * 10);
    System.out.println("************************" + a );
    return a;
  }
}{code}
 

Sample udf function is used for `RAND_INTEGER(10) as sample`  when sink,

which lead  to  inconsistent result.

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)