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

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.

主站蜘蛛池模板: 开阳县| 云霄县| 同仁县| 墨玉县| 江都市| 那曲县| 门源| 龙口市| 威信县| 东港市| 上杭县| 宜城市| 石景山区| 老河口市| 宣汉县| 化隆| 曲阳县| 封开县| 自贡市| 兰州市| 尖扎县| 永善县| 扬州市| 肃宁县| 商洛市| 洞口县| 佛教| 波密县| 茂名市| 柏乡县| 武汉市| 南投市| 报价| 绥宁县| 崇礼县| 株洲县| 马边| 西畴县| 涞源县| 师宗县| 唐海县|