Alex Wong
Alex Wong

Reputation: 1

Add Existing Row in spark to another DataSet (Spark Java 2.3.1)

I have to 2 Datasets:

It is a bijective relationship between A and B

Can I nest the 2 together into one datasets that way when it is converted to a json object there is just an interior object that represents that element row from dataset B.

The end product should be

{  
Dataset-A  
  { 
    Dataset-B-Object
  }
}

Upvotes: 0

Views: 270

Answers (1)

Omar Muhtaseb
Omar Muhtaseb

Reputation: 117

No way in hell you can do that. We are talking about Spark, not some web APIs that you want to create from the dataset.

You can union the two dataset in one dataset

datasetA.union(datasetB)

and the result will be one dataset joined together.

Upvotes: 1

Related Questions