spark schema difference in partitions

Solution 1:

You can use the mergeSchema option that should do exactly what you are looking for as long as columns with the same name have the same type.

Example:

spark.read.option("mergeSchema", "true").format(...).load(...)