Java Code Examples for io.prestosql.spi.block.PageBuilderStatus#DEFAULT_MAX_PAGE_SIZE_IN_BYTES
The following examples show how to use
io.prestosql.spi.block.PageBuilderStatus#DEFAULT_MAX_PAGE_SIZE_IN_BYTES .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractVariableWidthType.java From presto with Apache License 2.0 | 6 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } // it is guaranteed Math.min will not overflow; safe to cast int expectedBytes = (int) min((long) expectedEntries * expectedBytesPerEntry, maxBlockSizeInBytes); return new VariableWidthBlockBuilder( blockBuilderStatus, expectedBytesPerEntry == 0 ? expectedEntries : Math.min(expectedEntries, maxBlockSizeInBytes / expectedBytesPerEntry), expectedBytes); }
Example 2
Source File: ShortTimestampWithTimeZoneType.java From presto with Apache License 2.0 | 5 votes |
@Override public final BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new LongArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Long.BYTES)); }
Example 3
Source File: PinotBrokerPageSource.java From presto with Apache License 2.0 | 5 votes |
@Override public Page getNextPage() { if (finished) { return null; } if (resultIterator == null) { long start = System.nanoTime(); resultIterator = pinotClient.createResultIterator(session, query, columnHandles); readTimeNanos = System.nanoTime() - start; } if (!resultIterator.hasNext()) { finished = true; return null; } long size = 0; while (size < PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES && resultIterator.hasNext()) { BrokerResultRow row = resultIterator.next(); for (int i = 0; i < decoders.size(); i++) { int fieldIndex = i; decoders.get(i).decode(() -> row.getField(fieldIndex), columnBuilders[i]); } size = Arrays.stream(columnBuilders) .mapToLong(BlockBuilder::getSizeInBytes) .sum(); } completedBytes += size; Block[] blocks = new Block[columnBuilders.length]; for (int i = 0; i < columnBuilders.length; i++) { blocks[i] = columnBuilders[i].build(); columnBuilders[i] = columnBuilders[i].newBlockBuilderLike(null); } return new Page(blocks); }
Example 4
Source File: LongTimestampWithTimeZoneType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new Int96ArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / getFixedSize())); }
Example 5
Source File: ShortTimestampType.java From presto with Apache License 2.0 | 5 votes |
@Override public final BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new LongArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Long.BYTES)); }
Example 6
Source File: LongDecimalType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new Int128ArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / getFixedSize())); }
Example 7
Source File: ShortDecimalType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new LongArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / getFixedSize())); }
Example 8
Source File: AbstractIntType.java From presto with Apache License 2.0 | 5 votes |
@Override public final BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new IntArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Integer.BYTES)); }
Example 9
Source File: BooleanType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new ByteArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Byte.BYTES)); }
Example 10
Source File: SmallintType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new ShortArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Short.BYTES)); }
Example 11
Source File: LongTimestampType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new Int96ArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / getFixedSize())); }
Example 12
Source File: UuidType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new Int128ArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / getFixedSize())); }
Example 13
Source File: TinyintType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new ByteArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Byte.BYTES)); }
Example 14
Source File: DoubleType.java From presto with Apache License 2.0 | 5 votes |
@Override public final BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new LongArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Double.BYTES)); }
Example 15
Source File: AbstractLongType.java From presto with Apache License 2.0 | 5 votes |
@Override public final BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new LongArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / Long.BYTES)); }
Example 16
Source File: ScanQueryPageSource.java From presto with Apache License 2.0 | 5 votes |
@Override public Page getNextPage() { long size = 0; while (size < PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES && iterator.hasNext()) { SearchHit hit = iterator.next(); Map<String, Object> document = hit.getSourceAsMap(); for (int i = 0; i < decoders.size(); i++) { String field = columns.get(i).getName(); decoders.get(i).decode(hit, () -> getField(document, field), columnBuilders[i]); } if (hit.getSourceRef() != null) { totalBytes += hit.getSourceRef().length(); } size = Arrays.stream(columnBuilders) .mapToLong(BlockBuilder::getSizeInBytes) .sum(); } Block[] blocks = new Block[columnBuilders.length]; for (int i = 0; i < columnBuilders.length; i++) { blocks[i] = columnBuilders[i].build(); columnBuilders[i] = columnBuilders[i].newBlockBuilderLike(null); } return new Page(blocks); }
Example 17
Source File: BenchmarkPagesIndexPageSorter.java From presto with Apache License 2.0 | 5 votes |
private static List<Page> createPages(int pageCount, int channelCount, Type type) { int positionCount = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES / (channelCount * 8); List<Page> pages = new ArrayList<>(pageCount); for (int numPage = 0; numPage < pageCount; numPage++) { Block[] blocks = new Block[channelCount]; for (int numChannel = 0; numChannel < channelCount; numChannel++) { if (type.equals(BIGINT)) { blocks[numChannel] = BlockAssertions.createLongSequenceBlock(0, positionCount); } else if (type.equals(VARCHAR)) { blocks[numChannel] = BlockAssertions.createStringSequenceBlock(0, positionCount); } else if (type.equals(DOUBLE)) { blocks[numChannel] = BlockAssertions.createDoubleSequenceBlock(0, positionCount); } else if (type.equals(BOOLEAN)) { blocks[numChannel] = BlockAssertions.createBooleanSequenceBlock(0, positionCount); } else { throw new IllegalArgumentException("Unsupported type: " + type); } } pages.add(new Page(blocks)); } return pages; }
Example 18
Source File: BenchmarkPagesSort.java From presto with Apache License 2.0 | 5 votes |
private void createPages(int totalChannels, int pagesCount) { int positionCount = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES / (totalChannels * 8); pages = new ArrayList<>(pagesCount); for (int numPage = 0; numPage < pagesCount; numPage++) { pages.add(createSequencePage(types, positionCount)); } totalPositions = positionCount * pagesCount; }
Example 19
Source File: UnknownType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new ByteArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / getFixedSize())); }
Example 20
Source File: IpAddressType.java From presto with Apache License 2.0 | 5 votes |
@Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { int maxBlockSizeInBytes; if (blockBuilderStatus == null) { maxBlockSizeInBytes = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES; } else { maxBlockSizeInBytes = blockBuilderStatus.getMaxPageSizeInBytes(); } return new Int128ArrayBlockBuilder( blockBuilderStatus, Math.min(expectedEntries, maxBlockSizeInBytes / getFixedSize())); }