You are on page 1of 7

NAME: KRITTIKA ROY SAP: 60002190056 E21 BATCH

Experiment No: 2

PIG LATIN COMMANDS


AIM:
To perform basic PIG LATIN commands.

Theory:

Apache Pig a tool/platform which is used to analyze large datasets and perform long series of data operations.
Pig is used with Hadoop. All pig scripts internally get converted into map-reduce tasks and then get executed. It can
handle structured, semi-structured and unstructured data. Pig stores, its result into HDFS.

All the scripts written in Pig-Latin over grunt shell go to the parser for checking the syntax and other
miscellaneous checks also happens. The output of the parser is a DAG. This DAG then gets passed to
Optimizer, which then performs logical optimization such as projection and pushes down. Then compiler
compiles the logical plan to MapReduce jobs. Finally, these MapReduce jobs are submitted to Hadoop in sorted order.
These jobs get executed and produce the desired results.Pig-Latin data model is fully nested, and it allows
complex data types such as map and tuples.
Any single value of Pig Latin language (irrespective of datatype) is known as Atom .

Commands
Load
Dump
Describe
Order by
Group by
Filter
Cross
Join
Limit
foreach

1
Results:

1. Creating directory and file and moving to pig

2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
2.
Creating tables and dbs:

1
3.

1
1
DESCRIBE COMMAND AND GROUP:

GROUP BY EID:

CROSS PRODUCT:

1
JOIN:

ILLUSTRATE:

GROUP BY SUM:

1
SUM OF SALARY BY EMP ID:

Conclusion:
In this experiment we learnt various pig commands and implementation of joins, groups. We
also learnt how to create a database and table in hive/pig and use commands like
Load,Dump, Describe, Order by, Group by, Filter, Cross, Join, Limit, foreach.

You might also like