Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,36 @@ public void testStructTypeRead() throws Exception {
AutoCloseables.close(vsr, allocator);
}

@Test
public void testOrcStructTypeRead() throws Exception {
RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
FileSystemDatasetFactory factory = new FileSystemDatasetFactory(allocator,
NativeMemoryPool.getDefault(), OrcFileFormat.createDefault(), "file://" + resourcePath("data/struct_example.orc"));
ScanOptions options = new ScanOptions(new String[] {"_1"}, Filter.EMPTY, 100);
Schema schema = factory.inspect();
NativeDataset dataset = factory.finish(schema);
NativeScanner nativeScanner = dataset.newScan(options);
List<? extends ScanTask> scanTasks = collect(nativeScanner.scan());
Assert.assertEquals(1, scanTasks.size());
ScanTask scanTask = scanTasks.get(0);
ScanTask.BatchIterator itr = scanTask.execute();

VectorSchemaRoot vsr = VectorSchemaRoot.create(schema, allocator);
VectorLoader loader = new VectorLoader(vsr);
int rowCount = 0;
while (itr.hasNext()) {
try (ArrowRecordBatch next = itr.next()) {
loader.load(next);
}
rowCount += vsr.getRowCount();

}
Assert.assertEquals(50, rowCount);
assertEquals(1, schema.getFields().size());
assertEquals("_1", schema.getFields().get(0).getName());
AutoCloseables.close(vsr, allocator);
}

@Test
public void testStructTypeReadWithEmptyProjector() throws Exception {
RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
Expand Down
Binary file not shown.