场景描述
算法模型是 java 代码使用 spark-submit yarn cluster 运行的,输出结果存储在了 HDFS 上,可能因为数据结构比较复杂吧,所以没有选择将结果存储在 hive 表中。这样的话,当后期在从 HDFS 读取结果时就会遇到数据合并的问题。
比如:模型输出就是三行 json 数据。如下:
{
"description":"desc-1","id":"1","name":"name-1"}
{
"description":"desc-2","id":"2","name":"name-2"}
{
"description":"desc-3","id":"3","name":"name-3"}
同时在代码中设定存储文件为 /user/deployer/people-result ,但实际存储在 HDFS 上时的目录结构是这样的:
(base) [deployer@sh01 ~]$ hadoop fs -ls /user/deployer/people-result
Found 3 items
-rw-r--r-- 3 deployer supergroup 0 2022-07-05 18:44 /user/deployer/people-result/_SUCCESS
-rw-r--r-- 3 deployer supergroup 50 2022-07-05 18:44 /user/deployer/people-result/part-00000-3d314ceb-5fd4-4a13-9d16-da3c838aa13f-c0