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,300 points
413 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,030 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,320 points
697 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
1,861 views
0 votes
1 answer

How to import PIG data into HBase?

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

answered Feb 14, 2019 in Big Data Hadoop by Omkar
• 69,030 points
446 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
• 41,120 points
585 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
786 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
• 10,950 points
6,068 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
• 10,950 points
924 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
38,933 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,030 points
1,360 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,030 points
349 views