由于您没有提到逻辑的完整流程,我只是在下面添加逻辑以匹配两个表中的一列。
//load data for first dataframe.
val dfa = dfaData.withColumn("id",monotonically_increasing_id).withColumn("id",row_number().over(Window.partitionBy($"id").orderBy($"id".asc)))
//load data for second dataframe.
val dfb = dfbData.withColumn("id",monotonically_increasing_id).withColumn("id",row_number().over(Window.partitionBy($"id").orderBy($"id".asc)))
//Used cross join to match dfa columns to dfb columns.
dfa.crossJoin(dfb).withColumn("matched",when($"saltedgecategory" === $"name", lit("matched")).otherwise("not matched")).show(false)