Archives/Presto

Presto에서 JSON 다루기

gilbird 2016. 8. 12. 20:01

Presto 0.151 Documentation에 보면 JSON함수 이야기가 나온다.

내가 필요한 내용 위주로 다시 정리해 본다.



1. 일부 값 추출하기 

  • json_extract( json, json_path )
  • 예) json_extract( json, '$.root.child')


2. "a"인 경우 "제거한 a만 구하기

  • json_extract_scalar( json, json_path )
  • 예) json_extract_scalar( json, '$.root.child')


3. 사이즈 구하기

  • json_size( json, json_path)
  • 예) json_size( json, '$.root' )


나머지 함수에 대한 자료

https://prestodb.io/docs/current/functions/json.html