gpt4 book ai didi

json - 无法使用JSON Serde在Hive上上传JSON文件

转载 作者:行者123 更新时间:2023-12-02 20:27:20 25 4
gpt4 key购买 nike

我正在尝试使用json serde加载json文件。我已经成功添加了serde jar文件。

1)我的json jar文件放在路径/ apps / hive / warehouse / lib /
我已经成功运行了此命令

add jar hdfs:///apps/hive/warehouse/lib/json-serde-1.3-jar-with-dependencies.jar; converting to local hdfs:///apps/hive/warehouse/lib/json-serde-1.3-jar-with-dependencies.jar Added [/tmp/6f1a54b9-65c4-4e32-8e87-25d60ef775c6_resources/json-serde-1.3-jar-with-dependencies.jar] to class path Added resources: [hdfs:///apps/hive/warehouse/lib/json-serde-1.3-jar-with-dependencies.jar] 

2)现在,当我尝试在此路径/ apps / hive / warehouse / lib /或tmp /上载json文件时
使用ambari GUI。我无法上传,但出现错误500。请参见附件 error while uploading json file
3)我也尝试过此命令,但是因为我无法上传json文件。所以,它不起作用

hadoop fs -put tmp/test.json /apps/hive/warehouse/lib/test.json



请帮助我解决这个问题

最佳答案

要将文件加载到配置单元中,请首先将文件复制到HDFS位置。如下所示:

hadoop fs -put /complete_path_to_my_json/json_to_upload.json /app/hive/a_temp_location

然后,一旦您使用JSON SerDe创建了表,如下所示:
create table if not exists my_json_table (id int, name string, designation string) row format serde 'org.apache.hive.hcatalog.d.JsonSerDe';

您可以使用以下语句将数据加载到表中:
load data inpath '/app/hive/a_temp_location/json_to_upload.json' into table my_json_table;

关于json - 无法使用JSON Serde在Hive上上传JSON文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55625762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com