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

Dataset.withAllColumnsRenamed should map all column names to a new one

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 2.3.1
    • None
    • SQL
    • None

    Description

      Currently one can only rename a column only one by one using withColumnRenamed() function. When one would like to rename all or most of the columns it would be easier to specify an algorithm for mapping from the old to the new name (like prefixing) than iterating over all the fields.

      Example usage is joining to a Dataset with the same or similar schema (special case is self joining) where the names are the same or overlapping. Such a joined Dataset would fail at saveAsTable()

      With the new function usage would be easy like that:

      ds.withAllColumnsRenamed("prefix" + _)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            misutoth Mihaly Toth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: