How can we merge 2 dataframes without duplicate columns
a.show() +-----+-------------------+--------+------+ | Name| LastTime|Duration|Status| +-----+-------------------+--------+------+ | Bob|2015-04-23 12:33:00| 1|logout| |Alice|2015-04-20 12:33:00| 5| login| +-----+-------------------+--------+------+ b.show() +-----+-------------------+--------+------+ | Name| LastTime|Duration|Status| +-----+-------------------+--------+------+ | Bob|2015-04-24 00:33:00| 1|login | +-----+-------------------+--------+------+ I want to form a new dataframe by using whole data in Dataframe A but update rows using data in B
+-----+-------------------+--------+------+ | Name| LastTime|Duration|Status| +-----+-------------------+--------+------+ | Bob|2015-04-24 00:33:00| 1|login | |Alice|2015-04-20 12:33:00| 5| login| +-----+-------------------+--------+------+ I am able to join and form dataframe in scala. But not able to do in JAVA.
DataFrame f=a.join(b,a.col("Name").equalsTo(b.col("Name")).and a.col("LastTime).equalsTo(b.col("LastTime).and(a.col("Duration").equalsTo(b.col("Duration"),"outer") I am getting duplicate columns while performing JOIN like this.