Changes between Version 4 and Version 5 of inputouput
- Timestamp:
- 11/23/2012 12:05:02 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
inputouput
v4 v5 25 25 可以将文件以行为单位进行split,比如文件的每一行对应一个map。得到的key是每一行的位置(偏移量,LongWritable类型),value是每一行的内容,Text类型。 26 26 27 CompositeInputFormat,用于多个数据源的join。 [[BR]]27 CompositeInputFormat,用于多个数据源的join。(可以参考hadoop例子join)[[BR]] 28 28 29 29 ZipFileInputFormat[[BR]] … … 31 31 32 32 33 '''用关系数据库:''' 33 '''用关系数据库:'''[[BR]] 34 34 35 DBInputFormat[[BR]] 35 36 36 37 对mysql支持比较好,1.0.3版对oracle时候split有问题,具体是[[BR]] 37 38 OracleDBRecordReader 这个类 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 38 45 39 46 另外要增加驱动,jobtracker 机器上的hadoop/lib目录要放驱动,不用重启,[[BR]] … … 46 53 47 54 48 HBASE作为输入 55 HBASE作为输入[[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 }}}
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)