【发布时间】:2017-01-26 15:45:31
【问题描述】:
我有 2 个输入文件:
a) 一个原始文件 ( orig_file.json ),包含如下记录:
{"id": 1, "app": test_a, "description": test_app_a }
{"id": 2, "app": test_b, "description": test_app_b }
{"id": 3, "app": test_c, "description": test_app_c }
{"id": 4, "app": test_d, "description": test_app_d }
{"id": 5, "app": test_e, "description": test_app_e }
b) 一个“deltas”文件 (deltas_file.json),包含如下记录:
{"id": 1, "app": test_aaaxxx, "description": test_app_aaaxxx }
{"id": 6, "app": test_ffffff, "description": test_app_ffffff }
我正在尝试以这样的方式合并两个文件(原始文件 + deltas 文件)
{"id": 1, "app": test_aaaxxx, "description": test_app_aaaxxx }
{"id": 2, "app": test_b, "description": test_app_b }
{"id": 3, "app": test_c, "description": test_app_c }
{"id": 4, "app": test_d, "description": test_app_d }
{"id": 5, "app": test_e, "description": test_app_e }
{"id": 6, "app": test_ffffff, "description": test_app_ffffff }
*基本上通过添加任何新应用程序将原始文件与增量文件合并,并仅更新已存在的记录。 .
我尝试使用不同的连接,但无法获得解决方案。
有人可以指导我解决这个问题的方法吗? 谢谢
【问题讨论】:
标签: python pyspark pyspark-sql