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,310 points
995 views

1 answer to this question.

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
• 69,150 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,390 points
1,000 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,810 points
2,849 views
0 votes
1 answer

How to import PIG data into HBase?

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

answered Feb 15, 2019 in Big Data Hadoop by Omkar
• 69,150 points
917 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, 2019 in Big Data Hadoop by Gitika
• 65,970 points
1,309 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
1,113 views
+1 vote
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
• 11,380 points
8,033 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
• 11,380 points
1,366 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
66,803 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
• 69,150 points
1,883 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
• 69,150 points
587 views