How to write 'foreach' statement for bag datatype in pig scripts?
Answer Posted / Raju Shah
'FOREACH' statement can be used with the bag data type to process each element individually.nSyntax: FOREACH bag_name GENERATED_FOR ALL x GENERATED BY bag_name.x;nInside the 'GENERATED BY' clause, replace 'bag_name.x' with the name of the field inside the bag.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers