Joining Spark dataframes on the key

后端 未结 8 2120
情书的邮戳
情书的邮戳 2020-11-28 03:02

I have constructed two dataframes. How can we join multiple Spark dataframes ?

For Example :

PersonDf, ProfileDf with a common col

相关标签:
8条回答
  • 2020-11-28 03:53

    inner join with scala

    val joinedDataFrame = PersonDf.join(ProfileDf ,"personId")
    joinedDataFrame.show
    
    0 讨论(0)
  • 2020-11-28 03:53

    Posting a java based solution, incase your team only uses java. The keyword inner will ensure that matching rows only are present in the final dataframe.

                Dataset<Row> joined = PersonDf.join(ProfileDf, 
                        PersonDf.col("personId").equalTo(ProfileDf.col("personId")),
                        "inner");
                joined.show();
    
    0 讨论(0)
提交回复
热议问题