[
https://issues.apache.org/jira/browse/SPARK-25430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16617824#comment-16617824
]
Apache Spark commented on SPARK-25430:
--------------------------------------
User 'goungoun' has created a pull request for this issue:
https://github.com/apache/spark/pull/22428
> Add map parameter for withColumnRenamed
> ---------------------------------------
>
> Key: SPARK-25430
> URL: https://issues.apache.org/jira/browse/SPARK-25430
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 2.3.1
> Reporter: Goun Na
> Priority: Major
>
> WithColumnRenamed method should work with map parameter. It removes code
> redundancy.
> {code:java}
> // example
> df.withColumnRenamed(Map( "c1" -> "first_column", "c2" -> "second_column"
> )){code}
> {code:java}
> // from abbr columns to desc columns
> val m = Map( "c1" -> "first_column", "c2" -> "second_column" )
> df1.withColumnRenamed(m)
> df2.withColumnRenamed(m)
> {code}
> It is useful for CJK users when they are working on analysis in notebook
> environment such as Zeppelin, Databricks, Apache Toree.
> {code:java}
> // for CJK users once define dictionary into map, reuse column map to
> translate columns whenever report visualization is required
> val m = Map( "c1" -> "컬럼_1", "c2" -> "컬럼_2")
> df1.withColumnRenamed(m)
> df2.withColumnRenamed(m)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]