import spark.implicits._
val data = Seq(("James","Sales",34))
val df1 = data.toDF("name","dept","age")
df1.printSchema()
df1.write.option("mergeSchema", "true").format("delta").save("/location")
val data2 = Seq(("Tiger","Sales","34") )
var df2 = data2.toDF("name","dept","age")
df2.printSchema()
df2.write.option("mergeSchema", "true").format("delta").save("/location")
df2.show(false)
When we write the df2 dataframe, it fails because in the delta table age is of IntergerType and the second df2 age is of StringType. How do we handle such sitaution so that the code handles this case smoothly.