@Override public long getSystemMemoryUsage() { return cursor.getSystemMemoryUsage() + pageBuilder.getSizeInBytes(); }
public int[] partitionPage(Page partitionColumns, Block bucketBlock) { if (bucketBlock != null) { Block[] blocks = new Block[partitionColumns.getChannelCount() + 1]; for (int i = 0; i < partitionColumns.getChannelCount(); i++) { blocks[i] = partitionColumns.getBlock(i); } blocks[blocks.length - 1] = bucketBlock; partitionColumns = new Page(partitionColumns.getPositionCount(), blocks); } return pageIndexer.indexPage(partitionColumns); }
private static Page extractColumns(Page page, int[] columns) { Block[] blocks = new Block[columns.length]; for (int i = 0; i < columns.length; i++) { int dataColumn = columns[i]; blocks[i] = page.getBlock(dataColumn); } return new Page(page.getPositionCount(), blocks); }
private static QueryId parseQueryId(String queryId) { try { return QueryId.valueOf(queryId); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_PROCEDURE_ARGUMENT, e); } } }
public static Builder builder(ConnectorTableMetadata tableMetadata) { return builder(tableMetadata.getColumns()); }
private static void propagateIfUnhandled(PrestoException e) throws PrestoException { int errorCode = e.getErrorCode().getCode(); if (errorCode == DIVISION_BY_ZERO.toErrorCode().getCode() || errorCode == INVALID_CAST_ARGUMENT.toErrorCode().getCode() || errorCode == INVALID_FUNCTION_ARGUMENT.toErrorCode().getCode() || errorCode == NUMERIC_VALUE_OUT_OF_RANGE.toErrorCode().getCode()) { return; } throw e; } }
private static int totalRecords(RecordSet recordSet) { RecordCursor cursor = recordSet.cursor(); int result = 0; while (cursor.advanceNextPosition()) { result++; } return result; } }
private static int code(StandardErrorCode error) { return error.toErrorCode().getCode(); } }
public long getRetainedSizeInBytes() { long retainedSizeInBytes = INSTANCE_SIZE; retainedSizeInBytes += pageBuilder.getRetainedSizeInBytes(); for (Page page : outputQueue) { retainedSizeInBytes += page.getRetainedSizeInBytes(); } return retainedSizeInBytes; } }
@Override public long getCompletedBytes() { return delegate.getCompletedBytes(); }
public int getMaxIndex() { return pageIndexer.getMaxIndex(); } }