• No products in the cart.

301.4.7-Joins

Joins

  • Two Tables
Retail_invoice = LOAD '/Retail_invoice_hdfs' USING PigStorage('\t') as (uniq_idi:chararray, InvoiceNo:chararray, StockCode:chararray, Description:chararray,Quantity:INT);
DESCRIBE Retail_invoice;

Retail_Customer = LOAD '/Retail_Customer_hdfs' USING PigStorage('\t') as (uniq_idc:chararray, InvoiceDate:chararray, UnitPrice:INT, CustomerID:chararray,Country:chararray);
DESCRIBE Retail_Customer;

Left Outer Join

Left_join = JOIN Retail_invoice BY uniq_idi LEFT OUTER, Retail_Customer BY uniq_idc;
DESCRIBE Left_join;

DUMP Left_join;

Right Outer Join

Right_join = JOIN Retail_invoice BY uniq_idi RIGHT OUTER, Retail_Customer BY uniq_idc;
DESCRIBE Right_join;

DUMP Right_join;

Full Outer Join

Full_join = JOIN Retail_invoice BY uniq_idi FULL, Retail_Customer BY uniq_idc;
DESCRIBE Full_join;

DUMP Full_join;

Inner Join

Inner_join = JOIN Retail_invoice BY uniq_idi , Retail_Customer BY uniq_idc;
DESCRIBE Inner_join;

    DUMP Inner_join;

Storing the Results on Pig

  • Similar to exporting the analysis resultant table out of Pig
  • After the final analysis in pig we may have the final Relation in pig.
  • Store helps us to export the relation(resultant data) out of pig
  • STORE is the opposite of LOAD. We used LOAD for loading data from HDFS to a Relation
  • STORE is used for loading data from Relation to HDFS.
hadoop fs -ls /

STORE Inner_join INTO '/pig_Inner_join/' USING PigStorage (',');

hadoop fs -ls /

hadoop fs -rmr /pig_datsets

Check on http://localhost:50070/explorer.html#/

History

  • History helps us to see all the command we ran in order
history

 

19th November 2020

DV Analytics

DV Data & Analytics is a leading data science,  Cyber Security training and consulting firm, led by industry experts. We are aiming to train and prepare resources to acquire the most in-demand data science job opportunities in India and abroad.

Bangalore Center

DV Data & Analytics Bangalore Private Limited
#52, 2nd Floor:
Malleshpalya Maruthinagar Bengaluru.
Bangalore 560075
India
(+91) 9019 030 033 (+91) 8095 881 188
Email: info@dvanalyticsmds.com

Bhubneshwar Center

DV Data & Analytics Private Limited Bhubaneswar
Plot No A/7 :
Adjacent to Maharaja Cine Complex, Bhoinagar, Acharya Vihar
Bhubaneswar 751022
(+91) 8095 881 188 (+91) 8249 430 414
Email: info@dvanalyticsmds.com

top
© 2020. All Rights Reserved.