private Page processBatch(PrestoThriftPageResult rowsBatch) { firstCall = false; nextToken = rowsBatch.getNextToken(); Page page = rowsBatch.toPage(columnTypes); if (page != null) { long pageSize = page.getSizeInBytes(); completedBytes += pageSize; stats.addScanPageSize(pageSize); } else { stats.addScanPageSize(0); } return page; }
private void testReadWrite(Random random, int records, Function<List<Block>, PrestoThriftPageResult> convert) { // generate columns data List<Block> inputBlocks = new ArrayList<>(columns.size()); for (ColumnDefinition column : columns) { inputBlocks.add(generateColumn(column, random, records)); } // convert column data to thrift ("write step") PrestoThriftPageResult batch = convert.apply(inputBlocks); // convert thrift data to page/blocks ("read step") Page page = batch.toPage(columns.stream().map(ColumnDefinition::getType).collect(toImmutableList())); // compare the result with original input assertNotNull(page); assertEquals(page.getChannelCount(), columns.size()); for (int i = 0; i < columns.size(); i++) { Block actual = page.getBlock(i); Block expected = inputBlocks.get(i); assertBlock(actual, expected, columns.get(i)); } }
checkState(resultContext != null, "no associated context for the request"); PrestoThriftPageResult pageResult = getFutureValue(resultFuture); Page page = pageResult.toPage(outputColumnTypes); if (page != null) { long pageSize = page.getSizeInBytes();
private void testReadWrite(Random random, int records, Function<List<Block>, PrestoThriftPageResult> convert) { // generate columns data List<Block> inputBlocks = new ArrayList<>(columns.size()); for (ColumnDefinition column : columns) { inputBlocks.add(generateColumn(column, random, records)); } // convert column data to thrift ("write step") PrestoThriftPageResult batch = convert.apply(inputBlocks); // convert thrift data to page/blocks ("read step") Page page = batch.toPage(columns.stream().map(ColumnDefinition::getType).collect(toImmutableList())); // compare the result with original input assertNotNull(page); assertEquals(page.getChannelCount(), columns.size()); for (int i = 0; i < columns.size(); i++) { Block actual = page.getBlock(i); Block expected = inputBlocks.get(i); assertBlock(actual, expected, columns.get(i)); } }