gpt4 book ai didi

json - 从非嵌套的 json 数据文件创建配置单元表给出的输出为 null

转载 作者:可可西里 更新时间:2023-11-01 14:51:25 26 4
gpt4 key购买 nike

我正在尝试从 hdfs 中存在的 json 文件创建一个 Hive 表(“desiredtable”)。
以下是我遵循的步骤:

最初我已将 hive-serdes-1.0-SNAPSHOT.jar 复制到 hive/lib 文件夹中。

1.  add jar /usr/local/hive/lib/hive-serdes-1.0-SNAPSHOT.jar;
2. create external table sample_data (reviewerID string , reviewText string )
row format serde 'com.cloudera.hive.serde.JsonSerDe'
location '/dataset';
3. create table desiredtable as select * from sample_data;
4. select * from desiredtable ;

但是在执行第 4 步时,它会返回空值,如下面的 [image][1] 所示。
Json数据格式如下:

{
"reviewerID": "A00000262KYZUE4J55XGL",
"asin": "B003UYU16G",
"reviewerName": "Steven N Elich",
"helpful": [0, 0],
"reviewText": "It is and does exactly what the description said it would be and would do. Couldn't be happier with it.",
"overall": 5.0,
"summary": "Does what it's supposed to do",
"unixReviewTime": 1353456000,
"reviewTime": "11 21, 2012"
}

{
"reviewerID": "A000008615DZQRRI946FO",
"asin": "B005FYPK9C",
"reviewerName": "mj waldon",
"helpful": [0, 0],
"reviewText": "I was sketchy at first about these but once you wear them for a couple hours they break in they fit good on my board an have little wear from skating in them. They are a little heavy but won't get eaten up as bad by your grip tape like poser dc shoes.",
"overall": 5.0,
"summary": "great buy",
"unixReviewTime": 1357603200,
"reviewTime": "01 8, 2013"
}

请指导我犯了什么错误?

最佳答案

这是一个区分大小写的问题。SQL 列不区分大小写,但 JSON 键不区分大小写。

您需要在 JSON 键中使用小写。

旧的 Hive 版本不支持 JSON Key 中的大小写混合。

https://github.com/rcongiu/Hive-JSON-Serde/issues/4

关于json - 从非嵌套的 json 数据文件创建配置单元表给出的输出为 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47071751/

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