You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dian Fu (Jira)" <ji...@apache.org> on 2020/12/19 02:30:00 UTC

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

     [ https://issues.apache.org/jira/browse/FLINK-20666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dian Fu reassigned FLINK-20666:
-------------------------------

    Assignee: Huang Xingbo

> 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.12.0, 1.11.2
>            Reporter: Huang Xingbo
>            Assignee: Huang Xingbo
>            Priority: Major
>              Labels: pull-request-available
>
> 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)