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

Utility to convert python types to spark types compares Python "type" object rather than user's "tpe" for categorical data types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.3.3, 3.4.1, 3.5.0
    • PySpark
    • None

    Description

      In the typehints utility that converts python types to spark types, the line:

          # categorical types
          elif isinstance(tpe, CategoricalDtype) or (isinstance(tpe, str) and type == "category"):
              return types.LongType() 

      uses Python's 'type' keyword in the comparison. Hence, it will always be false. Here, the user's type is actually stored in the variable 'tpe'.

       

       

      See line here.

      Attachments

        Activity

          People

            tedjenks Ted Chester Jenks
            tedjenks Ted Chester Jenks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: