Reorder methods in HashBuildOperator to match lifecycle
@@ -205,24 +205,12 @@ public class HashBuilderOperator
}
@Override
- public void finish()
+ public ListenableFuture<?> isBlocked()
{
- if (finishing) {
- return;
- }
- finishing = true;
-
- LookupSourceSupplier partition = index.createLookupSourceSupplier(operatorContext.getSession(), hashChannels, preComputedHashChannel, filterFunctionFactory, sortChannel, searchFunctionFactories, Optional.of(outputChannels));
- lookupSourceFactory.setPartitionLookupSourceSupplier(partitionIndex, partition);
-
- operatorContext.setMemoryReservation(partition.get().getInMemorySizeInBytes());
- hashCollisionsCounter.recordHashCollision(partition.getHashCollisions(), partition.getExpectedHashCollisions());
+ if (!finishing) {
+ return NOT_BLOCKED;
}
-
- @Override
- public boolean isFinished()
- {
- return finishing && lookupSourceFactory.isDestroyed().isDone();
+ return lookupSourceFactory.isDestroyed();
}
@Override
@@ -231,15 +219,6 @@ public class HashBuilderOperator
return !finishing;
}
- @Override
- public ListenableFuture<?> isBlocked()
- {
- if (!finishing) {
- return NOT_BLOCKED;
- }
- return lookupSourceFactory.isDestroyed();
- }
-
@Override
public void addInput(Page page)
{
@@ -259,4 +238,25 @@ public class HashBuilderOperator
{
return null;
}
+
+ @Override
+ public void finish()
+ {
+ if (finishing) {
+ return;
+ }
+ finishing = true;
+
+ LookupSourceSupplier partition = index.createLookupSourceSupplier(operatorContext.getSession(), hashChannels, preComputedHashChannel, filterFunctionFactory, sortChannel, searchFunctionFactories, Optional.of(outputChannels));
+ lookupSourceFactory.setPartitionLookupSourceSupplier(partitionIndex, partition);
+
+ operatorContext.setMemoryReservation(partition.get().getInMemorySizeInBytes());
+ hashCollisionsCounter.recordHashCollision(partition.getHashCollisions(), partition.getExpectedHashCollisions());
+ }
+
+ @Override
+ public boolean isFinished()
+ {
+ return finishing && lookupSourceFactory.isDestroyed().isDone();
+ }
}
