Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

how to remove '()' from pig output(bag Format)

Expert Contributor

hello,

i want to store pig output in hive table. i have written pig job in .net sdk.

Pig output:

(aaa,101,1000)

(bbb,102,2000)

(ccc,103,3000)

but i want to store the output in following format:

aaa,101,1000

bbb,102,2000

ccc,103,3000

2 REPLIES 2

Hi @heta desai

I believe the outer braces doesnt represent bag. Normally in pig whenever you DUMP the output it will be displayed within "()".

Once you store the pig output in a file it wont show braces.

In case if you have any bag in a pig output then using FLATTEN to remove the bag and store it in a hive table.

Guru

Agreed. () are only when using DUMP to look at the data (and its structure). To prove this you can use PigStorage to HDFS and when you read the file you will not see the () .

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.