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,050 points
53 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
• 67,120 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,240 points
232 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
319 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
• 67,120 points
100 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
• 19,720 points
21 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
153 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
• 10,110 points
2,057 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,110 points
198 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
10,521 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
• 67,120 points
409 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
• 67,120 points
63 views