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

Fix the bug of using Python UDF from sub-query as input param of Python UDTF

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.11.3, 1.12.2, 1.13.0
    • None
    • API / Python

    Description

      This example comes from the user. splitStr is a Python UDTF. train_and_predict is a Python UDF.

      t_env.sql_query("""
       select A.hotime ,
               A.before_ta ,
               A.before_rssi ,
               A.after_ta ,
               A.after_rssil ,
               A.nb_tath ,
               A.nb_rssith ,
               nbr_rssi ,
               nbr_ta
       from (SELECT
           hotime ,
           before_ta ,
           before_rssi ,
           after_ta ,
           after_rssil ,
           nb_tath ,
           nb_rssith ,
           train_and_predict(nb_tath, nb_rssith) predict
       FROM
           source) as  A,LATERAL TABLE(splitStr(predict)) as T(nbr_rssi, nbr_ta)
       """)
      
      

      The root cause is that `train_and_predict` is a RexCorrelVariable which we don't have relevant logic to deal with.

      A workaround is to use the Table API.

      Attachments

        Activity

          People

            Unassigned Unassigned
            hxbks2ks Huang Xingbo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: