Skip to content

Commit

Permalink
Ensure reader is closed after being used
Browse files Browse the repository at this point in the history
  • Loading branch information
mx123 authored and ebyhr committed Jan 10, 2023
1 parent 17f34e4 commit e246ad5
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/trino-orc/src/test/java/io/trino/orc/TestOrcLz4.java
Expand Up @@ -45,35 +45,35 @@ public void testReadLz4()
assertEquals(orcReader.getCompressionKind(), LZ4);
assertEquals(orcReader.getFooter().getNumberOfRows(), 10_000);

OrcRecordReader reader = orcReader.createRecordReader(
try (OrcRecordReader reader = orcReader.createRecordReader(
orcReader.getRootColumn().getNestedColumns(),
ImmutableList.of(BIGINT, INTEGER, BIGINT),
OrcPredicate.TRUE,
DateTimeZone.UTC,
newSimpleAggregatedMemoryContext(),
INITIAL_BATCH_SIZE,
RuntimeException::new);
RuntimeException::new)) {
int rows = 0;
while (true) {
Page page = reader.nextPage();
if (page == null) {
break;
}
page = page.getLoadedPage();
rows += page.getPositionCount();

int rows = 0;
while (true) {
Page page = reader.nextPage();
if (page == null) {
break;
}
page = page.getLoadedPage();
rows += page.getPositionCount();

Block xBlock = page.getBlock(0);
Block yBlock = page.getBlock(1);
Block zBlock = page.getBlock(2);
Block xBlock = page.getBlock(0);
Block yBlock = page.getBlock(1);
Block zBlock = page.getBlock(2);

for (int position = 0; position < page.getPositionCount(); position++) {
BIGINT.getLong(xBlock, position);
INTEGER.getLong(yBlock, position);
BIGINT.getLong(zBlock, position);
for (int position = 0; position < page.getPositionCount(); position++) {
BIGINT.getLong(xBlock, position);
INTEGER.getLong(yBlock, position);
BIGINT.getLong(zBlock, position);
}
}
}

assertEquals(rows, reader.getFileRowCount());
assertEquals(rows, reader.getFileRowCount());
}
}
}

0 comments on commit e246ad5

Please sign in to comment.