| 1 | ◢ <[wiki:Hinet131105/Lab16 實作十六]> | <[wiki:Hinet131105 回課程大綱]> ▲ | <[wiki:Hinet131105/Lab18 實作十八]> ◣ |
| 2 | |
| 3 | = 實作十七 Lab17 = |
| 4 | |
| 5 | {{{ |
| 6 | #!html |
| 7 | <p style="text-align: center;"><big style="font-weight: bold;"><big>將 WordCount 範例改成三個公開的類別<br/>Inner Class v.s. Public Classes </big></big></p> |
| 8 | }}} |
| 9 | |
| 10 | [[PageOutline]] |
| 11 | |
| 12 | {{{ |
| 13 | #!text |
| 14 | 請先連線至 nodeN.3du.me , N 為您的報名編號 |
| 15 | }}} |
| 16 | |
| 17 | * 在前兩個範例中,我們可以發現 WordCount 範例程式都是以所謂的 Inner Class 語法撰寫而成,那是否可以改寫成多個 Public Class 呢?答案是可以的! |
| 18 | {{{ |
| 19 | cd ~/hadoop_labs/lab009 |
| 20 | ant |
| 21 | hadoop fs -rmr input output |
| 22 | hadoop fs -put ~/hadoop/conf input |
| 23 | hadoop jar WordCount.jar input output |
| 24 | hadoop fs -ls output |
| 25 | hadoop fs -cat output/part-r-00000 |
| 26 | }}} |
| 27 | |
| 28 | == 實作習題 == |
| 29 | |
| 30 | <問題 1> 請比較 ${HOME}/hadoop_labs/lab007/class 與 ${HOME}/hadoop_labs/lab009/class 的內容,以下哪幾個陳述是正確的?(複選) |
| 31 | {{{ |
| 32 | #!text |
| 33 | (A) Only in ${HOME}/hadoop_labs/lab009/class/: IntSumReducer.class |
| 34 | (B) Only in ${HOME}/hadoop_labs/lab009/class/: TokenizerMapper.class |
| 35 | (C) Only in ${HOME}/hadoop_labs/lab007/class/: WordCount$IntSumReducer.class |
| 36 | (D) Only in ${HOME}/hadoop_labs/lab007/class/: WordCount$TokenizerMapper.class |
| 37 | (D) Only in ${HOME}/hadoop_labs/lab007/class/: WordCount.class |
| 38 | }}} |
| 39 | |
| 40 | <問題 2> 請問執行任務時,同時有幾個 Mapper? |
| 41 | {{{ |
| 42 | #!text |
| 43 | (A) 0 |
| 44 | (B) 同 input 目錄檔案區塊個數 |
| 45 | }}} |
| 46 | |
| 47 | <問題 3> 請問執行任務時,同時有幾個 Reducer? |
| 48 | {{{ |
| 49 | #!text |
| 50 | (A) 0 |
| 51 | (B) 1 |
| 52 | (C) 2 |
| 53 | (D) 3 |
| 54 | }}} |
| 55 | |
| 56 | <問題 4> 請問執行任務時,同一個 Map Task 會有幾個 Task Attempt? |
| 57 | {{{ |
| 58 | #!text |
| 59 | (A) 0 |
| 60 | (B) 1 個(含)以上 |
| 61 | }}} |