* @throws Exception
*/
@Test
public void TestCopyByte() throws Exception {
ReaderWriterProfiler.setProfilerOptions(null);
OrcLazyByte lazyByte = new OrcLazyByte(new LazyByteTreeReader(0, 0) {
int nextCalls = 0;
@Override
public Object next(Object previous) throws IOException {
if (nextCalls == 0) {
return new ByteWritable((byte) 1);
}
throw new IOException("next should only be called once");
}
@Override
protected boolean seekToRow(long currentRow) throws IOException {
return true;
}
});
ByteObjectInspector byteOI = (ByteObjectInspector)
OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.byteTypeInfo);
OrcLazyByte lazyByte2 = (OrcLazyByte) byteOI.copyObject(lazyByte);
Assert.assertEquals(1, ((ByteWritable) lazyByte.materialize()).get());
Assert.assertEquals(1, ((ByteWritable) lazyByte2.materialize()).get());
}