GitHub user cryeo opened a pull request:

    https://github.com/apache/spark/pull/22591

    [SPARK-25571][SQL] Add withColumnsRenamed method to Dataset

    ## What changes were proposed in this pull request?
    
    Add `withColumnsRenamed` method to rename multiple columns at a time as 
follows.
    
    ```scala
    // before
    ds.withColumnRenamed("first_name", "firstName")
      .withColumnRenamed("last_name", "lastName")
      .withColumnRenamed("postal_code", "postalCode")
    
    // after
    ds.withColumnsRenamed(
      "first_name" -> "firstName",
      "last_name" -> "lastName",
      "postal_code" -> "postalCode"
    )
    // or
    ds.withColumnsRenamed(Map(
      "first_name" -> "firstName",
      "last_name" -> "lastName",
      "postal_code" -> "postalCode"
    ))
    ```
    
    ## How was this patch tested?
    
    This patch is tested by unit test.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cryeo/spark SPARK-25571

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/22591.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #22591
    
----
commit af9dabe3919ae3811c258e5dbf224fb7bde225be
Author: Chaerim YEO <yeochaerim@...>
Date:   2018-09-29T13:57:16Z

    [SPARK-25571][SQL] Add withColumnsRenamed method to Dataset

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to