From 6cffd165434308ffe0eb1a334ff73ff31581e597 Mon Sep 17 00:00:00 2001 From: Masha Basmanova Date: Wed, 4 Sep 2019 12:57:44 -0400 Subject: [PATCH] Add more checks to OrcTester.assertFileContentsPresto --- .../java/com/facebook/presto/orc/OrcTester.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java b/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java index 3dff769f08fdc..3dda174c04788 100644 --- a/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java +++ b/presto-orc/src/test/java/com/facebook/presto/orc/OrcTester.java @@ -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 data = new ArrayList<>(block.getPositionCount()); - for (int position = 0; position < block.getPositionCount(); position++) { + assertEquals(block.getPositionCount(), positionCount); + + List 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());