Source:
<code>public void testScanLimit() throws Exception { setupCluster(); final TableName tableName = TableName.valueOf(name.getMethodName()); final String snapshotName = tableName + "Snapshot"; Table table = null; try { UTIL.getConfiguration().setInt(SNAPSHOT_INPUTFORMAT_ROW_LIMIT_PER_INPUTSPLIT, 10); if (UTIL.getAdmin().tableExists(tableName)) { UTIL.deleteTable(tableName); } UTIL.createTable(tableName, FAMILIES, new byte[][] { bbb, yyy }); Admin admin = UTIL.getAdmin(); int regionNum = admin.getRegions(tableName).size(); table = UTIL.getConnection().getTable(tableName); UTIL.loadTable(table, FAMILIES); Path rootDir = CommonFSUtils.getRootDir(UTIL.getConfiguration()); FileSystem fs = rootDir.getFileSystem(UTIL.getConfiguration()); SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName, Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true); Job job = new Job(UTIL.getConfiguration()); Path tmpTableDir = UTIL.getDataTestDirOnTestFS(snapshotName); <START> Scan scan = new Scan().setLimit(10); <END> TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(), TestTableSnapshotInputFormat.class); TableMapReduceUtil.initTableSnapshotMapperJob(snapshotName, scan, RowCounter.RowCounterMapper.class, NullWritable.class, NullWritable.class, job, true, tmpTableDir); Assert.assertTrue(job.waitForCompletion(true)); Assert.assertEquals(10 * regionNum, job.getCounters().findCounter(RowCounter.RowCounterMapper.Counters.ROWS).getValue()); } finally { if (table != null) { table.close(); } UTIL.getConfiguration().unset(SNAPSHOT_INPUTFORMAT_ROW_LIMIT_PER_INPUTSPLIT); UTIL.getAdmin().deleteSnapshot(snapshotName); UTIL.deleteTable(tableName); tearDownCluster(); } }</code><technical_language>needed</technical_language>

Target:
public void testScanLimit() throws Exception { setupCluster(); final TableName tableName = TableName.valueOf(name.getMethodName()); final String snapshotName = tableName + "Snapshot"; Table table = null; try { UTIL.getConfiguration().setInt(SNAPSHOT_INPUTFORMAT_ROW_LIMIT_PER_INPUTSPLIT, 10); if (UTIL.getAdmin().tableExists(tableName)) { UTIL.deleteTable(tableName); } UTIL.createTable(tableName, FAMILIES, new byte[][] { bbb, yyy }); Admin admin = UTIL.getAdmin(); int regionNum = admin.getRegions(tableName).size(); table = UTIL.getConnection().getTable(tableName); UTIL.loadTable(table, FAMILIES); Path rootDir = CommonFSUtils.getRootDir(UTIL.getConfiguration()); FileSystem fs = rootDir.getFileSystem(UTIL.getConfiguration()); SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName, Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true); Job job = new Job(UTIL.getConfiguration()); Path tmpTableDir = UTIL.getDataTestDirOnTestFS(snapshotName); Scan scan = new Scan(); TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(), TestTableSnapshotInputFormat.class); TableMapReduceUtil.initTableSnapshotMapperJob(snapshotName, scan, RowCounter.RowCounterMapper.class, NullWritable.class, NullWritable.class, job, true, tmpTableDir); Assert.assertTrue(job.waitForCompletion(true)); Assert.assertEquals(10 * regionNum, job.getCounters().findCounter(RowCounter.RowCounterMapper.Counters.ROWS).getValue()); } finally { if (table != null) { table.close(); } UTIL.getConfiguration().unset(SNAPSHOT_INPUTFORMAT_ROW_LIMIT_PER_INPUTSPLIT); UTIL.getAdmin().deleteSnapshot(snapshotName); UTIL.deleteTable(tableName); tearDownCluster(); } }