Goun Na created SPARK-25430:
-------------------------------

             Summary: 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


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

Reply via email to