Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-44980

Fix inherited namedtuples to work in createDataFrame

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.5.0
    • 3.5.0, 4.0.0
    • Connect, PySpark
    • None

    Description

      from collections import namedtuple
      MyTuple = namedtuple("MyTuple", ["zz", "b", "a"])
      
      class MyInheritedTuple(MyTuple):
          pass
      
      df = spark.createDataFrame([MyInheritedTuple(1, 2, 3), MyInheritedTuple(11, 22, 33)])
      df.collect()
      
      [Row(zz=None, b=None, a=None), Row(zz=None, b=None, a=None)]
      

      should be

      [Row(zz=1, b=2, a=3), Row(zz=11, b=22, a=33)]
      

      Attachments

        Activity

          People

            gurwls223 Hyukjin Kwon
            gurwls223 Hyukjin Kwon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: