You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Goun Na (JIRA)" <ji...@apache.org> on 2018/09/14 08:50:00 UTC

[jira] [Commented] (SPARK-25430) Add map parameter for withColumnRenamed

    [ https://issues.apache.org/jira/browse/SPARK-25430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16614530#comment-16614530 ] 

Goun Na commented on SPARK-25430:
---------------------------------

I am working on it.

> 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org