Definition en Francais
ensuite être utilisé directement au sein du langage.
Par rapport au SQL, Pig: Fr
Utilise l'évaluation paresseuse,
utilise des extract, transform, load (ETL),
est capable de stocker des données à tout moment pendant un pipeline,
déclare le plan d'exécution,
exécute le workflow subdivisé selon un graphe, au lieu d'une exécution
purement séquentielle.
Avantage de Pig… Fr
paradigme du pipeline tandis que SQL est plutôt déclaratif.
aspects de l'implémentation à utiliser dans l'exécution d'un script de plusieurs façons
La programmation Pig Latin est similaire à la spécification d'un plan
SQL est orienté autour de requêtes qui produisent un résultat unique. Il gère
Latin décrit un Graphe orienté acyclique (DAG) plutôt qu'un pipeline
Advertisement
dans la base de données, avant que l'on puisse lancer un processus de nettoyage et de transformation de celles-ci
Why Pig?
Writing mappers and reducers by hand takes a long time.
Pig introduces Pig Latin, a scripting language that lets you use SQL-like syntax to define your map and reduce steps.
Highly extensible with user-defined functions (UDF’s)
| Col1 | Col2 |
|---|---|
| MapReduce | |
| YARN | YARN |
HDFS
Running Pig
Grunt
Script
Ambari / Hue
An example
(660,229,2,891406212) (421,498,4,892241344) (495,1091,4,888637503) (806,421,4,882388897) (676,538,4,892685437) (721,262,3,877137285)
Advertisement
FILTER
(12,4.385767790262173) (22,4.151515151515151) (23,4.1208791208791204) (45,4.05)
Putting it all together
Let’s run it
Pig Latin: Diving Deeper Things you can do to a relation
- LOAD STORE DUMP
- STORE ratings INTO ‘outRatings’ USING PigStorage(‘:’);
JOIN COGROUP GROUP CROSS CUBE
ORDER RANK LIMIT
UNION SPLIT
Diagnostics
DESCRIBE
EXPLAIN
ILLUSTRATE
Advertisement
UDF’s
REGISTER
DEFINE
IMPORT
Some other functions and loaders
AVG CONCAT COUNT MAX MIN SIZE SUM
PigStorage
TextLoader
JsonLoader
AvroStorage
ParquetLoader
OrcStorage
HBaseStorage
Advertisement
Learning more
Defining the problem
Find all movies with an average rating less than 2.0
Sort them by the total number of ratings
Hint
ratings greater than 4.0
items in a bag.
from a bag of ratings,
a given group’s bag.