It should be a “union” operation instead of “join”.

And besides from Ted’s answer, if you are working with DataSet API:

def union(other: Dataset[T]): Dataset[T] = withPlan[T](other){ (left, right) =>

Thanks,
William

From: Ted Yu [mailto:[email protected]]
Sent: Wednesday, March 2, 2016 11:41 AM
To: Angel Angel
Cc: user
Subject: Re: Connect the two tables in spark sql

You only showed one record from each table.

Have you looked at the following method in DataFrame ?

  def unionAll(other: DataFrame): DataFrame = withPlan {

On Tue, Mar 1, 2016 at 7:13 PM, Angel Angel 
<[email protected]<mailto:[email protected]>> wrote:
Hello Sir/Madam,

I am using the spark sql for the data operation.

I have two tables with the same fields.

Table 1

name

address

phone Number

 sagar

 india

 22222222















Table 2

name

address

phone Number

 jaya

 india

 2222222
















I want to join this tables like the following way


Result Table

name

address

phone Number

 jaya

 india

 2222222

 sagar

 india

 22222222



How can i join this table. I tried using the join command it add the table to 
left side.

Please help me to solve this query.

Thanks,

Reply via email to