grunt> Emp_grouped = GROUP Emp BY salary;
grunt> DUMP Emp_grouped;
Hadoop Basic PIG Commands with Examples, are you looking for a list of Top Rated Pig commands in Hadoop examples? Or the one who is casually glancing for the best platform which is listing the Top-rated Hadoop pig script commands with examples for beginners? Then you’ve landed on the Right Platform which is packed with Tons of Tutorials of Pig commands for Hadoop. Follow the below mentioned Pig commands in Hadoop which were originally designed by the world-class Trainers of Big Data Training institute Professionals.
If you are the one who is a hunger to become the certified Pro Hadoop Developer? Or the one who is looking for the best Hadoop Training institute which offering advanced tutorials and Hadoop certification course to all the Tech Enthusiasts who are eager to learn the technology from 0 Level to Advanced Level.
Inner Join: Joining two table having a common column
Left Outer: The left outer Join operation returns all rows from the left table, even if there are no matches in the right relation
Right Outer: The right outer join operation returns all rows from the right table, even if there are no matches in the left table.
Cross: The CROSS operator computes the cross-product of two or more relations.
Union: The UNION operator of Pig Latin is used to merge the content of two relations.
Split: The split operator is used to split a relation into two or more relations.
grunt> Emp_grouped = GROUP Emp BY salary;
grunt> DUMP Emp_grouped;
Group Output:
One of the key uses of Pig is data transformation. You can define a new relation based on the fields of an existing relation using the FOREACH command
grunt> foreach_Emp = FOREACH Emp GENERATE id,name;
grunt> dump foreach_Emp;
Foreach Output:
which groups together tuples from multiple relations . It functions much like a join. For example, let’s Join Emp and Customer on the first column.
grunt> Emp_self = join Emp by id, Customer by id;
By default behavior of join as an outer join, and the join keyword can modify it to be left outer join, right outer join, or inner join.Another way to do inner join in Pig is to use the JOIN operator. Empcust_left = join Emp by id left outer, Customer by id;
grunt> dump Emp2_dist;
grunt> dump limit_data;
LIMIT Output: