我目前正在尝试将两个数据帧一起比较,以查看 pyspark 中的字段如何不匹配。我已经能够手动编写它,但我希望能够传递字段列表以确保帧在字段上不匹配。数据帧是相同的。
到目前为止我的代码是:
key_cols = ['team_link_uuid', 'team_sat_hash']
temp_team_sat = orig.select(*key_cols)
temp_team_sat_incremental = delta.select(*key_cols)
hash_field = ['team_sat_hash']
test_update_list = temp_team_sat.join(temp_team_sat_incremental, (temp_team_sat.team_link_uuid == temp_team_sat_incremental.team_link_uuid) & (temp_team_sat.team_sat_hash != temp_team_sat_incremental.team_sat_hash))
但是现在我需要能够获取我的列表(hash_field)并且能够确保一个或多个字段彼此不相等。