You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Michael Armbrust (JIRA)" <ji...@apache.org> on 2015/07/28 06:59:04 UTC

[jira] [Resolved] (SPARK-9283) Join on Spark DataFrame with multiple columns

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

Michael Armbrust resolved SPARK-9283.
-------------------------------------
    Resolution: Duplicate

You need to use {{&}} instead of {{and}}.  We throw an error stating this in Spark 1.4.

> Join on Spark DataFrame with multiple columns
> ---------------------------------------------
>
>                 Key: SPARK-9283
>                 URL: https://issues.apache.org/jira/browse/SPARK-9283
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core, SQL
>    Affects Versions: 1.3.0
>            Reporter: Sandeep Pal
>
> Join on two dataframes with join condition on multiple columns does not work. Below is the example:
> df1.show()
> age coolid depid empname
> 23  7      1     sandeep
> 21  8      2     john   
> 24  9      1     cena   
> 45  12     3     bob    
> 20  7      4     tanay  
> 12  8      5     gaurav
> df2.show()
> coolid depid sal      
> 7      1     centos   
> 8      2     ubuntu   
> 6      6     fedora   
> 12     8     windows  
> 7      9     centos   
> 6      10    ice-cream
> df3=df2.join(df1,(df1.depid == df2.depid) and (df1.coolid == df2.coolid))
> coolid depid sal     age coolid depid empname
> 7      1     centos  23  7      1     sandeep
> 7      1     centos  20  7      4     tanay  
> 7      9     centos  23  7      1     sandeep
> 7      9     centos  20  7      4     tanay  
> 8      2     ubuntu  21  8      2     john   
> 8      2     ubuntu  12  8      5     gaurav 
> 12     8     windows 45  12     3     bob 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org