Sharad R. Telkar
Sharad R. Telkar

Reputation: 55

Union returns dataset - Spark 3.1.2

There are two dataframes mergeDF_A and mergeDF_B. The below union action is giving a dataset instead of dataframe. Why is it returning a dataset? And how to get a dataframe?

val finalMergeDF = mergeDF_A.union(mergeDF_B).distinct()

Upvotes: 0

Views: 128

Answers (1)

Gabio
Gabio

Reputation: 9504

You can convert dataset to dataframe using toDF():

mergeDF_A.union(mergeDF_B).toDF()

Upvotes: 1

Related Questions