Changes between Version 2 and Version 3 of waue/2011/0426_5
- Timestamp:
- Jul 19, 2011, 11:44:44 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
waue/2011/0426_5
v2 v3 4 4 案例實務 5 5 </big></big></big></div> <div style="text-align: center; color:#7E2217"><big style="font-weight: bold;"><big> 6 ITRI餐廳6 NCHC 餐廳 7 7 </big></big></div> 8 8 }}} … … 28 28 29 29 * 請先準備以下檔案 30 * /tmp/ itri/store.txt30 * /tmp/NCHC/store.txt 31 31 {{{ 32 32 #!text … … 38 38 39 39 * 請準備以下檔案,並將 income 資料夾上傳到hdfs 40 * /tmp/ itri/income/0202.txt40 * /tmp/NCHC/income/0202.txt 41 41 {{{ 42 42 #!text … … 50 50 hung:T04:P2:xxxxx 51 51 }}} 52 * /tmp/ itri/income/0203.txt52 * /tmp/NCHC/income/0203.txt 53 53 {{{ 54 54 #!text … … 61 61 * 上傳到 HDFS 62 62 {{{ 63 $ /opt/hadoop/bin/hadoop fs -put /tmp/ itri/income/ income63 $ /opt/hadoop/bin/hadoop fs -put /tmp/NCHC/income/ income 64 64 }}} 65 65 66 66 == 假設: == 67 67 68 目前有四間商店進駐 ITRI,分別為68 目前有四間商店進駐 NCHC ,分別為 69 69 70 70 位在第1區的GunLong,品項4項單價為<20,40,30,50> … … 79 79 == 1. 建立商店資料 == 80 80 81 [wiki:waue/2011/0425_ Itri1LoadFile Itri1LoadFile.java ],81 [wiki:waue/2011/0425_NCHC1LoadFile NCHC1LoadFile.java ], 82 82 83 83 || || Detail || Detail || Products || Products || Products || Products || Turnover || … … 89 89 90 90 {{{ 91 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri1LoadFile92 }}} 93 94 {{{ 95 create new table: Itri96 Put data :"GunLong" to Table: Itri's Detail:Name97 Put data :"01" to Table: Itri's Detail:Locate98 Put data :"20" to Table: Itri's Products:P199 Put data :"40" to Table: Itri's Products:P2100 Put data :"30" to Table: Itri's Products:P3101 Put data :"50" to Table: Itri's Products:P4102 103 Put data :"Esing" to Table: Itri's Detail:Name104 Put data :"02" to Table: Itri's Detail:Locate105 Put data :"50" to Table: Itri's Products:P1106 107 Put data :"SunDon" to Table: Itri's Detail:Name108 Put data :"03" to Table: Itri's Detail:Locate109 Put data :"40" to Table: Itri's Products:P1110 Put data :"30" to Table: Itri's Products:P2111 112 Put data :"StarBucks" to Table: Itri's Detail:Name113 Put data :"04" to Table: Itri's Detail:Locate114 Put data :"50" to Table: Itri's Products:P1115 Put data :"50" to Table: Itri's Products:P2116 Put data :"20" to Table: Itri's Products:P391 $ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC1LoadFile 92 }}} 93 94 {{{ 95 create new table: NCHC 96 Put data :"GunLong" to Table: NCHC's Detail:Name 97 Put data :"01" to Table: NCHC's Detail:Locate 98 Put data :"20" to Table: NCHC's Products:P1 99 Put data :"40" to Table: NCHC's Products:P2 100 Put data :"30" to Table: NCHC's Products:P3 101 Put data :"50" to Table: NCHC's Products:P4 102 103 Put data :"Esing" to Table: NCHC's Detail:Name 104 Put data :"02" to Table: NCHC's Detail:Locate 105 Put data :"50" to Table: NCHC's Products:P1 106 107 Put data :"SunDon" to Table: NCHC's Detail:Name 108 Put data :"03" to Table: NCHC's Detail:Locate 109 Put data :"40" to Table: NCHC's Products:P1 110 Put data :"30" to Table: NCHC's Products:P2 111 112 Put data :"StarBucks" to Table: NCHC's Detail:Name 113 Put data :"04" to Table: NCHC's Detail:Locate 114 Put data :"50" to Table: NCHC's Products:P1 115 Put data :"50" to Table: NCHC's Products:P2 116 Put data :"20" to Table: NCHC's Products:P3 117 117 118 118 }}} … … 120 120 == 2 計算單月每個品項的購買次數 == 121 121 122 [wiki:waue/2011/0425_ Itri2Count Itri2Count.java] ,123 124 {{{ 125 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri2Count122 [wiki:waue/2011/0425_NCHC2Count NCHC2Count.java] , 123 124 {{{ 125 $ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC2Count 126 126 }}} 127 127 … … 134 134 135 135 {{{ 136 > scan ' Itri'136 > scan 'NCHC' 137 137 ROW COLUMN+CELL 138 138 T01 column=Detail:Locate, timestamp=1265184360616, value=01 … … 172 172 == 3. 計算當天營業額 == 173 173 174 [wiki:waue/2011/0425_ Itri3CalculateMR Itri3CalculateMR.java],175 176 {{{ 177 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri3CalculateMR174 [wiki:waue/2011/0425_NCHC3CalculateMR NCHC3CalculateMR.java], 175 176 {{{ 177 $ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC3CalculateMR 178 178 }}} 179 179 … … 187 187 188 188 {{{ 189 > scan ‘ Itri’189 > scan ‘NCHC’ 190 190 ROW COLUMN+CELL 191 191 T01 column=Detail:Locate, timestamp=1265184360616, value=01 … … 225 225 226 226 == 4. 建立索引資料表 == 227 [wiki:waue/2011/0425_ Itri4SortTurnover Itri4SortTurnover.java]228 229 {{{ 230 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri4SortTurnover231 }}} 232 233 {{{ 234 > scan ' Itri-Sum'227 [wiki:waue/2011/0425_NCHC4SortTurnover NCHC4SortTurnover.java] 228 229 {{{ 230 $ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC4SortTurnover 231 }}} 232 233 {{{ 234 > scan 'NCHC-Sum' 235 235 ROW COLUMN+CELL 236 236 100T02 column=Turnover:Sum, timestamp=1265190782127, value=100 … … 248 248 == 4.b 產生最終報表 == 249 249 250 [wiki:waue/2011/0425_ Itri5ShowReport Itri5ShowReport.java]251 252 {{{ 253 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri5ShowReport 130250 [wiki:waue/2011/0425_NCHC5ShowReport NCHC5ShowReport.java] 251 252 {{{ 253 $ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC5ShowReport 130 254 254 }}} 255 255