简体   繁体   中英

How do I read in array of integers using JsonLoader in Pig Script?

I have a JSON file which has the following line in it

"helpful": [
    5,
    5
]

How do I read this in using a pig script without using any 3rd party library like elephant-bird which has been suggested here .

Closed ticket PIG-2949 show that support for such operation was added in pig version 0.15.0 but I am not sure to get the result.

Any help is appreciated.

Okay, I had some doubts about the syntax, this worked:

reviews = load 'filename.json'
          using JsonLoader('helpful:{t:(i:int)}');

dump reviews;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM