public Work<?> processPage(Page page) { return new TransformWork<>( groupByHash.getGroupIds(page), groupIds -> { processPage(page, groupIds); return null; }); }
@Override public void appendTo(long partitionedJoinPosition, PageBuilder pageBuilder, int outputChannelOffset) { int partition = decodePartition(partitionedJoinPosition); int joinPosition = decodeJoinPosition(partitionedJoinPosition); lookupSources[partition].appendTo(joinPosition, pageBuilder, outputChannelOffset); if (outerPositionTracker != null) { outerPositionTracker.positionVisited(partition, joinPosition); } }
@Override public void finish() { if (finished) { return; } ChannelSet channelSet = channelSetBuilder.build(); setSupplier.setChannelSet(channelSet); operatorContext.recordOutput(channelSet.getEstimatedSizeInBytes(), channelSet.size()); finished = true; }
private int getGroupId(HashGenerator hashGenerator, Page page, int positionInDictionary) { if (dictionaryLookBack.isProcessed(positionInDictionary)) { return dictionaryLookBack.getGroupId(positionInDictionary); } int groupId = putIfAbsent(positionInDictionary, page, hashGenerator.hashPosition(positionInDictionary, page)); dictionaryLookBack.setProcessed(positionInDictionary, groupId); return groupId; }
@Override public void finish() { OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); statisticsAggregationOperator.finish(); timer.end(statisticsTiming); if (state == State.RUNNING) { state = State.FINISHING; } }
private OperationTimer createTimer() { return new OperationTimer( driverContext.isCpuTimerEnabled(), driverContext.isCpuTimerEnabled() && driverContext.isPerOperatorCpuTimerEnabled()); }
private boolean positionNotDistinctFromCurrentRow(long address, int hashPosition, int position, Page page, byte rawHash, int[] hashChannels) { if (rawHashByHashPosition[hashPosition] != rawHash) { return false; } return hashStrategy.positionNotDistinctFromRow(decodeSliceIndex(address), decodePosition(address), position, page, hashChannels); }
private void testOverallTiming(boolean trackCpuTime) { InternalTiming timing = new InternalTiming(trackCpuTime); for (int i = 1; i <= 5; i++) { OperationTimer timer = new OperationTimer(trackCpuTime, false); doSomething(); timing.record(timer::end); } }
private int putIfAbsent(int position, Page page) { long rawHash = hashGenerator.hashPosition(position, page); return putIfAbsent(position, page, rawHash); }
@Override public void recordHashCollisions(HashCollisionsCounter hashCollisionsCounter) { hashCollisionsCounter.recordHashCollision(groupByHash.getHashCollisions(), groupByHash.getExpectedHashCollisions()); }
private void finishPagesIndex() { sortPagesIndexIfNecessary(); windowInfo.addIndex(pagesIndex); }
private static AggregatedMemoryContext mockMemoryContext(ScheduledExecutorService scheduledExecutor) { // It's important to use OperatorContext's system memory context, because it does additional bookkeeping. return TestingOperatorContext.create(scheduledExecutor).newAggregateSystemMemoryContext(); }
@Override public long getJoinPosition(int position, Page hashChannelsPage, Page allChannelsPage) { int addressIndex = pagesHash.getAddressIndex(position, hashChannelsPage); return startJoinPosition(addressIndex, position, allChannelsPage); }
public void probeOperatorCreated(Lifespan lifespan) { initializeIfNecessary(); internalJoinBridgeDataManager.probeOperatorCreated(lifespan); }
public void outerOperatorFactoryClosed(Lifespan lifespan) { initializeIfNecessary(); internalJoinBridgeDataManager.outerOperatorFactoryClosed(lifespan); }
@Override public long getInMemorySizeInBytes() { return INSTANCE_SIZE + pagesHash.getInMemorySizeInBytes() + (positionLinks == null ? 0 : positionLinks.getSizeInBytes()); }
public void probeOperatorClosed(Lifespan lifespan) { initializeIfNecessary(); internalJoinBridgeDataManager.probeOperatorClosed(lifespan); }
public ListenableFuture<OuterPositionIterator> getOuterPositionsFuture(Lifespan lifespan) { initializeIfNecessary(); return internalJoinBridgeDataManager.getOuterPositionsFuture(lifespan); }
@Override public long getJoinPosition(int position, Page hashChannelsPage, Page allChannelsPage, long rawHash) { int addressIndex = pagesHash.getAddressIndex(position, hashChannelsPage, rawHash); return startJoinPosition(addressIndex, position, allChannelsPage); }