Alan Sheinberg created FLINK-37721:
--------------------------------------

             Summary: Fix Janino Bug which resulted in 
                 Key: FLINK-37721
                 URL: https://issues.apache.org/jira/browse/FLINK-37721
             Project: Flink
          Issue Type: Sub-task
            Reporter: Alan Sheinberg


The bug comes from the fact that previously, we were creating an anonymous 
function callback within the janino generated code. This function was then 
referencing the local {{{}DelegatingAsyncResultFuture{}}}, effectively creating 
a closure. When the function was called back from different threads, they 
seemed to both reference the same {{DelegatingAsyncResultFuture}} rather than 
their own local ones. The result was returning incorrect "synchronous" results, 
so queries like the following might have issues:

```

SELECT f1, func(f1, f2, f3) FROM Table1;

```

 

Here, the {{f1}} column returned was retrieved by asking for it from the local 
{{{}DelegatingAsyncResultFuture{}}}, and so getting the wrong instance meant 
getting the wrong result.

To fix it, we should remove the inner anonymous function and just added the 
same logic on {{{}DelegatingAsyncResultFuture{}}}. It requires setting it up 
with all of the metadata (indexes, sync results), and when the result is 
complete, rather than calling the generated function, create the result 
{{RowData}} itself.



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

Reply via email to