Issue in Union with Empty dataframe
问题 I wanted to append a dataframe to another empty dataframe in a loop and finally write to a Location. My Code - val myMap = Map(1001 -> "rollNo='12'",1002 -> "rollNo='13'") val myHiveTableData = spark.table(<table_name>) val allOtherIngestedData = spark.createDataFrame(sc.emptyRDD[Row],rawDataHiveDf.schema) myMap.keys.foreach { i => val filteredDataDf = myHiveTableData.where(myMap(i)) val othersDf = myHiveTableData.except(filteredDataDf) allOtherIngestedData.union(othersDf) filteredDataDf