* @throws Exception
*/
@Test
public void TestCopyBoolean() throws Exception {
ReaderWriterProfiler.setProfilerOptions(null);
OrcLazyBoolean lazyBoolean = new OrcLazyBoolean(new LazyBooleanTreeReader(0, 0) {
int nextCalls = 0;
@Override
public Object next(Object previous) throws IOException {
if (nextCalls == 0) {
return new BooleanWritable(true);
}
throw new IOException("next should only be called once");
}
@Override
protected boolean seekToRow(long currentRow) throws IOException {
return true;
}
});
BooleanObjectInspector booleanOI = (BooleanObjectInspector)
OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.booleanTypeInfo);
OrcLazyBoolean lazyBoolean2 = (OrcLazyBoolean) booleanOI.copyObject(lazyBoolean);
Assert.assertEquals(true, ((BooleanWritable) lazyBoolean.materialize()).get());
Assert.assertEquals(true, ((BooleanWritable) lazyBoolean2.materialize()).get());
}