Liu Liu created FLINK-41253:
-------------------------------

             Summary: Python scalar UDFs produce incorrectly ordered columns 
when mixing sync and async calls
                 Key: FLINK-41253
                 URL: https://issues.apache.org/jira/browse/FLINK-41253
             Project: Flink
          Issue Type: Bug
          Components: API / Python
    Affects Versions: 2.3.0
            Reporter: Liu Liu


Mixing synchronous and asynchronous Python scalar UDFs in a projection can 
produce columns in the wrong order. The issue affects both streaming and batch 
execution.

For the minimal example below:

 
{code:java}
from pyflink.table import DataTypes, EnvironmentSettings, TableEnvironment
from pyflink.table.udf import udf

@udf(result_type=DataTypes.BIGINT())
def sync_add(value):
    return value + 1

@udf(result_type=DataTypes.BIGINT())
async def async_add(value):
    return value + 2

table = env.from_elements(
    [(1,)],
    DataTypes.ROW([DataTypes.FIELD("a", DataTypes.BIGINT())]),
)

with table.select(sync_add(table.a), async_add(table.a)).execute().collect() as 
rows:
    print([tuple(row) for row in rows]){code}
 
 * {{select(sync_add(a), async_add(a))}} should return {{{}(2, 3){}}}, but 
returns {{{}(3, 2){}}}.
 * {{select(async_add(a), sync_add(a))}} correctly returns {{{}(3, 2){}}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to