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

Document no exception using DataFrame.withColumnRenamed when existing column doesn't exist

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5.0
    • 2.0.1
    • Documentation, PySpark
    • None

    Description

      The withColumnRenamed method does not raise an exception when the existing column does not exist in the dataframe.

      Example:

      In [4]: df.show()
      +---+-----+
      |age| name|
      +---+-----+
      |  1|Alice|
      +---+-----+
      
      
      In [5]: df = df.withColumnRenamed('dob', 'date_of_birth')
      
      In [6]: df.show()
      +---+-----+
      |age| name|
      +---+-----+
      |  1|Alice|
      +---+-----+
      

      Attachments

        Activity

          People

            dongjoon Dongjoon Hyun
            tomwphillips Tom Phillips
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: