* @throws Exception
*/
@Test
public void TestCopyDouble() throws Exception {
ReaderWriterProfiler.setProfilerOptions(null);
OrcLazyDouble lazyDouble = new OrcLazyDouble(new LazyDoubleTreeReader(0, 0) {
int nextCalls = 0;
@Override
public Object next(Object previous) throws IOException {
if (nextCalls == 0) {
return new DoubleWritable(1.0);
}
throw new IOException("next should only be called once");
}
@Override
protected boolean seekToRow(long currentRow) throws IOException {
return true;
}
});
DoubleObjectInspector doubleOI = (DoubleObjectInspector)
OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.doubleTypeInfo);
OrcLazyDouble lazyDouble2 = (OrcLazyDouble) doubleOI.copyObject(lazyDouble);
Assert.assertEquals(1.0, ((DoubleWritable) lazyDouble.materialize()).get());
Assert.assertEquals(1.0, ((DoubleWritable) lazyDouble2.materialize()).get());
}