Refine search
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); }
public void addPage(Page page) { rowCount += page.getPositionCount(); for (int channel = 0; channel < columnStatisticsValidations.size(); channel++) { columnStatisticsValidations.get(channel).addBlock(page.getBlock(channel)); } }
@Override public long getLong(int field) { checkState(position >= 0, "Not yet advanced"); checkState(position < page.getPositionCount(), "Already finished"); Type type = types.get(field); return type.getLong(page.getBlock(field), position); }
static List<Page> dropChannel(List<Page> pages, List<Integer> channels) { List<Page> actualPages = new ArrayList<>(); for (Page page : pages) { int channel = 0; Block[] blocks = new Block[page.getChannelCount() - channels.size()]; for (int i = 0; i < page.getChannelCount(); i++) { if (channels.contains(i)) { continue; } blocks[channel++] = page.getBlock(i); } actualPages.add(new Page(blocks)); } return actualPages; } }
private static Block getRowNumberColumn(List<Page> pages) { BlockBuilder builder = BIGINT.createBlockBuilder(null, pages.size() * 100); for (Page page : pages) { int rowNumberChannel = page.getChannelCount() - 1; for (int i = 0; i < page.getPositionCount(); i++) { BIGINT.writeLong(builder, page.getBlock(rowNumberChannel).getLong(i, 0)); } } return builder.build(); }
@Override public boolean isNull(int field) { checkState(position >= 0, "Not yet advanced"); checkState(position < page.getPositionCount(), "Already finished"); return page.getBlock(field).isNull(position); }
private JoinProbe(int[] probeOutputChannels, Page page, List<Integer> probeJoinChannels, OptionalInt probeHashChannel) { this.probeOutputChannels = probeOutputChannels; this.positionCount = page.getPositionCount(); this.probeBlocks = new Block[probeJoinChannels.size()]; for (int i = 0; i < probeJoinChannels.size(); i++) { probeBlocks[i] = page.getBlock(probeJoinChannels.get(i)); } this.page = page; this.probePage = new Page(page.getPositionCount(), probeBlocks); this.probeHashBlock = probeHashChannel.isPresent() ? Optional.of(page.getBlock(probeHashChannel.getAsInt())) : Optional.empty(); }
@Override public boolean rowEqualsRow(int leftPosition, Page leftPage, int rightPosition, Page rightPage) { for (int i = 0; i < hashChannels.size(); i++) { int hashChannel = hashChannels.get(i); Type type = types.get(hashChannel); Block leftBlock = leftPage.getBlock(i); Block rightBlock = rightPage.getBlock(i); if (!TypeUtils.positionEqualsPosition(type, leftBlock, leftPosition, rightBlock, rightPosition)) { return false; } } return true; }
@Override public boolean getBoolean(int field) { checkState(position >= 0, "Not yet advanced"); checkState(position < page.getPositionCount(), "Already finished"); Type type = types.get(field); return type.getBoolean(page.getBlock(field), position); }
private static Page extractColumns(Page page, int[] channels) { Block[] newBlocks = new Block[channels.length]; for (int i = 0; i < channels.length; i++) { newBlocks[i] = page.getBlock(channels[i]); } return new Page(page.getPositionCount(), newBlocks); }
public GetDictionaryGroupIdsWork(Page page) { this.page = requireNonNull(page, "page is null"); verify(canProcessDictionary(page), "invalid call to processDictionary"); this.dictionaryBlock = (DictionaryBlock) page.getBlock(channels[0]); updateDictionaryLookBack(dictionaryBlock.getDictionary()); this.dictionaryPage = createPageWithExtractedDictionary(page); // we know the exact size required for the block this.blockBuilder = BIGINT.createFixedSizeBlockBuilder(page.getPositionCount()); }
@Override public void addInput(Page page) { requireNonNull(page, "page is null"); checkState(!isFinished(), "Operator is already finished"); Block sourceBlock = page.getBlock(setChannel); Page sourcePage = hashChannel.isPresent() ? new Page(sourceBlock, page.getBlock(hashChannel.get())) : new Page(sourceBlock); unfinishedWork = channelSetBuilder.addPage(sourcePage); processUnfinishedWork(); }
@Override public int compareTo(Page left, int leftPosition, Page right, int rightPosition) { for (int i = 0; i < sortChannels.size(); i++) { int sortChannel = sortChannels.get(i); Block leftBlock = left.getBlock(sortChannel); Block rightBlock = right.getBlock(sortChannel); SortOrder sortOrder = sortOrders.get(i); int compare = sortOrder.compareBlockValue(types.get(sortChannel), leftBlock, leftPosition, rightBlock, rightPosition); if (compare != 0) { return compare; } } return 0; } }
@Override public Slice getSlice(int field) { checkState(position >= 0, "Not yet advanced"); checkState(position < page.getPositionCount(), "Already finished"); Type type = types.get(field); return type.getSlice(page.getBlock(field), position); }