Introduction and installation of Chao Wu teacher course--pig

Source: Internet
Author: User

1.Pig is a data processing framework based on Hadoop.  
MapReduce is developed using Java, and Pig has its own data processing language, and the pig's processing process is converted to Mr to run.

The Data Processing language of 2.Pig is the way of traffic, similar to the maths problem in junior middle School. Step-by-step, and SQL is not the same,SQL one step to get the answer ,


3.Pig Basic data types: int, long, float, double, chararry, ByteArray
    
composite data types:Map, Tuple, Bag
the type of bag such as {(' age ', +), (' name ', ' Zhang San ')}


4. How to install pig
4.1 Copy the pig-0.11.1.tar.gz to the/usr/local .
4.2 Using the command TAR-ZXVF pig-0.11.1.tar.gz decompression
4.3 using the command MV pig-0.11.1 Pig to rename
4.4 Editing a file Vi/etc/profile setting environment variables 
Export $PIG _home=/usr/local/bin 
Export PATH = ... $PIG _home/bin ....  
save, and then execute Source/etc/profile
4.5 Edit File $pig_home/conf/pig.properties, add two lines as follows   
fs.default.name=hdfs://hadoop0:9000 
mapred.job.tracker=hadoop0:9001


5. How the WLAN data is analyzed with pig
5.1 uploading pending data to HDFs
5.2 Convert data in HDFs to a pattern that pig can handle  
A = LOAD '/wlan ' as (T0:long, Msisdn:chararray, T2:chararray, T3:chararray, T4:chararray, T5:chararray, T6: Long, T7:long, T8:long,t9:long,t10:chararray);

5.3 Extract the useful fields from the inside 
B = FOREACH A GENERATE MSISDN, T6, T7, T8, T9;

5.4 Grouping Data
C = GROUP B by MSISDN;

5.5 Traffic Summary
D = FOREACH C GENERATE Group, sum (B.T6), sum (B.T7), sum (B.T8), sum (B.T9);

5.6 Store in HDFs
STORE D into '/wlan_result ';

Introduction and installation of Chao Wu teacher course--pig

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.