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

Column.__repr__ shouldn't encode JVM response

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.0
    • Fix Version/s: None
    • Component/s: PySpark, SQL
    • Labels:
      None
    • Target Version/s:

      Description

      At the moment PySpark Column encodes JVM response in _repr_ method.

      As a result, column names using only ASCII characters get b prefix

      >>> from pyspark.sql.functions import col                                                                                                                                                
      >>> col("abc")                                                                                                                                                                           
      Column<b'abc'>
      

      and the others ugly byte string

      >>> col("wąż")                                                                                                                                                                           
      Column<b'w\xc4\x85\xc5\xbc'>
      

      This behaviour is inconsistent with other parts of the API, for example:

      >>> spark.createDataFrame([], "`wąż` long")                                                                                                                                              
      DataFrame[wąż: bigint]
      

      and Scala

      scala> col("wąż")
      res0: org.apache.spark.sql.Column = wąż
      

      and R

      > column("wąż")
      Column wąż 
      

      Encoding has been originally introduced with SPARK-5859, but it doesn't seem like it is really required.

      Desired behaviour

      >>> col("wąż")                                                                                                                                                                           
      Column<'wąż'>
      

      or

      >>> col("wąż")                                                                                                                                                                           
      Column<wąż>
      

        Attachments

          Activity

            People

            • Assignee:
              zero323 Maciej Szymkiewicz
              Reporter:
              zero323 Maciej Szymkiewicz
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: