Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-20666

Fix the deserialized Row losing the field_name information in PyFlink

    XMLWordPrintableJSON

    Details

      Description

      Now, the deserialized Row loses the field_name information.

      @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())
      

      element lost the field_name information

        Attachments

          Activity

            People

            • Assignee:
              hxbks2ks Huang Xingbo
              Reporter:
              hxbks2ks Huang Xingbo
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: