@Override public boolean isFinished() { return pageSource.isFinished(); }
@Override public boolean isFinished() { return delegate.isFinished(); }
@Override public boolean isFinished() { return delegate.isFinished(); }
private static void skipPages(ConnectorPageSource pageSource, int skipPages) { for (int i = 0; i < skipPages; i++) { checkState(!pageSource.isFinished(), "pageSource is unexpectedly finished"); pageSource.getNextPage(); } }
@Override public boolean isFinished() { if (!finished) { finished = (source != null) && source.isFinished(); if (source != null) { systemMemoryContext.setBytes(source.getSystemMemoryUsage()); } } return finished; }
private static PrestoThriftPageResult getRowsInternal(ConnectorPageSource pageSource, String tableName, List<String> columnNames, @Nullable PrestoThriftId nextToken) { // very inefficient implementation as it needs to re-generate all previous results to get the next page int skipPages = nextToken != null ? Ints.fromByteArray(nextToken.getId()) : 0; skipPages(pageSource, skipPages); Page page = null; while (!pageSource.isFinished() && page == null) { page = pageSource.getNextPage(); skipPages++; } PrestoThriftId newNextToken = pageSource.isFinished() ? null : new PrestoThriftId(Ints.toByteArray(skipPages)); return toThriftPage(page, types(tableName, columnNames), newNextToken); }
public static MaterializedResult materializeSourceDataStream(ConnectorSession session, ConnectorPageSource pageSource, List<Type> types) { MaterializedResult.Builder builder = resultBuilder(session, types); while (!pageSource.isFinished()) { Page outputPage = pageSource.getNextPage(); if (outputPage == null) { break; } builder.page(outputPage); } return builder.build(); }
while (!pageSource.isFinished());
@Benchmark public List<Page> read(CompressionCounter counter) throws IOException { if (!fileFormat.supports(data)) { throw new RuntimeException(fileFormat + " does not support data set " + dataSet); } List<Page> pages = new ArrayList<>(100); try (ConnectorPageSource pageSource = fileFormat.createFileFormatReader( SESSION, HDFS_ENVIRONMENT, dataFile, data.getColumnNames(), data.getColumnTypes())) { while (!pageSource.isFinished()) { Page page = pageSource.getNextPage(); if (page != null) { pages.add(page.getLoadedPage()); } } } counter.inputSize += data.getSize(); counter.outputSize += dataFile.length(); return pages; }
int totalRows = 0; while (totalRows < 20000) { assertFalse(pageSource.isFinished()); Page page = pageSource.getNextPage(); assertNotNull(page); assertFalse(pageSource.isFinished()); Page page = pageSource.getNextPage(); assertNotNull(page); assertFalse(pageSource.isFinished()); Page page = pageSource.getNextPage(); assertNotNull(page); assertFalse(pageSource.isFinished()); assertNull(pageSource.getNextPage()); assertTrue(pageSource.isFinished()); assertEquals(pageSource.getSystemMemoryUsage(), 0); pageSource.close();
while (!pageSource.isFinished()) { Page nextPage = pageSource.getNextPage(); if (nextPage != null) {
private Page processPageSource() { DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); if (!finishing && mergingOutput.needsInput() && !yieldSignal.isSet()) { Page page = pageSource.getNextPage(); finishing = pageSource.isFinished(); pageSourceMemoryContext.setBytes(pageSource.getSystemMemoryUsage()); if (page != null) { page = recordProcessedInput(page); // update operator stats long endCompletedBytes = pageSource.getCompletedBytes(); long endReadTimeNanos = pageSource.getReadTimeNanos(); operatorContext.recordRawInputWithTiming(endCompletedBytes - completedBytes, endReadTimeNanos - readTimeNanos); completedBytes = endCompletedBytes; readTimeNanos = endReadTimeNanos; Iterator<Optional<Page>> output = pageProcessor.process(operatorContext.getSession().toConnectorSession(), yieldSignal, pageProcessorMemoryContext, page); mergingOutput.addInput(output); } if (finishing) { mergingOutput.finish(); } } Page result = mergingOutput.getOutput(); outputMemoryContext.setBytes(mergingOutput.getRetainedSizeInBytes() + pageProcessorMemoryContext.getBytes()); return result; }
@Override public boolean isFinished() { return pageSource.isFinished(); }
private static void skipPages(ConnectorPageSource pageSource, int skipPages) { for (int i = 0; i < skipPages; i++) { checkState(!pageSource.isFinished(), "pageSource is unexpectedly finished"); pageSource.getNextPage(); } }
private static Page getNextPage(ConnectorPageSource pageSource) { Page page = null; while (isNullOrEmptyPage(page) && !pageSource.isFinished()) { page = pageSource.getNextPage(); if (page != null) { page = page.getLoadedPage(); } } return page; }
@Override public final boolean isFinished() { if (!finishing) { createSourceIfNecessary(); } if (pageSource != null && pageSource.isFinished() && currentPage == null) { finishing = true; } return finishing && pageBuilder.isEmpty(); }
@Override public boolean isFinished() { if (!finished) { createSourceIfNecessary(); finished = (source != null) && source.isFinished(); if (source != null) { systemMemoryContext.setBytes(source.getSystemMemoryUsage()); } } return finished; }
private static PrestoThriftPageResult getRowsInternal(ConnectorPageSource pageSource, String tableName, List<String> columnNames, @Nullable PrestoThriftId nextToken) { // very inefficient implementation as it needs to re-generate all previous results to get the next page int skipPages = nextToken != null ? Ints.fromByteArray(nextToken.getId()) : 0; skipPages(pageSource, skipPages); Page page = null; while (!pageSource.isFinished() && page == null) { page = pageSource.getNextPage(); skipPages++; } PrestoThriftId newNextToken = pageSource.isFinished() ? null : new PrestoThriftId(Ints.toByteArray(skipPages)); return toThriftPage(page, types(tableName, columnNames), newNextToken); }
public static MaterializedResult materializeSourceDataStream(ConnectorSession session, ConnectorPageSource pageSource, List<Type> types) { MaterializedResult.Builder builder = resultBuilder(session, types); while (!pageSource.isFinished()) { Page outputPage = pageSource.getNextPage(); if (outputPage == null) { break; } builder.page(outputPage); } return builder.build(); }
@Override public Page getNextPage() { while (true) { setup(); if (current == null) { return null; } if (!current.isFinished()) { return current.getNextPage(); } completedBytes += current.getCompletedBytes(); readTimeNanos += current.getReadTimeNanos(); current = null; } }