Skip to content

Commit

Permalink
Add more checks to OrcTester.assertFileContentsPresto
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasmanova committed Sep 5, 2019
1 parent 2de28d2 commit 6cffd16
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -599,25 +599,30 @@ private static void assertFileContentsPresto(
break;
}

if (page.getPositionCount() == 0) {
int positionCount = page.getPositionCount();
if (positionCount == 0) {
continue;
}

assertTrue(expectedValues.get(0).size() >= rowsProcessed + positionCount);

for (int i = 0; i < types.size(); i++) {
Type type = types.get(i);
Block block = page.getBlock(i);

List<Object> data = new ArrayList<>(block.getPositionCount());
for (int position = 0; position < block.getPositionCount(); position++) {
assertEquals(block.getPositionCount(), positionCount);

List<Object> data = new ArrayList<>(positionCount);
for (int position = 0; position < positionCount; position++) {
data.add(type.getObjectValue(SESSION, block, position));
}

for (int j = 0; j < block.getPositionCount(); j++) {
for (int j = 0; j < positionCount; j++) {
assertColumnValueEquals(type, data.get(j), expectedValues.get(i).get(rowsProcessed + j));
}
}

rowsProcessed += page.getPositionCount();
rowsProcessed += positionCount;
}

assertEquals(rowsProcessed, expectedValues.get(0).size());
Expand Down

0 comments on commit 6cffd16

Please sign in to comment.