How to print data without brackets using PIG Dump?

+1 vote

I was trying to find the average marks per branch in any college. 

I ran below Pig transformation script.

grunt> student = LOAD "/user/cloudera/User/student_details.txt" USING PigStorage(",") AS (rollNo:int, name:charArray, branch:charArray, marks:int);
grunt> student_group_branch = GROUP student By branch;
grunt> AverageMarks = ForEach student_group_branch GENERATE (student.branch, AVG(student.marks));
grunt> dump AverageMarks;

The result of dump command is as below

(({( CSE),( CSE),( CSE)},913.6666666666666))
(({( Civil),( Civil)},999.5))
(({( ECE),( ECE)},994.5))
(({( EEE),( EEE)},943.0))
grunt>

However, I was looking for the output as below

CSE, 913.66
Civil, 999.5
ECE, 994.5
EEE, 943.0

Could you please help in getting the desired Output?

Dec 18, 2018 in Big Data Hadoop by slayer
• 29,040 points
47 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Please refer to the below commands:

student = Load 'piginput' USING PigStorage(',') AS (rollNo:int, name:charArray, branch:charArray, marks:int);

groupstudent = group student by branch;

result = foreach groupstudent generate group, AVG(student.marks);

answered Dec 18, 2018 by Omkar
• 65,850 points

Related Questions In Big Data Hadoop

0 votes
1 answer

How to transfer data from Netezza to HDFS using Apache Sqoop?

Remove the --direct option. It gives issue ...READ MORE

answered Apr 23, 2018 in Big Data Hadoop by kurt_cobain
• 9,260 points
183 views
0 votes
1 answer

How to access Hadoop Data using REST service?

The REST API gateway for the Apache ...READ MORE

answered Sep 5, 2018 in Big Data Hadoop by Frankie
• 9,570 points
211 views
0 votes
1 answer

How to import PIG data into HBase?

Follow the below steps to do it: # ...READ MORE

answered Feb 14 in Big Data Hadoop by Omkar
• 65,850 points
61 views
0 votes
1 answer

How to load data from HDFS into pig relation?

Hey, To load data from HDFS to pig ...READ MORE

answered May 7 in Big Data Hadoop by Gitika
• 8,140 points
10 views
0 votes
1 answer

What do we exactly mean by “Hadoop” – the definition of Hadoop?

The official definition of Apache Hadoop given ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by Shubham
119 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 9,030 points
1,663 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 9,030 points
130 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
8,063 views
0 votes
1 answer

Hadoop Hive Hbase: How to insert data into Hbase using Hive (JSON file)?

You can use the get_json_object function to parse the ...READ MORE

answered Nov 15, 2018 in Big Data Hadoop by Omkar
• 65,850 points
236 views
0 votes
1 answer

How to securely transfer data from rdms to hdfs using sqoop?

Sqoop stores metadata in a repository and ...READ MORE

answered Dec 18, 2018 in Big Data Hadoop by Omkar
• 65,850 points
47 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.