@Override public void close() { tableSplitReader.close(); } }
@Override public VALUE getCurrentRecord() throws InterruptedException { return splitReader.getCurrentValue(); }
@Override public void initialize(Split split) throws InterruptedException { delegate.initialize(split); nextKey = null; nextValue = null; }
@Override public void apply() throws Exception { List<Split> splits = records.getSplits(1, null, rowkey); List<Record> recordsRead = new ArrayList<>(); for (Split split : splits) { SplitReader<byte[], Record> splitReader = records.createSplitReader(split); try { splitReader.initialize(split); while (splitReader.nextKeyValue()) { recordsRead.add(splitReader.getCurrentValue()); } } finally { splitReader.close(); } } Assert.assertEquals(0, recordsRead.size()); } });
private void verifySplits(KeyValueTable t, List<Split> splits, SortedSet<Long> keysToVerify) throws InterruptedException { // read each split and verify the keys, remove all read keys from the set for (Split split : splits) { SplitReader<byte[], byte[]> reader = t.createSplitReader(split); reader.initialize(split); while (reader.nextKeyValue()) { byte[] key = reader.getCurrentKey(); byte[] value = reader.getCurrentValue(); // verify each row has the two columns written Assert.assertArrayEquals(key, value); Assert.assertTrue(keysToVerify.remove(Bytes.toLong(key))); } } // verify all keys have been read if (!keysToVerify.isEmpty()) { System.out.println("Remaining [" + keysToVerify.size() + "]: " + keysToVerify); } Assert.assertTrue(keysToVerify.isEmpty()); }
@Override public boolean nextKeyValue() throws InterruptedException { boolean hasNext = delegate.nextKeyValue(); if (hasNext) { nextKey = convertKey(delegate.getCurrentKey()); nextValue = convertValue(delegate.getCurrentValue()); } return hasNext; }
@Override public boolean nextKeyValue() throws InterruptedException { return delegate.nextKeyValue(); }
@Override public RECORD getCurrentRecord() throws InterruptedException { return recordMaker.makeRecord(splitReader.getCurrentKey(), splitReader.getCurrentValue()); }
@Override public KEY getCurrentKey() throws IOException, InterruptedException { return splitReader.getCurrentKey(); }
@Override public float getProgress() throws InterruptedException { return splitReader.getProgress(); } };
@Override public void apply() throws Exception { List<Split> splits = records.getSplits(1, rowkey, null); List<Record> recordsRead = new ArrayList<>(); for (Split split : splits) { SplitReader<byte[], Record> splitReader = records.createSplitReader(split); try { splitReader.initialize(split); while (splitReader.nextKeyValue()) { recordsRead.add(splitReader.getCurrentValue()); } } finally { splitReader.close(); } } Assert.assertEquals(1, recordsRead.size()); Assert.assertEquals(record, recordsRead.get(0)); } });
private void verifySplits(ObjectStoreDataset<String> t, List<Split> splits, SortedSet<Long> keysToVerify) throws InterruptedException { // read each split and verify the keys, remove all read keys from the set for (Split split : splits) { SplitReader<byte[], String> reader = t.createSplitReader(split); reader.initialize(split); while (reader.nextKeyValue()) { byte[] key = reader.getCurrentKey(); String value = reader.getCurrentValue(); // verify each row has the two columns written Assert.assertEquals(Long.toString(Bytes.toLong(key)), value); Assert.assertTrue(keysToVerify.remove(Bytes.toLong(key))); } } // verify all keys have been read if (!keysToVerify.isEmpty()) { System.out.println("Remaining [" + keysToVerify.size() + "]: " + keysToVerify); } Assert.assertTrue(keysToVerify.isEmpty()); }
@Override public boolean nextRecord() throws InterruptedException { return splitReader.nextKeyValue(); }
@Override public KEY getCurrentKey() throws IOException, InterruptedException { return splitReader.getCurrentKey(); }
@Override public float getProgress() throws InterruptedException { return splitReader.getProgress(); } };
@Override public void close() { this.reader.close(); } }
@Override public void initialize(Split split) throws InterruptedException { tableSplitReader.initialize(split); }
@Override public boolean nextRecord() throws InterruptedException { return splitReader.nextKeyValue(); }
@Override public VALUE getCurrentValue() throws IOException, InterruptedException { return splitReader.getCurrentValue(); }
@Override public byte[] getCurrentKey() throws InterruptedException { return this.reader.getCurrentKey(); }