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

Support Column type for withColumn and withColumnRenamed apis

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 2.2.2, 3.2.0
    • None
    • SQL
    • None

    Description

      Can we add overloaded version of withColumn or withColumnRenamed that accept Column type instead of String? That way I can specify FQN in case when there is duplicate column names. e.g. if I have 2 columns with same name as a result of join and I want to rename one of the field I can do it with this new API.
       
      This would be similar to Drop api which supports both String and Column type.
       
      def
      withColumn(colName: Column, col: Column): DataFrame
      Returns a new Dataset by adding a column or replacing the existing column that has the same name.
       
      def
      withColumnRenamed(existingName: Column, newName: Column): DataFrame
      Returns a new Dataset with a column renamed.
       
       
       
      I think there should also be this one:
       
      def
      withColumnRenamed(existingName: Column, newName: Column): DataFrame
      Returns a new Dataset with a column renamed.
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            tenstriker nirav patel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: