* @throws Exception
*/
@Test
public void TestCopyString() throws Exception {
ReaderWriterProfiler.setProfilerOptions(null);
OrcLazyString lazyString = new OrcLazyString(new LazyStringTreeReader(0, 0) {
int getCalls = 0;
@Override
public Object get(long currentRow, Object previous) throws IOException {
if (getCalls == 0) {
return new Text("a");
}
throw new IOException("get should only be called once");
}
@Override
protected boolean seekToRow(long currentRow) throws IOException {
return true;
}
});
StringObjectInspector stringOI = (StringObjectInspector)
OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.stringTypeInfo);
OrcLazyString lazyString2 = (OrcLazyString) stringOI.copyObject(lazyString);
Assert.assertEquals("a", ((Text) lazyString.materialize()).toString());
Assert.assertEquals("a", ((Text) lazyString2.materialize()).toString());
}