[jira] [Created] (FLINK-20666) Fix the deserialized Row losing the field_name information in PyFlink

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

[jira] [Created] (FLINK-20666) Fix the deserialized Row losing the field_name information in PyFlink

Shang Yuanchun (Jira)
Huang Xingbo created FLINK-20666:
------------------------------------

             Summary: Fix the deserialized Row losing the field_name information in PyFlink
                 Key: FLINK-20666
                 URL: https://issues.apache.org/jira/browse/FLINK-20666
             Project: Flink
          Issue Type: Bug
          Components: API / Python
    Affects Versions: 1.11.2, 1.12.0
            Reporter: Huang Xingbo


Now, the deserialized Row loses the field_name information.
{code:java}
@udf(result_type=DataTypes.STRING())
def get_string_element(my_list):
    my_string = 'xxx'
    for element in my_list:
        if element.integer_element == 2:  # element lost the field_name information
            my_string = element.string_element
    return my_string

t = t_env.from_elements(
    [("1", [Row(3, "flink")]), ("3", [Row(2, "pyflink")]), ("2", [Row(2, "python")])],
    DataTypes.ROW(
        [DataTypes.FIELD("Key", DataTypes.STRING()),
         DataTypes.FIELD("List_element",
                         DataTypes.ARRAY(DataTypes.ROW(
                             [DataTypes.FIELD("integer_element", DataTypes.INT()),
                              DataTypes.FIELD("string_element", DataTypes.STRING())])))]))
print(t.select(get_string_element(t.List_element)).to_pandas())
{code}
element lost the field_name information



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