wiki:waue/2012/0117

Version 4 (modified by waue, 12 years ago) (diff)

--

  • 資料夾
/tmp/ProductEmp/conf/store.txt 商品資訊檔
/tmp/ProductEmp/input/ 銷售紀錄資料夾
/tmp/ProductEmp/hdfs/ hadoop運算資料夾
/tmp/ProductEmp/out/ hadoop 輸出
/tmp/ProductEmp/result/db.js 最後結果檔

設定初始內容

  • /tmp/ProductEmp/conf/store.txt
    01 ; 微波爐 ; 3000
    02 ; 烤箱   ; 800
    03 ; 電暖氣 ; 1000
    04 ; 收音機 ; 300
    05 ; 冷氣機 ; 30000
    
  • /tmp/ProductEmp/input/0102.txt
    jazz:   01
    jazz:   02
    jazz:   02
    jazz:   03
    jazz:   05
    jazz:   01
    lia:    02
    lia:    03
    waue:   02
    shun:   02
    len:    02
    

運算後最後結果將會呈現

  • /tmp/ProductEmp/result/db.js
    var aDataSet = [
            ['01','微波爐','3000','2','6000'],
            ['02','烤箱','800','6','4800'],
            ['03','電暖氣','1000','3','3000'],
            ['04','收音機','300','0','0'],
            ['05','冷氣機','30000','1','30000']
    ];
    
    
               BufferedReader fi = new BufferedReader(
                                new FileReader(new File(file_in)));

                String line;
                while ((line = fi.readLine()) != null) {

                        String[] str = line.split(";");
                        int length = str.length -1;

                        for (int i = 0; i < length; i++) {
                                E2PutData.putData(table_name, str[0], family, "P" + (i+1),
                                                str[(i + 1)]);
                        }
                        System.out.println();
                }
                fi.close();


Attachments (3)