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

Inability to access to column alias in pyspark

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Invalid
    • 2.4.0
    • None
    • PySpark
    • None

    Description

      In pyspark I have the following:

      import pyspark.sql.functions as F
      cc = F.lit(1).alias("A")
      
      print(cc)
      print(cc._jc.toString())
      

      I get :

      Column<b'1 AS `A`'>
      1 AS `A`
      

      Is there any way for me to just print "A" from cc ? it seems I'm unable to extract the alias programatically from the column object.

      Also I think that in spark-sql in scala, if I print "cc" it would just print "A" instead, so this seem like a bug or a missing feature to me

      Attachments

        Activity

          People

            Unassigned Unassigned
            vincent_g Vincent
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: