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

Improve error messages for Python UDTF returning non iterable

    XMLWordPrintableJSON

Details

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

    Description

      When the return type of a UDTF is not an iterable, the error message can be confusing to users. For example for this UDTF:

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

      Currently it fails with this error for regular UDTFs:

          return tuple(map(verify_and_convert_result, res))
      TypeError: 'int' object is not iterable

      And this error for arrow-optimized UDTFs:

          raise ValueError("DataFrame constructor not properly called!")
      ValueError: DataFrame constructor not properly called!

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: