Skip to content

Commit 39368b5

Browse files
cxzl25dongjoon-hyun
authored andcommitted
ORC-1630: Test using VectoredIO of hadoop to read ORC
### What changes were proposed in this pull request? This PR aims to test reading ORC using VectoredIO of hadoop. ### Why are the changes needed? ORC-1251 supports reading using VectoredIO, but no test coverage. ### How was this patch tested? Add UT ### Was this patch authored or co-authored using generative AI tooling? No Closes #1814 from cxzl25/ORC-1630. Authored-by: sychen <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent fb1c4cb commit 39368b5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java

+21
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
import static org.mockito.Mockito.doNothing;
9898
import static org.mockito.Mockito.doThrow;
9999
import static org.mockito.Mockito.mock;
100+
import static org.mockito.Mockito.spy;
100101
import static org.mockito.Mockito.times;
101102
import static org.mockito.Mockito.verify;
102103
import static org.mockito.Mockito.when;
@@ -2711,4 +2712,24 @@ public void testRowIndexStrideNegativeFilter() throws Exception {
27112712
base += batch.size;
27122713
}
27132714
}
2715+
2716+
@Test
2717+
public void testHadoopVectoredIO() throws Exception {
2718+
Configuration conf = new Configuration();
2719+
Path filePath = new Path(TestVectorOrcFile.getFileFromClasspath("orc-file-11-format.orc"));
2720+
2721+
FileSystem localFileSystem = FileSystem.getLocal(conf);
2722+
FSDataInputStream fsDataInputStream = localFileSystem.open(filePath);
2723+
2724+
FileSystem spyLocalFileSystem = spy(localFileSystem);
2725+
FSDataInputStream spyFSDataInputStream = spy(fsDataInputStream);
2726+
when(spyLocalFileSystem.open(filePath)).thenReturn(spyFSDataInputStream);
2727+
2728+
Reader reader = OrcFile.createReader(filePath,
2729+
OrcFile.readerOptions(conf).filesystem(spyLocalFileSystem));
2730+
RecordReader recordReader = reader.rows(reader.options());
2731+
recordReader.close();
2732+
2733+
verify(spyFSDataInputStream, atLeastOnce()).readVectored(any(), any());
2734+
}
27142735
}

0 commit comments

Comments
 (0)