Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-43797 Python User-defined Table Functions
  3. SPARK-43967

Support Python UDTFs with empty return values

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.5.0
    • 3.5.0
    • PySpark
    • None

    Description

      Support UDTFs with empty returns, for example:

      @udtf(returnType="a: int")
      class TestUDTF:
          def eval(self, a: int):
              ... 

      Currently, this will fail with the exception 

      TypeError: 'NoneType' object is not iterable 

      Another example

      class TestUDTF:
          def eval(self, a: int):
              yield 

      This will fail with the exceptions

      java.lang.NullPointerException 

      Note, arrow-optimized UDTFs already support this. This error only occurs with regular Python UDTFs.

      Attachments

        Activity

          People

            allisonwang-db Allison Wang
            allisonwang-db Allison Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: