df1:
|--- id---|---value---|
| 1 | 23 |
| 2 | 23 |
| 3 | 23 |
| 2 | 25 |
| 5 | 25 |
df2:
|-idValue-|---count---|
| 1 | 33 |
| 2 | 23 |
| 3 | 34 |
| 13 | 34 |
| 23 | 34 |
df3:
|--- id---|---value---|
| 1 | 23 |
| 5 | 23 |
| 35 | 23 |
| 21 | 25 |
| 5 | 25 |
df4:
|-idValue--|---count---|
| 11 | 33 |
| 25 | 23 |
| 32 | 34 |
| 131 | 34 |
| 232 | 34 |
对于连接两个数据框,我使用以下脚本:
val joinDf=df1.join(df2,df1("idValue")===df2("idValue"),"fullouter")