[ 
https://issues.apache.org/jira/browse/SPARK-15383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lijie Xu updated SPARK-15383:
-----------------------------
    Description: 
It is common to add column(s) from other DataFrame(s) as follows. However, 
current *withColumn()* function only supports appending a new column from the 
same DataFrame.

{code:java}
    val df1 = sc.makeRDD(1 to 5).toDF("a")
    val df2 = sc.makeRDD(10 to 15).toDF("b")
    val df = df1.withColumn("b", df2("b")) // Exception
{code}

Exception in thread "main" org.apache.spark.sql.AnalysisException: resolved 
attribute(s) b#3 missing from a#1 in operator !Project [a#1,b#3 AS b#4];



  was:
It is common to add column(s) from other DataFrame(s) as follows. However, 
current *withColumn()* function only supports appending a new column from the 
same DataFrame.

{code:scala}
    val df1 = sc.makeRDD(1 to 5).toDF("a")
    val df2 = sc.makeRDD(10 to 15).toDF("b")
    val df = df1.withColumn("b", df2("b")) // Exception
{code}

Exception in thread "main" org.apache.spark.sql.AnalysisException: resolved 
attribute(s) b#3 missing from a#1 in operator !Project [a#1,b#3 AS b#4];




> Support appending a new column from another DataFrame
> -----------------------------------------------------
>
>                 Key: SPARK-15383
>                 URL: https://issues.apache.org/jira/browse/SPARK-15383
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 1.6.1
>            Reporter: Lijie Xu
>            Priority: Minor
>
> It is common to add column(s) from other DataFrame(s) as follows. However, 
> current *withColumn()* function only supports appending a new column from the 
> same DataFrame.
> {code:java}
>     val df1 = sc.makeRDD(1 to 5).toDF("a")
>     val df2 = sc.makeRDD(10 to 15).toDF("b")
>     val df = df1.withColumn("b", df2("b")) // Exception
> {code}
> Exception in thread "main" org.apache.spark.sql.AnalysisException: resolved 
> attribute(s) b#3 missing from a#1 in operator !Project [a#1,b#3 AS b#4];



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to