簡體   English   中英

Hive-從嵌套的Json中提取數據

[英]Hive - Extract data from nested Json

我有一個名為newdata的表

create external table newdata
(
data string
)
location 'something'

select data from string limit 1

{ "user": { "name": "default", "education": { "schoome": "abc", "college": "def" } } 

我需要將此結果顯示為

| 用戶| 名稱| 學校| 大學|

| -------- | --------- | ---------- | ----------- |

select  json_extract_scalar (data,'$.user.name')              as name
       ,json_extract_scalar (data,'$.user.education.school')  as school
       ,json_extract_scalar (data,'$.user.education.college') as college

from    newdata

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM