Changes between Version 4 and Version 5 of inputouput


Ignore:
Timestamp:
11/23/2012 12:05:02 PM (13 years ago)
Author:
liaojiaohe
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • inputouput

    v4 v5  
    2525可以将文件以行为单位进行split,比如文件的每一行对应一个map。得到的key是每一行的位置(偏移量,LongWritable类型),value是每一行的内容,Text类型。 
    2626 
    27 CompositeInputFormat,用于多个数据源的join。[[BR]] 
     27CompositeInputFormat,用于多个数据源的join。(可以参考hadoop例子join)[[BR]] 
    2828 
    2929ZipFileInputFormat[[BR]] 
     
    3131 
    3232 
    33 '''用关系数据库:''' 
     33'''用关系数据库:'''[[BR]] 
     34 
    3435DBInputFormat[[BR]] 
    3536 
    3637对mysql支持比较好,1.0.3版对oracle时候split有问题,具体是[[BR]] 
    3738OracleDBRecordReader 这个类 84行       if (split.getLength() > 0 && split.getStart() > 0){ 这个判断有问题,第一个split start值就是为0,要去掉[[BR]] 
     39 
     40使用DBInputformat要给一个读数据的sql和读总数的sql过去,用户map分割 
     41{{{ 
     42                DBInputFormat.setInput(job, DataRecord.class, sql, countSql); 
     43}}} 
     44 
    3845 
    3946另外要增加驱动,jobtracker 机器上的hadoop/lib目录要放驱动,不用重启,[[BR]] 
     
    4653 
    4754 
    48 HBASE作为输入 
     55HBASE作为输入[[BR]] 
     56使用hbase输入比较简单,hadoop会根据表的region数定义map的数量 
     57{{{ 
     58       Scan scan = new Scan(); 
     59        scan.setCaching(500); 
     60        scan.setCacheBlocks(false); 
     61 
     62        TableMapReduceUtil.initTableMapperJob( 
     63                T_APP_DEVICE, // input table 
     64                scan, // Scan instance to control CF and attribute selection 
     65                MyMapper.class, // mapper class 
     66                null, // mapper output key 
     67                null, // mapper output value 
     68                job); 
     69}}}