简体   繁体   中英

Apache Pig: merge nested bags to one bag

How can I merge a nested bag in Pig?

like

{{item1, item2}, {item3, item4}, {item5, item6}} 

to

{item1, item2, item3, item4, item5, item6} 

Just calling on flatten on multiple bags would create a cross-product. For your case, you probably need to convert the bags to tuple and then unnest the tuple by calling flatten. http://pig.apache.org/docs/r0.17.0/func.html#bagtotuple

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