티스토리 뷰

공부

[Hive] get json keys

seunggabi 승가비 2020. 7. 24. 19:44
SELECT 
  REGEXP_REPLACE(
    REGEXP_REPLACE(json,'\'(\\w+)\': \\w+,', '$1,')
      , '[{} ]', '')
FROM json_table

https://stackoverflow.com/questions/39771308/hive-query-to-get-json-keys

 

hive query to get json keys

I have json as below in hive, each json has different keys, I am thinking to get all keys and use get_json_object to get values. So, Is there hive query get json keys out of it? { "ts":"2016-07-

stackoverflow.com

 

'공부' 카테고리의 다른 글

[SQL] count distinct with conditions  (0) 2020.07.24
[Maven] build project without version  (0) 2020.07.24
[Hive] get json keys  (0) 2020.07.24
[Spark] from_unixtime & to_timestamp  (0) 2020.07.24
[Spark] dayofweek 1 ~ 7(monday ~ sunday)  (0) 2020.07.24
[Hive] change column  (0) 2020.07.13
댓글
댓글쓰기 폼