I'm trying to append two dataframes together with a near identical schema. Unfortunately there exists an array field containing a StructType which differs slightly between the two. One of the dataframes' StructType contains an extra StructField.
Df1
(Invoice,StringType),
(LineItems,
ArrayType(
StructType(
StructField(ItemID,StringType,true),
StructField(Name,StringType,true)
)
,true)
)
Df2
(Invoice,StringType),
(LineItems,
ArrayType(
StructType(
StructField(ItemID,StringType,true),
StructField(Name,StringType,true),
StructField(DiscountRate,DoubleType,true)
)
,true)
)
Using the mergeSchema option still results in an error. How can I merge these two dataframes ?
I'm trying to reach a generalised solution, all the solutions I've come across so far have been case specific.