* @throws Exception
*/
@Test
public void TestCopyFloat() throws Exception {
ReaderWriterProfiler.setProfilerOptions(null);
OrcLazyFloat lazyFloat = new OrcLazyFloat(new LazyFloatTreeReader(0, 0) {
int nextCalls = 0;
@Override
public Object next(Object previous) throws IOException {
if (nextCalls == 0) {
return new FloatWritable(1.0f);
}
throw new IOException("next should only be called once");
}
@Override
protected boolean seekToRow(long currentRow) throws IOException {
return true;
}
});
FloatObjectInspector floatOI = (FloatObjectInspector)
OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.floatTypeInfo);
OrcLazyFloat lazyFloat2 = (OrcLazyFloat) floatOI.copyObject(lazyFloat);
Assert.assertEquals(1.0f, ((FloatWritable) lazyFloat.materialize()).get());
Assert.assertEquals(1.0f, ((FloatWritable) lazyFloat2.materialize()).get());
}