Changes between Version 2 and Version 3 of waue/2011/0426_5


Ignore:
Timestamp:
Jul 19, 2011, 11:44:44 AM (13 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2011/0426_5

    v2 v3  
    44案例實務
    55</big></big></big></div> <div style="text-align: center; color:#7E2217"><big style="font-weight: bold;"><big>
    6 ITRI  餐廳
     6NCHC  餐廳
    77</big></big></div>
    88}}}
     
    2828
    2929 * 請先準備以下檔案
    30    * /tmp/itri/store.txt
     30   * /tmp/NCHC/store.txt
    3131{{{
    3232#!text
     
    3838
    3939 * 請準備以下檔案,並將 income 資料夾上傳到hdfs
    40    * /tmp/itri/income/0202.txt
     40   * /tmp/NCHC/income/0202.txt
    4141{{{
    4242#!text
     
    5050hung:T04:P2:xxxxx
    5151}}}
    52    * /tmp/itri/income/0203.txt
     52   * /tmp/NCHC/income/0203.txt
    5353{{{
    5454#!text
     
    6161   * 上傳到 HDFS
    6262{{{
    63 $ /opt/hadoop/bin/hadoop fs -put /tmp/itri/income/ income
     63$ /opt/hadoop/bin/hadoop fs -put /tmp/NCHC/income/ income
    6464}}}
    6565
    6666 ==  假設: ==
    6767
    68 目前有四間商店進駐 ITRI ,分別為
     68目前有四間商店進駐 NCHC ,分別為
    6969
    7070位在第1區的GunLong,品項4項單價為<20,40,30,50>
     
    7979 == 1. 建立商店資料 ==
    8080
    81  [wiki:waue/2011/0425_Itri1LoadFile Itri1LoadFile.java ],
     81 [wiki:waue/2011/0425_NCHC1LoadFile NCHC1LoadFile.java ],
    8282
    8383 ||   || Detail  || Detail ||  Products ||  Products || Products  || Products   || Turnover ||
     
    8989
    9090{{{
    91 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri1LoadFile
    92 }}}
    93 
    94 {{{
    95 create new table: Itri
    96 Put data :"GunLong" to Table: Itri's Detail:Name
    97 Put data :"01" to Table: Itri's Detail:Locate
    98 Put data :"20" to Table: Itri's Products:P1
    99 Put data :"40" to Table: Itri's Products:P2
    100 Put data :"30" to Table: Itri's Products:P3
    101 Put data :"50" to Table: Itri's Products:P4
    102 
    103 Put data :"Esing" to Table: Itri's Detail:Name
    104 Put data :"02" to Table: Itri's Detail:Locate
    105 Put data :"50" to Table: Itri's Products:P1
    106 
    107 Put data :"SunDon" to Table: Itri's Detail:Name
    108 Put data :"03" to Table: Itri's Detail:Locate
    109 Put data :"40" to Table: Itri's Products:P1
    110 Put data :"30" to Table: Itri's Products:P2
    111 
    112 Put data :"StarBucks" to Table: Itri's Detail:Name
    113 Put data :"04" to Table: Itri's Detail:Locate
    114 Put data :"50" to Table: Itri's Products:P1
    115 Put data :"50" to Table: Itri's Products:P2
    116 Put data :"20" to Table: Itri's Products:P3
     91$ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC1LoadFile
     92}}}
     93
     94{{{
     95create new table: NCHC
     96Put data :"GunLong" to Table: NCHC's Detail:Name
     97Put data :"01" to Table: NCHC's Detail:Locate
     98Put data :"20" to Table: NCHC's Products:P1
     99Put data :"40" to Table: NCHC's Products:P2
     100Put data :"30" to Table: NCHC's Products:P3
     101Put data :"50" to Table: NCHC's Products:P4
     102
     103Put data :"Esing" to Table: NCHC's Detail:Name
     104Put data :"02" to Table: NCHC's Detail:Locate
     105Put data :"50" to Table: NCHC's Products:P1
     106
     107Put data :"SunDon" to Table: NCHC's Detail:Name
     108Put data :"03" to Table: NCHC's Detail:Locate
     109Put data :"40" to Table: NCHC's Products:P1
     110Put data :"30" to Table: NCHC's Products:P2
     111
     112Put data :"StarBucks" to Table: NCHC's Detail:Name
     113Put data :"04" to Table: NCHC's Detail:Locate
     114Put data :"50" to Table: NCHC's Products:P1
     115Put data :"50" to Table: NCHC's Products:P2
     116Put data :"20" to Table: NCHC's Products:P3
    117117
    118118}}}
     
    120120 == 2 計算單月每個品項的購買次數 ==
    121121
    122  [wiki:waue/2011/0425_Itri2Count Itri2Count.java] ,
    123 
    124 {{{
    125 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri2Count
     122 [wiki:waue/2011/0425_NCHC2Count NCHC2Count.java] ,
     123
     124{{{
     125$ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC2Count
    126126}}}
    127127
     
    134134
    135135{{{
    136 > scan 'Itri'
     136> scan 'NCHC'
    137137ROW                          COLUMN+CELL                                                                     
    138138 T01                         column=Detail:Locate, timestamp=1265184360616, value=01                         
     
    172172 == 3. 計算當天營業額 ==
    173173
    174  [wiki:waue/2011/0425_Itri3CalculateMR Itri3CalculateMR.java],
    175 
    176 {{{
    177 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri3CalculateMR
     174 [wiki:waue/2011/0425_NCHC3CalculateMR NCHC3CalculateMR.java],
     175
     176{{{
     177$ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC3CalculateMR
    178178}}}
    179179
     
    187187
    188188{{{
    189 > scan ‘Itri
     189> scan ‘NCHC
    190190ROW                          COLUMN+CELL                                                                     
    191191 T01                         column=Detail:Locate, timestamp=1265184360616, value=01                         
     
    225225
    226226 == 4. 建立索引資料表 ==
    227  [wiki:waue/2011/0425_Itri4SortTurnover Itri4SortTurnover.java]
    228 
    229 {{{
    230 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri4SortTurnover
    231 }}}
    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'
    235235ROW                          COLUMN+CELL                                                                     
    236236 100T02                      column=Turnover:Sum, timestamp=1265190782127, value=100                         
     
    248248 == 4.b 產生最終報表 ==
    249249
    250  [wiki:waue/2011/0425_Itri5ShowReport Itri5ShowReport.java]
    251 
    252 {{{
    253 $ /opt/hadoop/bin/hadoop jar ItriMenu.jar Itri5ShowReport 130
     250 [wiki:waue/2011/0425_NCHC5ShowReport NCHC5ShowReport.java]
     251
     252{{{
     253$ /opt/hadoop/bin/hadoop jar NCHCMenu.jar NCHC5ShowReport 130
    254254}}}
    255255