官术网_书友最值得收藏!

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are a few examples of these styles and an explanation of their meaning.

Code words in text are shown as follows: "From this point onward, we shall call the unpacked Hadoop directory HADOOP_HOME."

A block of code for UDFs written in Java is set as follows:

package com.pigdesignpatterns.myudfs;

public class DeIdentifyUDF extends EvalFunc<String> {

  @Override
  public String exec(Tuple input){

          try {
                String plainText = (String)input.get(0);
                String encryptKey = (String)input.get(1);
                String str="";
                str = encrypt(plainText,encryptKey.getBytes());
                return str;
              }
              catch (NullPointerException npe) {
                warn(npe.toString(), PigWarning.UDF_WARNING_2);
                return null;
              } catch (StringIndexOutOfBoundsException npe) {
                warn(npe.toString(), PigWarning.UDF_WARNING_3);
                return null;
              } catch (ClassCastException e) {
                warn(e.toString(), PigWarning.UDF_WARNING_4);
                return null;
              }

Pig Script is displayed as follows:

Users = load 'users' as (name, age); 
Fltrd = filter Users by
 age >= 18 and age <= 25; 
Pages = load 'pages' as (user, url); 
Jnd = join Fltrd by name, Pages by user; 
Grpd = group Jnd by url; 
Smmd = foreach Grpd generate group, 
COUNT(Jnd) as clicks; 
Srtd = order Smmd by clicks desc; 
Top5 = limit Srtd 5; 
store Top5 into 'top5sites'

Any command-line input or output is written as follows:

>tar -zxvf hadoop-1.x.x.tar.gz

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Clicking the Next button moves you to the next screen."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

主站蜘蛛池模板: 东山县| 龙山县| 安化县| 辽源市| 乐昌市| 平度市| 瑞金市| 长丰县| 永泰县| 鹤岗市| 塔城市| 望谟县| 迭部县| 休宁县| 连山| 房山区| 民丰县| 平原县| 双城市| 远安县| 额尔古纳市| 军事| 大方县| 广昌县| 丰原市| 永定县| 建水县| 新巴尔虎右旗| 惠州市| 精河县| 土默特右旗| 阳江市| 鄯善县| 应用必备| 临海市| 新宁县| 工布江达县| 高邮市| 沂水县| 菏泽市| 隆回县|