@Test public void testStartStopRow() throws Exception { final byte[] TABLENAME1 = Bytes.toBytes("testStartStopRow1"); final byte[] TABLENAME2 = Bytes.toBytes("testStartStopRow2"); final byte[] FAMILY = Bytes.toBytes("family"); final byte[] COLUMN1 = Bytes.toBytes("c1"); final byte[] ROW0 = Bytes.toBytes("row0"); final byte[] ROW1 = Bytes.toBytes("row1"); final byte[] ROW2 = Bytes.toBytes("row2"); HTable t1 = TEST_UTIL.createTable(TABLENAME1, FAMILY); HTable t2 = TEST_UTIL.createTable(TABLENAME2, FAMILY); Put p = new Put(ROW0); p.add(FAMILY, COLUMN1, COLUMN1); t1.put(p); p = new Put(ROW1); p.add(FAMILY, COLUMN1, COLUMN1); t1.put(p); p = new Put(ROW2); p.add(FAMILY, COLUMN1, COLUMN1); t1.put(p); CopyTable copy = new CopyTable(TEST_UTIL.getConfiguration()); assertEquals( 0, copy.run(new String[] { "--new.name=" + Bytes.toString(TABLENAME2), "--startrow=row1", "--stoprow=row2", Bytes.toString(TABLENAME1) })); Get g = new Get(ROW1); Result r = t2.get(g); assertEquals(1, r.size()); assertTrue(CellUtil.matchingQualifier(r.rawCells()[0], COLUMN1)); g = new Get(ROW0); r = t2.get(g); assertEquals(0, r.size()); g = new Get(ROW2); r = t2.get(g); assertEquals(0, r.size()); t1.close(); t2.close(); TEST_UTIL.deleteTable(TABLENAME1); TEST_UTIL.deleteTable(TABLENAME2); }
@Override public int run(String[] args) throws Exception { String[] otherArgs = new GenericOptionsParser(getConf(), args).getRemainingArgs(); Job job = createSubmittableJob(getConf(), otherArgs); if (job == null) return 1; return job.waitForCompletion(true) ? 0 : 1; }
CopyTable extends Configured implements Tool { @Override public int run(String[] args) throws Exception { String[] otherArgs = new GenericOptionsParser(getConf(), args).getRemainingArgs(); Job job = createSubmittableJob(getConf(), otherArgs); if (job == null) return 1; return job.waitForCompletion(true) ? 0 : 1; } }
CopyTable extends Configured implements Tool { @Override public int run(String[] args) throws Exception { String[] otherArgs = new GenericOptionsParser(getConf(), args).getRemainingArgs(); Job job = createSubmittableJob(getConf(), otherArgs); if (job == null) return 1; return job.waitForCompletion(true) ? 0 : 1; } CopyTable(Configuration conf); }
CopyTable extends Configured implements Tool { @Override public int run(String[] args) throws Exception { String[] otherArgs = new GenericOptionsParser(getConf(), args).getRemainingArgs(); Job job = createSubmittableJob(getConf(), otherArgs); if (job == null) return 1; return job.waitForCompletion(true) ? 0 : 1; } CopyTable(Configuration conf); static Job createSubmittableJob(Configuration conf, String[] args); static void main(String[] args); @Override int run(String[] args); }
CopyTable extends Configured implements Tool { @Override public int run(String[] args) throws Exception { String[] otherArgs = new GenericOptionsParser(getConf(), args).getRemainingArgs(); Job job = createSubmittableJob(getConf(), otherArgs); if (job == null) return 1; return job.waitForCompletion(true) ? 0 : 1; } CopyTable(Configuration conf); static Job createSubmittableJob(Configuration conf, String[] args); static void main(String[] args); @Override int run(String[] args);  }