Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 08:47 PM - edited 07-23-2023 08:58 PM
Hi,
I have come across same scenario, using reduce() and unionByname we can implement the solution as below:
val lstDF: List[Datframe] = List(df1,df2,df3,df4,df5)
val combinedDF = lstDF.reduce((df1, df2) => df1.unionByName(df2, allowMissingColumns = true))
#Scala # Spark #multiple schema