List scans = new ArrayList();
Scan scan1 = new Scan();
//这里可以定义其他的filter
scan1.setStartRow(firstRow1);
scan1.setStopRow(lastRow1);
scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table1);
scans.add(scan1);
Scan scan2 = new Scan();
scan2.setStartRow(firstRow2);
scan2.setStopRow(lastRow2);
scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table2);
scans.add(scan2);
TableMapReduceUtil.initTableMapperJob(scans,
TableMapper.class, Text.class, IntWritable.class, job);
HBase批量扫描示例
本文介绍如何在HBase中使用TableMapper进行批量数据扫描。通过创建Scan对象并设置起始行、结束行及表名属性,将多个Scan对象加入到ArrayList中,再通过TableMapReduceUtil初始化TableMapper作业。
225

被折叠的 条评论
为什么被折叠?



