Affects Version/s: 2.2.3
Fix Version/s: None
Component/s: Spark Core
I am trying to union 2 df which has same number of columns and types but in different order. It fails.
val df1 = sparkSession.sparkContext.parallelize(List(
(1, 5, true),
(2, 3, false),
(4, 4, true)
val df3 = sparkSession.sparkContext.parallelize(List(
(1, true, 6),
(2, false, 3),
(3, false, 2)
org.apache.spark.sql.AnalysisException: Union can only be performed on tables with the same number of columns
It should read schema (column names and/Or types ). I can see sometime you want to ignore column name and just want to do merge based on types. So May be introduce an option whether to use names followed by type or just type while doing merge.